Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5369,9 +5369,24 @@ void SemaSYCL::copyDeviceKernelAttrs(CXXMethodDecl *CallOperator) {
}
}

static std::unique_ptr<MangleContext>
createSYCLCrossABIMangleContext(ASTContext &Ctx) {
// For SYCL offload compilation with cross-ABI scenarios (e.g., Microsoft
// host + Itanium device on Windows+CUDA), use device mangling context to
// ensure consistent kernel name mangling between host and device.
const TargetInfo *AuxTarget = Ctx.getAuxTargetInfo();
if (AuxTarget && Ctx.getTargetInfo().getCXXABI().isMicrosoft() &&
AuxTarget->getCXXABI().isItaniumFamily()) {
return std::unique_ptr<MangleContext>(
Ctx.createDeviceMangleContext(*AuxTarget));
}
// Same ABI or no offload target: use standard mangling
return std::unique_ptr<MangleContext>(Ctx.createMangleContext());
}

void SemaSYCL::SetSYCLKernelNames() {
std::unique_ptr<MangleContext> MangleCtx(
getASTContext().createMangleContext());
createSYCLCrossABIMangleContext(getASTContext()));
// We assume the list of KernelDescs is the complete list of kernels needing
// to be rewritten.
for (const std::pair<const FunctionDecl *, FunctionDecl *> &Pair :
Expand Down Expand Up @@ -5890,7 +5905,7 @@ void SemaSYCL::finalizeFreeFunctionKernels() {
KernelObjVisitor Visitor{*this};
Visitor.VisitFunctionParameters(kernel, IntHeader);
std::unique_ptr<MangleContext> MangleCtx(
getASTContext().createMangleContext());
createSYCLCrossABIMangleContext(getASTContext()));
std::string Name, MangledName;
std::tie(Name, MangledName) =
constructFreeFunctionKernelName(kernel, *MangleCtx);
Expand Down
2 changes: 0 additions & 2 deletions sycl/test-e2e/Printf/mixed-address-space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for constant and generic address space can be used in the same module.
//
// UNSUPPORTED: target-amd
// XFAIL: cuda && windows
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/14733
// FIXME: Drop the test once generic AS support is considered stable and the
// dedicated constant AS overload of printf is removed from the library.
//
Expand Down
2 changes: 0 additions & 2 deletions sycl/test-e2e/Printf/percent-symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// [1]: https://en.cppreference.com/w/cpp/io/c/fprintf
//
// UNSUPPORTED: target-amd
// XFAIL: cuda && windows
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/14733
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out | FileCheck %s
// FIXME: Remove dedicated constant address space testing once generic AS
Expand Down
Loading