Skip to content

Commit 6d14483

Browse files
FznamznontahonermannNaghasan
authored
[NFC][clang] Fix CodeGenSYCL::unique_stable_name_windows_diff test (#146854)
The test checks x86 target in fsycl-is-device mode. x86 is not a valid offloading target and IMO test meant to check fsycl-is-host mode to make sure host invocations of __builtin_sycl_unique_stable_name work correctly. This also switches the test to use sycl_entry_point attribute instead of sycl_kernel because the intention for the future SYCL changes is to use sycl_entry_point and eventually remove sycl_kernel attribute when sycl_entry_point supports enough SYCL cases. Fixes #146566 --------- Co-authored-by: Tom Honermann <tom@honermann.net> Co-authored-by: Victor Lomuller <victor@codeplay.com>
1 parent dcc692a commit 6d14483

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

clang/test/CodeGenSYCL/unique_stable_name_windows_diff.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
// RUN: %clang_cc1 -triple spir64-unknown-unknown-sycldevice -aux-triple x86_64-pc-windows-msvc -fsycl-is-device -disable-llvm-passes -fsycl-is-device -emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE=addrspace(1) '
2-
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsycl-is-device -disable-llvm-passes -fsycl-is-device -emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE='
1+
// RUN: %clang_cc1 -triple spir64-unknown-unknown -aux-triple x86_64-pc-windows-msvc -fsycl-is-device -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE=addrspace(1) '
2+
// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsycl-is-host -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE='
33

44

55
template<typename KN, typename Func>
6-
__attribute__((sycl_kernel)) void kernel(Func F){
6+
[[clang::sycl_kernel_entry_point(KN)]] void kernel(Func F){
77
F();
88
}
99

1010
template<typename KN, typename Func>
11-
__attribute__((sycl_kernel)) void kernel2(Func F){
11+
[[clang::sycl_kernel_entry_point(KN)]] void kernel2(Func F){
1212
F(1);
1313
}
1414

1515
template<typename KN, typename Func>
16-
__attribute__((sycl_kernel)) void kernel3(Func F){
16+
[[clang::sycl_kernel_entry_point(KN)]] void kernel3(Func F){
1717
F(1.1);
1818
}
1919

@@ -31,10 +31,19 @@ int main() {
3131

3232
// Ensure the kernels are named the same between the device and host
3333
// invocations.
34+
// Call from host.
3435
(void)__builtin_sycl_unique_stable_name(decltype(lambda1));
3536
(void)__builtin_sycl_unique_stable_name(decltype(lambda2));
3637
(void)__builtin_sycl_unique_stable_name(decltype(lambda3));
3738

39+
// Call from device.
40+
auto lambda4 = [](){
41+
(void)__builtin_sycl_unique_stable_name(decltype(lambda1));
42+
(void)__builtin_sycl_unique_stable_name(decltype(lambda2));
43+
(void)__builtin_sycl_unique_stable_name(decltype(lambda3));
44+
};
45+
kernel<class K4>(lambda4);
46+
3847
// Make sure the following 3 are the same between the host and device compile.
3948
// Note that these are NOT the same value as each other, they differ by the
4049
// signature.

0 commit comments

Comments
 (0)