Skip to content

Commit 21a3142

Browse files
authored
[SYCL] Change clang toolchain local accessor check (#5408)
This PR resolves an issue raised in #5149. It changes the the check from `IsSYCL` to `IsSYCLOffloadDevice` and limits its usage to nvptx and amdgcn. A new test is added, to prevent regression.
1 parent 8573935 commit 21a3142

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5795,7 +5795,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
57955795
}
57965796

57975797
// Enable local accessor to shared memory pass for SYCL.
5798-
if (isa<BackendJobAction>(JA) && IsSYCL) {
5798+
if (isa<BackendJobAction>(JA) && IsSYCLOffloadDevice &&
5799+
(Triple.isNVPTX() || Triple.isAMDGCN())) {
57995800
CmdArgs.push_back("-mllvm");
58005801
CmdArgs.push_back("-sycl-enable-local-accessor");
58015802
}

clang/test/Driver/sycl-local-accessor-opt.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
// REQUIRES: clang-driver
44

55
// RUN: %clang -fsycl -### %s 2>&1 \
6-
// RUN: | FileCheck -check-prefix=CHECK-NO-OPT %s
7-
// CHECK-NO-OPT-NOT: "-sycl-enable-local-accessor"
6+
// RUN: | FileCheck -check-prefix=OPT-CHECK %s
7+
8+
// RUN: %clang -fsycl -S -### %s 2>&1 \
9+
// RUN: | FileCheck -check-prefix=OPT-CHECK %s
10+
// OPT-CHECK-NOT: "-sycl-enable-local-accessor"
811

912
// RUN: %clang -fsycl -fsycl-targets=nvptx64-nvidia-cuda -### %s 2>&1 \
1013
// RUN: | FileCheck %s

0 commit comments

Comments
 (0)