Debian Codegraph @

clang/test/CodeGenCUDASPIRV/spirv-attrs.cu

raw
1 // RUN: %clang_cc1 -fcuda-is-device -triple spirv64 -o - -emit-llvm -x cuda %s | FileCheck %s
2 // RUN: %clang_cc1 -fcuda-is-device -triple spirv32 -o - -emit-llvm -x cuda %s | FileCheck %s
3
4 #define __global__ __attribute__((global))
5
6 __attribute__((reqd_work_group_size(0, 0, 0)))
7 __global__ void reqd_work_group_size_0_0_0() {}
8
9 __attribute__((reqd_work_group_size(128, 1, 1)))
10 __global__ void reqd_work_group_size_128_1_1() {}
11
12 __attribute__((work_group_size_hint(2, 2, 2)))
13 __global__ void work_group_size_hint_2_2_2() {}
14
15 __attribute__((vec_type_hint(int)))
16 __global__ void vec_type_hint_int() {}
17
18 __attribute__((intel_reqd_sub_group_size(64)))
19 __global__ void intel_reqd_sub_group_size_64() {}
20
21 template <unsigned a, unsigned b, unsigned c>
22 __attribute__((reqd_work_group_size(a, b, c)))
23 __global__ void reqd_work_group_size_a_b_c() {}
24
25 template __global__ void reqd_work_group_size_a_b_c<256,1,1>(void);
26
27 // CHECK: define spir_kernel void @_Z26reqd_work_group_size_0_0_0v() #[[ATTR:[0-9]+]] !reqd_work_group_size ![[WG_SIZE_ZEROS:[0-9]+]]
28 // CHECK: define spir_kernel void @_Z28reqd_work_group_size_128_1_1v() #[[ATTR:[0-9]+]] !reqd_work_group_size ![[WG_SIZE:[0-9]+]]
29 // CHECK: define spir_kernel void @_Z26work_group_size_hint_2_2_2v() #[[ATTR]] !work_group_size_hint ![[WG_HINT:[0-9]+]]
30 // CHECK: define spir_kernel void @_Z17vec_type_hint_intv() #[[ATTR]] !vec_type_hint ![[VEC_HINT:[0-9]+]]
31 // CHECK: define spir_kernel void @_Z28intel_reqd_sub_group_size_64v() #[[ATTR]] !intel_reqd_sub_group_size ![[SUB_GRP:[0-9]+]]
32 // CHECK: define spir_kernel void @_Z26reqd_work_group_size_a_b_cILj256ELj1ELj1EEvv() #[[ATTR]] comdat !reqd_work_group_size ![[WG_SIZE_TMPL:[0-9]+]]
33
34 // CHECK: attributes #[[ATTR]] = { {{.*}} }
35
36 // CHECK: ![[WG_SIZE_ZEROS]] = !{i32 0, i32 0, i32 0}
37 // CHECK: ![[WG_SIZE]] = !{i32 128, i32 1, i32 1}
38 // CHECK: ![[WG_HINT]] = !{i32 2, i32 2, i32 2}
39 // CHECK: ![[VEC_HINT]] = !{i32 poison, i32 1}
40 // CHECK: ![[SUB_GRP]] = !{i32 64}
41 // CHECK: ![[WG_SIZE_TMPL]] = !{i32 256, i32 1, i32 1}