Commit 55c155c
committed
[SYCL] Fix kernel name mangling for CUDA/HIP with Microsoft ABI host
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:
- Added createSYCLMangleContext() helper that detects Microsoft-to-Itanium
ABI scenarios
- When detected, uses createDeviceMangleContext() for host compilation to
ensure Itanium mangling on both sides
- Applied to both host and device compilation phases via
(LangOpts.SYCLIsHost || LangOpts.SYCLIsDevice) guard
This ensures identical kernel names across compilations, allowing runtime
lookup to succeed.
Fixes CMPLRLLVM-696421 parent 8c614ad commit 55c155c
File tree
2 files changed
+23
-4
lines changed- clang/lib/Sema
- sycl/test-e2e/IntermediateLib
2 files changed
+23
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7733 | 7733 | | |
7734 | 7734 | | |
7735 | 7735 | | |
| 7736 | + | |
| 7737 | + | |
| 7738 | + | |
| 7739 | + | |
| 7740 | + | |
| 7741 | + | |
| 7742 | + | |
| 7743 | + | |
| 7744 | + | |
| 7745 | + | |
| 7746 | + | |
| 7747 | + | |
| 7748 | + | |
| 7749 | + | |
| 7750 | + | |
| 7751 | + | |
7736 | 7752 | | |
| 7753 | + | |
| 7754 | + | |
| 7755 | + | |
7737 | 7756 | | |
7738 | | - | |
| 7757 | + | |
| 7758 | + | |
| 7759 | + | |
| 7760 | + | |
7739 | 7761 | | |
7740 | 7762 | | |
7741 | 7763 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | 1 | | |
5 | 2 | | |
6 | 3 | | |
| |||
0 commit comments