[clang] [llvm] [SYCL] Add offload wrapping for SYCL kind. (PR #147508)
Yury Plyakhin via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 17 18:20:38 PDT 2025
================
@@ -754,6 +762,36 @@ bundleOpenMP(ArrayRef<OffloadingImage> Images) {
return std::move(Buffers);
}
+Expected<SmallVector<std::unique_ptr<MemoryBuffer>>>
+bundleSYCL(ArrayRef<OffloadingImage> Images) {
+ SmallVector<std::unique_ptr<MemoryBuffer>> Buffers;
+ if (DryRun) {
+ // In dry-run mode there is an empty input which is insufficient for
+ // the testing. Therefore, we insert a stub value.
+ OffloadBinary::OffloadingImage Image;
+ Image.TheOffloadKind = OffloadKind::OFK_SYCL;
+ Image.Image = MemoryBuffer::getMemBufferCopy("");
+ SmallString<0> SerializedImage = OffloadBinary::write(Image);
+ Buffers.emplace_back(MemoryBuffer::getMemBufferCopy(SerializedImage));
+ return Buffers;
+ }
+
+ for (const OffloadingImage &TheImage : Images) {
+ SmallVector<OffloadFile> OffloadBinaries;
+ if (Error E = extractOffloadBinaries(*TheImage.Image, OffloadBinaries))
+ return E;
+
+ for (const OffloadFile &File : OffloadBinaries) {
+ const OffloadBinary &Binary = *File.getBinary();
+ SmallString<0> SerializedImage =
+ OffloadBinary::write(Binary.getOffloadingImage());
----------------
YuriPlyakhin wrote:
I think it's time for us to meet and discuss all questions during a call. I'll put together some slides and contact you by email to schedule a call.
https://github.com/llvm/llvm-project/pull/147508
More information about the llvm-commits
mailing list