Repository navigation
[Clang][OffloadBundler] Match the target ID of SYCL bundle entry IDs #23491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
uditagarwal97
merged 5 commits into
intel:sycl
from
srividya-sundaram:sycl-bundler-sycl-target-id
Oct 16, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4630123
[Clang][OffloadBundler] Match the target ID of SYCL bundle entry IDs
srividya-sundaram 3685c73
Prefer an exact target ID match when unbundling SYCL code objects
srividya-sundaram 2fe224c
Explain the exact and fallback target matching when unbundling
srividya-sundaram e486940
Rename IsExactMatch to TargetIDPresenceMatches and clarify the tests
srividya-sundaram 7c7323b
Name the bundle entry and requested target in the matching comments
srividya-sundaram File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
clang/test/OffloadTools/clang-offload-bundler/sycl-target-id.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| // REQUIRES: x86-registered-target | ||
|
|
||
| // SYCL bundle entry IDs use a 3-component triple followed by the target ID, | ||
| // e.g. sycl-spir64_gen-unknown-unknown-pvc. Check that each target ID is | ||
| // unbundled to its own code object. | ||
|
|
||
| // RUN: %clang -O0 -target x86_64-unknown-linux-gnu %s -c -o %t.o | ||
| // RUN: echo 'host' > %t.host | ||
| // RUN: echo 'tgt1' > %t.tgt1 | ||
| // RUN: echo 'tgt2' > %t.tgt2 | ||
|
|
||
| // Text bundles. | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.host -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.ii \ | ||
| // RUN: -targets=host-x86_64-unknown-linux-gnu,sycl-spir64_gen-unknown-unknown-tgllp,sycl-spir64_gen-unknown-unknown-pvc | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.bundle.ii -output=%t.res1 -output=%t.res2 -unbundle \ | ||
| // RUN: -targets=sycl-spir64_gen-unknown-unknown-tgllp,sycl-spir64_gen-unknown-unknown-pvc | ||
| // RUN: diff %t.tgt1 %t.res1 | ||
| // RUN: diff %t.tgt2 %t.res2 | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.bundle.ii -output=%t.res -unbundle \ | ||
| // RUN: -targets=sycl-spir64_gen-unknown-unknown-pvc | ||
| // RUN: diff %t.tgt2 %t.res | ||
|
|
||
| // RUN: clang-offload-bundler -type=ii -input=%t.host -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.nv.ii \ | ||
| // RUN: -targets=host-x86_64-unknown-linux-gnu,sycl-nvptx64-nvidia-cuda-sm_80,sycl-nvptx64-nvidia-cuda-sm_90 | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.bundle.nv.ii -output=%t.res -unbundle \ | ||
| // RUN: -targets=sycl-nvptx64-nvidia-cuda-sm_90 | ||
| // RUN: diff %t.tgt2 %t.res | ||
|
|
||
| // Object bundles, as produced for -fsycl-targets=intel_gpu_* with and without | ||
| // -fno-sycl-rdc. With -fno-sycl-rdc, the old offloading model names the SPIR | ||
| // AOT triple spir64_gen_image. | ||
| // RUN: clang-offload-bundler -type=o -input=%t.o -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.o \ | ||
| // RUN: -targets=host-x86_64-unknown-linux-gnu,sycl-spir64_gen-unknown-unknown-tgllp,sycl-spir64_gen-unknown-unknown-pvc | ||
| // RUN: clang-offload-bundler -type=o -input=%t.bundle.o -output=%t.res -unbundle \ | ||
| // RUN: -targets=sycl-spir64_gen-unknown-unknown-pvc | ||
| // RUN: diff %t.tgt2 %t.res | ||
|
srividya-sundaram marked this conversation as resolved.
|
||
| // RUN: clang-offload-bundler -type=o -input=%t.o -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.image.o \ | ||
| // RUN: -targets=host-x86_64-unknown-linux-gnu,sycl-spir64_gen_image-unknown-unknown-tgllp,sycl-spir64_gen_image-unknown-unknown-pvc | ||
| // RUN: clang-offload-bundler -type=o -input=%t.bundle.image.o -output=%t.res -unbundle \ | ||
| // RUN: -targets=sycl-spir64_gen_image-unknown-unknown-pvc | ||
|
srividya-sundaram marked this conversation as resolved.
|
||
| // RUN: diff %t.tgt2 %t.res | ||
|
|
||
| // A SYCL code object without a target ID is still compatible with any target | ||
| // ID of the same triple, and vice versa. | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.host -input=%t.tgt1 -output=%t.bundle.noid.ii \ | ||
| // RUN: -targets=host-x86_64-unknown-linux-gnu,sycl-spir64_gen-unknown-unknown | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.bundle.noid.ii -output=%t.res -unbundle \ | ||
| // RUN: -targets=sycl-spir64_gen-unknown-unknown-pvc | ||
| // RUN: diff %t.tgt1 %t.res | ||
| // With no exact match for a target without a target ID, the first compatible | ||
| // entry is used (tgllp here, as it comes before pvc in the bundle). | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.bundle.ii -output=%t.res -unbundle \ | ||
| // RUN: -targets=sycl-spir64_gen-unknown-unknown | ||
|
srividya-sundaram marked this conversation as resolved.
|
||
| // RUN: diff %t.tgt1 %t.res | ||
|
|
||
| // With entries both with and without a target ID, an exact target ID match is | ||
| // used regardless of the order of the entries. | ||
| // RUN: echo 'noid' > %t.noid | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.host -input=%t.noid -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.mixed.ii \ | ||
| // RUN: -targets=host-x86_64-unknown-linux-gnu,sycl-spir64_gen-unknown-unknown,sycl-spir64_gen-unknown-unknown-tgllp,sycl-spir64_gen-unknown-unknown-pvc | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.bundle.mixed.ii -output=%t.res -unbundle \ | ||
| // RUN: -targets=sycl-spir64_gen-unknown-unknown-pvc | ||
| // RUN: diff %t.tgt2 %t.res | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.bundle.mixed.ii -output=%t.res1 -output=%t.res2 -unbundle \ | ||
| // RUN: -targets=sycl-spir64_gen-unknown-unknown-tgllp,sycl-spir64_gen-unknown-unknown | ||
| // RUN: diff %t.tgt1 %t.res1 | ||
| // RUN: diff %t.noid %t.res2 | ||
| // The entry without a target ID is used for a target ID with no exact entry. | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.bundle.mixed.ii -output=%t.res -unbundle \ | ||
| // RUN: -targets=sycl-spir64_gen-unknown-unknown-acm_g10 | ||
| // RUN: diff %t.noid %t.res | ||
|
|
||
| // 4-component triples are unaffected. | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.host -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.hip.ii \ | ||
| // RUN: -targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx908,hipv4-amdgcn-amd-amdhsa--gfx90a | ||
| // RUN: clang-offload-bundler -type=ii -input=%t.bundle.hip.ii -output=%t.res -unbundle \ | ||
| // RUN: -targets=hipv4-amdgcn-amd-amdhsa--gfx90a | ||
| // RUN: diff %t.tgt2 %t.res | ||
|
|
||
| int A = 0; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.