================
@@ -909,15 +927,79 @@ bundleOpenMP(ArrayRef<OffloadingImage> Images) {
 
 Expected<SmallVector<std::unique_ptr<MemoryBuffer>>>
 bundleSYCL(ArrayRef<OffloadingImage> Images) {
+  // clang-sycl-linker packs its outputs into one offload binary, which is
+  // passed to the offload wrapper as is.
   SmallVector<std::unique_ptr<MemoryBuffer>> Buffers;
+  if (Images.size() <= 1) {
+    for (const OffloadingImage &Image : Images)
+      Buffers.emplace_back(MemoryBuffer::getMemBufferCopy(
+          Image.Image->getBuffer(), Image.Image->getBufferIdentifier()));
+    return std::move(Buffers);
+  }
+
+  // Images with different "code" are linked separately, but the SYCL runtime
+  // registers a single offload binary, so merge their device images into one.
----------------
YuriPlyakhin wrote:

```suggestion
  // Images for different IGCA targets or with different "code" are linked 
separately,
  // but the SYCL runtime registers one offload binary per wrapper, so merge 
their
  // device images into one.
```

https://github.com/llvm/llvm-project/pull/239010
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to