-
Notifications
You must be signed in to change notification settings - Fork 807
[WIP][SYCL] Fix kernel name mangling for CUDA/HIP with Microsoft ABI host #20973
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
Draft
kekaczma
wants to merge
2
commits into
sycl
Choose a base branch
from
CMPLRLLVM-69642-sycl-cuda-kernel-mangling
base: sycl
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+37
−5
Conversation
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
32c9f70 to
55c155c
Compare
55c155c to
307759c
Compare
451b21b to
7445a0a
Compare
520457d to
ede11a7
Compare
In SYCL offload compilation, when the host uses Microsoft ABI and the device uses Itanium ABI (e.g., Windows host with CUDA device), kernel names were mangled differently between host and device code, causing runtime errors when the host tried to find kernels by name. This fix ensures consistent mangling by using the device's mangling context on the host side when compiling for cross-ABI scenarios. This is detected by checking if the host target uses Microsoft ABI while the auxiliary (device) target uses Itanium ABI. The change is minimal and only affects the specific cross-ABI case, preserving existing behavior for same-ABI compilations.
82281c9 to
f2a7f1f
Compare
This removes XFAIL: cuda && windows from mixed-address-space.cpp and percent-symbol.cpp tests, which were failing due to kernel name mangling inconsistencies between Windows host (Microsoft ABI) and CUDA device (Itanium ABI). The cross-ABI mangling fix resolves issue #14733. The int.cpp test remains XFAIL for CUDA due to a separate issue #14734 with short type overflow in CUDA printf implementation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
SYCL kernel names are generated during template instantiation using MangleContext, which produces different encodings based on target ABI. When host compilation uses Microsoft ABI and device compilation targets Itanium ABI (CUDA/HIP), this caused runtime kernel lookup failures:
No kernel named _ZTSZZ21performIncrementationENK... was found
The issue occurred because Sema::PerformPendingInstantiations() used ASTContext::createMangleContext(), which creates an ABI-specific context for the primary target. In cross-ABI scenarios (Microsoft host + Itanium device), this produced inconsistent names between host and device.
Solution:
This ensures identical kernel names across compilations, allowing runtime lookup to succeed.