| 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=' |
| 3 |
|
| 4 |
|
| 5 |
template<typename KN, typename Func> |
| 6 |
[[clang::sycl_kernel_entry_point(KN)]] void kernel(Func F){ |
| 7 |
F(); |
| 8 |
} |
| 9 |
|
| 10 |
template<typename KN, typename Func> |
| 11 |
[[clang::sycl_kernel_entry_point(KN)]] void kernel2(Func F){ |
| 12 |
F(1); |
| 13 |
} |
| 14 |
|
| 15 |
template<typename KN, typename Func> |
| 16 |
[[clang::sycl_kernel_entry_point(KN)]] void kernel3(Func F){ |
| 17 |
F(1.1); |
| 18 |
} |
| 19 |
|
| 20 |
int main() { |
| 21 |
int i; |
| 22 |
double d; |
| 23 |
float f; |
| 24 |
auto lambda1 = [](){}; |
| 25 |
auto lambda2 = [](int){}; |
| 26 |
auto lambda3 = [](double){}; |
| 27 |
|
| 28 |
kernel<class K1>(lambda1); |
| 29 |
kernel2<class K2>(lambda2); |
| 30 |
kernel3<class K3>(lambda3); |
| 31 |
|
| 32 |
// Ensure the kernels are named the same between the device and host |
| 33 |
// invocations. |
| 34 |
// Call from host. |
| 35 |
(void)__builtin_sycl_unique_stable_name(decltype(lambda1)); |
| 36 |
(void)__builtin_sycl_unique_stable_name(decltype(lambda2)); |
| 37 |
(void)__builtin_sycl_unique_stable_name(decltype(lambda3)); |
| 38 |
|
| 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 |
|
| 47 |
// Make sure the following 3 are the same between the host and device compile. |
| 48 |
// Note that these are NOT the same value as each other, they differ by the |
| 49 |
// signature. |
| 50 |
// CHECK: private unnamed_addr [[$ADDRSPACE]]constant [17 x i8] c"_ZTSZ4mainEUlvE_\00" |
| 51 |
// CHECK: private unnamed_addr [[$ADDRSPACE]]constant [17 x i8] c"_ZTSZ4mainEUliE_\00" |
| 52 |
// CHECK: private unnamed_addr [[$ADDRSPACE]]constant [17 x i8] c"_ZTSZ4mainEUldE_\00" |
| 53 |
} |