Repository navigation
Conversation
Align SYCL no-RDC with the upstream flow: clang-linker-wrapper --emit-fatbin-only emits finalized post-link device images in a single offload binary container, without wrapping or host linking, and the host compilation wraps it for runtime registration via -foffload-include-binary. The same container also supports device-only image extraction. Each container entry carries the image together with the SYCL runtime metadata (target, image format, kernel entries, properties and compile/link options). The host compilation reads the entries back, builds the descriptor-based registration the SYCL runtime expects and links it into the host module. Image dumping and compression are shared between the wrapped and fat binary outputs. NativeCPU and --sycl-embed-ir for NVPTX/AMDGCN, which add host objects, are diagnosed with --emit-fatbin-only. Related to CMPLRLLVM-77274 ticket. Co-Authored-By: OpenAI Codex <noreply@openai.com>
|
Test failures in CI seem unrelated and reported in #23521. |
|
@intel/dpcpp-cfe-reviewers, please, check clang's CodeGen changes. |
| // wraps an offload binary container into such a descriptor, so there is | ||
| // nothing to embed here. In SYCL CUDA compatibility mode the file is the | ||
| // CUDA fat binary, which CUDA registers. | ||
| if (getLangOpts().CUDA || llvm::identify_magic(Buffer->getBuffer()) == |
There was a problem hiding this comment.
The check for bitcode file has been removed. Is that intentional? What happens if we encounter one now?
There was a problem hiding this comment.
The check for bitcode file has been removed. Is that intentional?
Yes, it's intentional.
As I mentioned in the PR description, PR moves no-RDC device binary wrapping from clang-linker-wrapper to clang to align the workflow with the upstream.
What happens if we encounter one now?
Any filetype other than offload binary, clang will register as device image.
|
|
||
| // Missing file: err_cannot_open_file | ||
| // RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fsycl-is-host \ | ||
| // RUN: -foffload-include-binary no-such-file.bc -emit-obj -o /dev/null %s 2>&1 \ |
There was a problem hiding this comment.
Should this be updated from .bc?
There was a problem hiding this comment.
7b2e57d removes file extension to avoid confusion. The format of non-existing file is irrelevant.
| // RUN: llvm-as %t/wrapper.ll -o %t/wrapper.bc | ||
| // RUN: echo -n 'FAKE_SYCL_DEVICE_IMAGE' > %t/image.bin | ||
| // RUN: llvm-offload-binary -o %t/fatbin.syclfb \ | ||
| // RUN: --image=file=%t/image.bin,kind=sycl,triple=spir64-unknown-unknown,arch=,sycl-target=spir64,sycl-image-format=0,symbols=_ZTS1K,compile-opts=-g,link-opts=-cl-opt |
There was a problem hiding this comment.
Can we add a test with more than 1 image?
| // RUN: --implicit-check-not='.sycl_fatbin' \ | ||
| // RUN: --implicit-check-not='.sycl_offloading.binary' | ||
| // CHECK-LINK: @llvm.global_ctors = {{.*}} ptr @sycl.descriptor_reg | ||
| // CHECK-LINK-DAG: @.sycl_offloading.target.0 = internal unnamed_addr constant [7 x i8] c"spir64\00" |
There was a problem hiding this comment.
Can we add a test with missing sycl-target? What is expected behavior then?
There was a problem hiding this comment.
Added in 7b2e57d.
Clang registers image with empty sycl-target property. I don't think any UR adapter handles images with "unknown" target property today.
Align SYCL no-RDC with the upstream flow: clang-linker-wrapper
--emit-fatbin-only emits finalized post-link device images in a single
offload binary container, without wrapping or host linking, and the host
compilation wraps it for runtime registration via -foffload-include-binary.
The same container also supports device-only image extraction.
Each container entry carries the image together with the SYCL runtime
metadata (target, image format, kernel entries, properties and compile/link
options). The host compilation reads the entries back, builds the
descriptor-based registration the SYCL runtime expects and links it into the
host module.
Image dumping and compression are shared between the wrapped and fat binary
outputs. NativeCPU and --sycl-embed-ir for NVPTX/AMDGCN, which add host
objects, are diagnosed with --emit-fatbin-only.
Related to CMPLRLLVM-77274 ticket.
Co-Authored-By: OpenAI Codex noreply@openai.com