|
| 1 | +// RUN: %clang -I %S/Inputs --sycl -Xclang -fsycl-int-header=%t.h %s -c -o kernel.spv |
| 2 | +// RUN: FileCheck -input-file=%t.h %s |
| 3 | + |
| 4 | +// CHECK: // Forward declarations of templated kernel function types: |
| 5 | +// CHECK-NEXT: template <typename T, typename T2, long N, unsigned long M> struct functor1; |
| 6 | +// CHECK-NEXT: template <typename T, typename T2, long N, unsigned long M> struct functor2; |
| 7 | +// CHECK-NEXT: template <typename T, typename T2> struct functor3; |
| 8 | +// |
| 9 | +// CHECK: // Specializations of KernelInfo for kernel function types: |
| 10 | +// CHECK: template <> struct KernelInfo<struct functor1<long, unsigned long, 0, 1>> { |
| 11 | +// CHECK: template <> struct KernelInfo<struct functor2<long, unsigned long, 0, 1>> { |
| 12 | +// CHECK: template <> struct KernelInfo<struct functor3<int, int>> { |
| 13 | +// CHECK: template <> struct KernelInfo<struct functor3<long, int>> { |
| 14 | +// CHECK: template <> struct KernelInfo<struct functor3<int, unsigned long>> { |
| 15 | +// CHECK: template <> struct KernelInfo<struct functor3<long, float>> { |
| 16 | +// CHECK: template <> struct KernelInfo<struct functor3<float, unsigned long>> { |
| 17 | +// CHECK: template <> struct KernelInfo<struct functor3<long, unsigned long>> { |
| 18 | + |
| 19 | +#include "sycl.hpp" |
| 20 | + |
| 21 | +template <typename KernelName, typename KernelType> |
| 22 | +__attribute__((sycl_kernel)) void kernel_single_task(KernelType kernelFunc) { |
| 23 | + kernelFunc(); |
| 24 | +} |
| 25 | + |
| 26 | +typedef signed long int signed_integer_t; |
| 27 | + |
| 28 | +using unsigned_integer_t = unsigned long int; |
| 29 | + |
| 30 | +template <typename T, typename T2, signed long int N, unsigned long int M> |
| 31 | +struct functor1 { void operator()() {} }; |
| 32 | + |
| 33 | +template <typename T, typename T2, signed_integer_t N, unsigned_integer_t M> |
| 34 | +struct functor2 { void operator()() {} }; |
| 35 | + |
| 36 | +template <typename T, typename T2> |
| 37 | +struct functor3 { void operator()() {} }; |
| 38 | + |
| 39 | +template <typename T> |
| 40 | +struct functor3<signed_integer_t, T> { void operator()() {} }; |
| 41 | + |
| 42 | +template <typename T> |
| 43 | +struct functor3<T, unsigned_integer_t> { void operator()() {} }; |
| 44 | + |
| 45 | +template <> |
| 46 | +struct functor3<signed_integer_t, float> { void operator()() {} }; |
| 47 | + |
| 48 | +template <> |
| 49 | +struct functor3<float, unsigned_integer_t> { void operator()() {} }; |
| 50 | + |
| 51 | +template <> |
| 52 | +struct functor3<signed_integer_t, unsigned_integer_t> { void operator()() {} }; |
| 53 | + |
| 54 | +int main() { |
| 55 | + functor1<signed long int, unsigned long int, 0L, 1UL> Functor1; |
| 56 | + kernel_single_task<decltype(Functor1)>(Functor1); |
| 57 | + |
| 58 | + functor2<signed_integer_t, unsigned_integer_t, 0L, 1UL> Functor2; |
| 59 | + kernel_single_task<decltype(Functor2)>(Functor2); |
| 60 | + |
| 61 | + functor3<int, int> Functor3; |
| 62 | + kernel_single_task<decltype(Functor3)>(Functor3); |
| 63 | + |
| 64 | + functor3<signed_integer_t, int> Functor4; |
| 65 | + kernel_single_task<decltype(Functor4)>(Functor4); |
| 66 | + |
| 67 | + functor3<int, unsigned_integer_t> Functor5; |
| 68 | + kernel_single_task<decltype(Functor5)>(Functor5); |
| 69 | + |
| 70 | + functor3<signed_integer_t, float> Functor6; |
| 71 | + kernel_single_task<decltype(Functor6)>(Functor6); |
| 72 | + |
| 73 | + functor3<float, unsigned_integer_t> Functor7; |
| 74 | + kernel_single_task<decltype(Functor7)>(Functor7); |
| 75 | + |
| 76 | + functor3<signed_integer_t, unsigned_integer_t> Functor8; |
| 77 | + kernel_single_task<decltype(Functor8)>(Functor8); |
| 78 | + |
| 79 | + return 0; |
| 80 | +} |
0 commit comments