[clang] 6d14483 - [NFC][clang] Fix CodeGenSYCL::unique_stable_name_windows_diff test (#146854)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 8 00:33:24 PDT 2025


Author: Mariya Podchishchaeva
Date: 2025-07-08T09:33:19+02:00
New Revision: 6d14483912807072d35714538ae41123686d7abd

URL: https://github.com/llvm/llvm-project/commit/6d14483912807072d35714538ae41123686d7abd
DIFF: https://github.com/llvm/llvm-project/commit/6d14483912807072d35714538ae41123686d7abd.diff

LOG: [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 https://github.com/llvm/llvm-project/issues/146566

---------

Co-authored-by: Tom Honermann <tom at honermann.net>
Co-authored-by: Victor Lomuller <victor at codeplay.com>

Added: 
    

Modified: 
    clang/test/CodeGenSYCL/unique_stable_name_windows_diff.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGenSYCL/unique_stable_name_windows_
diff .cpp b/clang/test/CodeGenSYCL/unique_stable_name_windows_
diff .cpp
index 7dd08a0c89255..14366a092a1fe 100644
--- a/clang/test/CodeGenSYCL/unique_stable_name_windows_
diff .cpp
+++ b/clang/test/CodeGenSYCL/unique_stable_name_windows_
diff .cpp
@@ -1,19 +1,19 @@
-// 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) '
-// 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='
+// 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) '
+// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -fsycl-is-host -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s '-D$ADDRSPACE='
 
 
 template<typename KN, typename Func>
-__attribute__((sycl_kernel)) void kernel(Func F){
+[[clang::sycl_kernel_entry_point(KN)]] void kernel(Func F){
   F();
 }
 
 template<typename KN, typename Func>
-__attribute__((sycl_kernel)) void kernel2(Func F){
+[[clang::sycl_kernel_entry_point(KN)]] void kernel2(Func F){
   F(1);
 }
 
 template<typename KN, typename Func>
-__attribute__((sycl_kernel)) void kernel3(Func F){
+[[clang::sycl_kernel_entry_point(KN)]] void kernel3(Func F){
   F(1.1);
 }
 
@@ -31,10 +31,19 @@ int main() {
 
   // Ensure the kernels are named the same between the device and host
   // invocations.
+  // Call from host.
   (void)__builtin_sycl_unique_stable_name(decltype(lambda1));
   (void)__builtin_sycl_unique_stable_name(decltype(lambda2));
   (void)__builtin_sycl_unique_stable_name(decltype(lambda3));
 
+  // Call from device.
+  auto lambda4 = [](){
+    (void)__builtin_sycl_unique_stable_name(decltype(lambda1));
+    (void)__builtin_sycl_unique_stable_name(decltype(lambda2));
+    (void)__builtin_sycl_unique_stable_name(decltype(lambda3));
+  };
+  kernel<class K4>(lambda4);
+
   // Make sure the following 3 are the same between the host and device compile.
   // Note that these are NOT the same value as each other, they 
diff er by the
   // signature.


        


More information about the cfe-commits mailing list