annotate clang/test/SemaCUDA/amdgpu-attrs.cu @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2 #include "Inputs/cuda.h"
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4
anatofuz
parents:
diff changeset
5 __attribute__((amdgpu_flat_work_group_size(32, 64)))
anatofuz
parents:
diff changeset
6 __global__ void flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 __attribute__((amdgpu_waves_per_eu(2)))
anatofuz
parents:
diff changeset
9 __global__ void waves_per_eu_2() {}
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 __attribute__((amdgpu_waves_per_eu(2, 4)))
anatofuz
parents:
diff changeset
12 __global__ void waves_per_eu_2_4() {}
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 __attribute__((amdgpu_num_sgpr(32)))
anatofuz
parents:
diff changeset
15 __global__ void num_sgpr_32() {}
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 __attribute__((amdgpu_num_vgpr(64)))
anatofuz
parents:
diff changeset
18 __global__ void num_vgpr_64() {}
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_waves_per_eu(2)))
anatofuz
parents:
diff changeset
22 __global__ void flat_work_group_size_32_64_waves_per_eu_2() {}
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_waves_per_eu(2, 4)))
anatofuz
parents:
diff changeset
25 __global__ void flat_work_group_size_32_64_waves_per_eu_2_4() {}
anatofuz
parents:
diff changeset
26
anatofuz
parents:
diff changeset
27 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_num_sgpr(32)))
anatofuz
parents:
diff changeset
28 __global__ void flat_work_group_size_32_64_num_sgpr_32() {}
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_num_vgpr(64)))
anatofuz
parents:
diff changeset
31 __global__ void flat_work_group_size_32_64_num_vgpr_64() {}
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 __attribute__((amdgpu_waves_per_eu(2), amdgpu_num_sgpr(32)))
anatofuz
parents:
diff changeset
34 __global__ void waves_per_eu_2_num_sgpr_32() {}
anatofuz
parents:
diff changeset
35
anatofuz
parents:
diff changeset
36 __attribute__((amdgpu_waves_per_eu(2), amdgpu_num_vgpr(64)))
anatofuz
parents:
diff changeset
37 __global__ void waves_per_eu_2_num_vgpr_64() {}
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 __attribute__((amdgpu_waves_per_eu(2, 4), amdgpu_num_sgpr(32)))
anatofuz
parents:
diff changeset
40 __global__ void waves_per_eu_2_4_num_sgpr_32() {}
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 __attribute__((amdgpu_waves_per_eu(2, 4), amdgpu_num_vgpr(64)))
anatofuz
parents:
diff changeset
43 __global__ void waves_per_eu_2_4_num_vgpr_64() {}
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 __attribute__((amdgpu_num_sgpr(32), amdgpu_num_vgpr(64)))
anatofuz
parents:
diff changeset
46 __global__ void num_sgpr_32_num_vgpr_64() {}
anatofuz
parents:
diff changeset
47
anatofuz
parents:
diff changeset
48 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_waves_per_eu(2), amdgpu_num_sgpr(32)))
anatofuz
parents:
diff changeset
49 __global__ void flat_work_group_size_32_64_waves_per_eu_2_num_sgpr_32() {}
anatofuz
parents:
diff changeset
50
anatofuz
parents:
diff changeset
51 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_waves_per_eu(2), amdgpu_num_vgpr(64)))
anatofuz
parents:
diff changeset
52 __global__ void flat_work_group_size_32_64_waves_per_eu_2_num_vgpr_64() {}
anatofuz
parents:
diff changeset
53
anatofuz
parents:
diff changeset
54 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_waves_per_eu(2, 4), amdgpu_num_sgpr(32)))
anatofuz
parents:
diff changeset
55 __global__ void flat_work_group_size_32_64_waves_per_eu_2_4_num_sgpr_32() {}
anatofuz
parents:
diff changeset
56
anatofuz
parents:
diff changeset
57 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_waves_per_eu(2, 4), amdgpu_num_vgpr(64)))
anatofuz
parents:
diff changeset
58 __global__ void flat_work_group_size_32_64_waves_per_eu_2_4_num_vgpr_64() {}
anatofuz
parents:
diff changeset
59
anatofuz
parents:
diff changeset
60 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_waves_per_eu(2), amdgpu_num_sgpr(32), amdgpu_num_vgpr(64)))
anatofuz
parents:
diff changeset
61 __global__ void flat_work_group_size_32_64_waves_per_eu_2_num_sgpr_32_num_vgpr_64() {}
anatofuz
parents:
diff changeset
62
anatofuz
parents:
diff changeset
63 __attribute__((amdgpu_flat_work_group_size(32, 64), amdgpu_waves_per_eu(2, 4), amdgpu_num_sgpr(32), amdgpu_num_vgpr(64)))
anatofuz
parents:
diff changeset
64 __global__ void flat_work_group_size_32_64_waves_per_eu_2_4_num_sgpr_32_num_vgpr_64() {}
anatofuz
parents:
diff changeset
65
anatofuz
parents:
diff changeset
66 // expected-error@+2{{attribute 'reqd_work_group_size' can only be applied to an OpenCL kernel function}}
anatofuz
parents:
diff changeset
67 __attribute__((reqd_work_group_size(32, 64, 64)))
anatofuz
parents:
diff changeset
68 __global__ void reqd_work_group_size_32_64_64() {}
anatofuz
parents:
diff changeset
69
anatofuz
parents:
diff changeset
70 // expected-error@+2{{attribute 'work_group_size_hint' can only be applied to an OpenCL kernel function}}
anatofuz
parents:
diff changeset
71 __attribute__((work_group_size_hint(2, 2, 2)))
anatofuz
parents:
diff changeset
72 __global__ void work_group_size_hint_2_2_2() {}
anatofuz
parents:
diff changeset
73
anatofuz
parents:
diff changeset
74 // expected-error@+2{{attribute 'vec_type_hint' can only be applied to an OpenCL kernel function}}
anatofuz
parents:
diff changeset
75 __attribute__((vec_type_hint(int)))
anatofuz
parents:
diff changeset
76 __global__ void vec_type_hint_int() {}
anatofuz
parents:
diff changeset
77
anatofuz
parents:
diff changeset
78 // expected-error@+2{{attribute 'intel_reqd_sub_group_size' can only be applied to an OpenCL kernel function}}
anatofuz
parents:
diff changeset
79 __attribute__((intel_reqd_sub_group_size(64)))
anatofuz
parents:
diff changeset
80 __global__ void intel_reqd_sub_group_size_64() {}
anatofuz
parents:
diff changeset
81
anatofuz
parents:
diff changeset
82 // expected-error@+1{{'amdgpu_flat_work_group_size' attribute requires parameter 0 to be an integer constant}}
anatofuz
parents:
diff changeset
83 __attribute__((amdgpu_flat_work_group_size("32", 64)))
anatofuz
parents:
diff changeset
84 __global__ void non_int_min_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
85 // expected-error@+1{{'amdgpu_flat_work_group_size' attribute requires parameter 1 to be an integer constant}}
anatofuz
parents:
diff changeset
86 __attribute__((amdgpu_flat_work_group_size(32, "64")))
anatofuz
parents:
diff changeset
87 __global__ void non_int_max_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
88
anatofuz
parents:
diff changeset
89 int nc_min = 32, nc_max = 64;
anatofuz
parents:
diff changeset
90 // expected-error@+1{{'amdgpu_flat_work_group_size' attribute requires parameter 0 to be an integer constant}}
anatofuz
parents:
diff changeset
91 __attribute__((amdgpu_flat_work_group_size(nc_min, 64)))
anatofuz
parents:
diff changeset
92 __global__ void non_cint_min_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
93 // expected-error@+1{{'amdgpu_flat_work_group_size' attribute requires parameter 1 to be an integer constant}}
anatofuz
parents:
diff changeset
94 __attribute__((amdgpu_flat_work_group_size(32, nc_max)))
anatofuz
parents:
diff changeset
95 __global__ void non_cint_max_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
96
anatofuz
parents:
diff changeset
97 const int c_min = 16, c_max = 32;
anatofuz
parents:
diff changeset
98 __attribute__((amdgpu_flat_work_group_size(c_min * 2, 64)))
anatofuz
parents:
diff changeset
99 __global__ void cint_min_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
100 __attribute__((amdgpu_flat_work_group_size(32, c_max * 2)))
anatofuz
parents:
diff changeset
101 __global__ void cint_max_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
102
anatofuz
parents:
diff changeset
103 // expected-error@+3{{'T' does not refer to a value}}
anatofuz
parents:
diff changeset
104 // expected-note@+1{{declared here}}
anatofuz
parents:
diff changeset
105 template<typename T>
anatofuz
parents:
diff changeset
106 __attribute__((amdgpu_flat_work_group_size(T, 64)))
anatofuz
parents:
diff changeset
107 __global__ void template_class_min_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
108 // expected-error@+3{{'T' does not refer to a value}}
anatofuz
parents:
diff changeset
109 // expected-note@+1{{declared here}}
anatofuz
parents:
diff changeset
110 template<typename T>
anatofuz
parents:
diff changeset
111 __attribute__((amdgpu_flat_work_group_size(32, T)))
anatofuz
parents:
diff changeset
112 __global__ void template_class_max_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
113
anatofuz
parents:
diff changeset
114 template<unsigned a, unsigned b>
anatofuz
parents:
diff changeset
115 __attribute__((amdgpu_flat_work_group_size(a, b)))
anatofuz
parents:
diff changeset
116 __global__ void template_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
117 template __global__ void template_flat_work_group_size_32_64<32, 64>();
anatofuz
parents:
diff changeset
118
anatofuz
parents:
diff changeset
119 template<unsigned a, unsigned b, unsigned c>
anatofuz
parents:
diff changeset
120 __attribute__((amdgpu_flat_work_group_size(a + b, b + c)))
anatofuz
parents:
diff changeset
121 __global__ void template_complex_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
122 template __global__ void template_complex_flat_work_group_size_32_64<16, 16, 48>();
anatofuz
parents:
diff changeset
123
anatofuz
parents:
diff changeset
124 unsigned ipow2(unsigned n) { return n == 0 ? 1 : 2 * ipow2(n - 1); }
anatofuz
parents:
diff changeset
125 constexpr unsigned ce_ipow2(unsigned n) { return n == 0 ? 1 : 2 * ce_ipow2(n - 1); }
anatofuz
parents:
diff changeset
126
anatofuz
parents:
diff changeset
127 __attribute__((amdgpu_flat_work_group_size(ce_ipow2(5), ce_ipow2(6))))
anatofuz
parents:
diff changeset
128 __global__ void cexpr_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
129 // expected-error@+1{{'amdgpu_flat_work_group_size' attribute requires parameter 0 to be an integer constant}}
anatofuz
parents:
diff changeset
130 __attribute__((amdgpu_flat_work_group_size(ipow2(5), 64)))
anatofuz
parents:
diff changeset
131 __global__ void non_cexpr_min_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
132 // expected-error@+1{{'amdgpu_flat_work_group_size' attribute requires parameter 1 to be an integer constant}}
anatofuz
parents:
diff changeset
133 __attribute__((amdgpu_flat_work_group_size(32, ipow2(6))))
anatofuz
parents:
diff changeset
134 __global__ void non_cexpr_max_flat_work_group_size_32_64() {}
anatofuz
parents:
diff changeset
135
anatofuz
parents:
diff changeset
136 // expected-error@+1{{'amdgpu_waves_per_eu' attribute requires parameter 0 to be an integer constant}}
anatofuz
parents:
diff changeset
137 __attribute__((amdgpu_waves_per_eu("2")))
anatofuz
parents:
diff changeset
138 __global__ void non_int_min_waves_per_eu_2() {}
anatofuz
parents:
diff changeset
139 // expected-error@+1{{'amdgpu_waves_per_eu' attribute requires parameter 1 to be an integer constant}}
anatofuz
parents:
diff changeset
140 __attribute__((amdgpu_waves_per_eu(2, "4")))
anatofuz
parents:
diff changeset
141 __global__ void non_int_max_waves_per_eu_2_4() {}
anatofuz
parents:
diff changeset
142
anatofuz
parents:
diff changeset
143 // expected-error@+1{{'amdgpu_waves_per_eu' attribute requires parameter 0 to be an integer constant}}
anatofuz
parents:
diff changeset
144 __attribute__((amdgpu_waves_per_eu(nc_min)))
anatofuz
parents:
diff changeset
145 __global__ void non_cint_min_waves_per_eu_2() {}
anatofuz
parents:
diff changeset
146 // expected-error@+1{{'amdgpu_waves_per_eu' attribute requires parameter 1 to be an integer constant}}
anatofuz
parents:
diff changeset
147 __attribute__((amdgpu_waves_per_eu(2, nc_max)))
anatofuz
parents:
diff changeset
148 __global__ void non_cint_min_waves_per_eu_2_4() {}
anatofuz
parents:
diff changeset
149
anatofuz
parents:
diff changeset
150 __attribute__((amdgpu_waves_per_eu(c_min / 8)))
anatofuz
parents:
diff changeset
151 __global__ void cint_min_waves_per_eu_2() {}
anatofuz
parents:
diff changeset
152 __attribute__((amdgpu_waves_per_eu(c_min / 8, c_max / 8)))
anatofuz
parents:
diff changeset
153 __global__ void cint_min_waves_per_eu_2_4() {}
anatofuz
parents:
diff changeset
154
anatofuz
parents:
diff changeset
155 // expected-error@+3{{'T' does not refer to a value}}
anatofuz
parents:
diff changeset
156 // expected-note@+1{{declared here}}
anatofuz
parents:
diff changeset
157 template<typename T>
anatofuz
parents:
diff changeset
158 __attribute__((amdgpu_waves_per_eu(T)))
anatofuz
parents:
diff changeset
159 __global__ void cint_min_waves_per_eu_2() {}
anatofuz
parents:
diff changeset
160 // expected-error@+3{{'T' does not refer to a value}}
anatofuz
parents:
diff changeset
161 // expected-note@+1{{declared here}}
anatofuz
parents:
diff changeset
162 template<typename T>
anatofuz
parents:
diff changeset
163 __attribute__((amdgpu_waves_per_eu(2, T)))
anatofuz
parents:
diff changeset
164 __global__ void cint_min_waves_per_eu_2_4() {}
anatofuz
parents:
diff changeset
165
anatofuz
parents:
diff changeset
166 template<unsigned a>
anatofuz
parents:
diff changeset
167 __attribute__((amdgpu_waves_per_eu(a)))
anatofuz
parents:
diff changeset
168 __global__ void template_waves_per_eu_2() {}
anatofuz
parents:
diff changeset
169 template __global__ void template_waves_per_eu_2<2>();
anatofuz
parents:
diff changeset
170
anatofuz
parents:
diff changeset
171 template<unsigned a, unsigned b>
anatofuz
parents:
diff changeset
172 __attribute__((amdgpu_waves_per_eu(a, b)))
anatofuz
parents:
diff changeset
173 __global__ void template_waves_per_eu_2_4() {}
anatofuz
parents:
diff changeset
174 template __global__ void template_waves_per_eu_2_4<2, 4>();
anatofuz
parents:
diff changeset
175
anatofuz
parents:
diff changeset
176 template<unsigned a, unsigned b, unsigned c>
anatofuz
parents:
diff changeset
177 __attribute__((amdgpu_waves_per_eu(a + b, c - b)))
anatofuz
parents:
diff changeset
178 __global__ void template_complex_waves_per_eu_2_4() {}
anatofuz
parents:
diff changeset
179 template __global__ void template_complex_waves_per_eu_2_4<1, 1, 5>();
anatofuz
parents:
diff changeset
180
anatofuz
parents:
diff changeset
181 // expected-error@+2{{expression contains unexpanded parameter pack 'Args'}}
anatofuz
parents:
diff changeset
182 template<unsigned... Args>
anatofuz
parents:
diff changeset
183 __attribute__((amdgpu_waves_per_eu(Args)))
anatofuz
parents:
diff changeset
184 __global__ void template_waves_per_eu_2() {}
anatofuz
parents:
diff changeset
185 template __global__ void template_waves_per_eu_2<2, 4>();
anatofuz
parents:
diff changeset
186
anatofuz
parents:
diff changeset
187 __attribute__((amdgpu_waves_per_eu(ce_ipow2(1))))
anatofuz
parents:
diff changeset
188 __global__ void cexpr_waves_per_eu_2() {}
anatofuz
parents:
diff changeset
189 __attribute__((amdgpu_waves_per_eu(ce_ipow2(1), ce_ipow2(2))))
anatofuz
parents:
diff changeset
190 __global__ void cexpr_waves_per_eu_2_4() {}
anatofuz
parents:
diff changeset
191 // expected-error@+1{{'amdgpu_waves_per_eu' attribute requires parameter 0 to be an integer constant}}
anatofuz
parents:
diff changeset
192 __attribute__((amdgpu_waves_per_eu(ipow2(1))))
anatofuz
parents:
diff changeset
193 __global__ void non_cexpr_waves_per_eu_2() {}
anatofuz
parents:
diff changeset
194 // expected-error@+1{{'amdgpu_waves_per_eu' attribute requires parameter 1 to be an integer constant}}
anatofuz
parents:
diff changeset
195 __attribute__((amdgpu_waves_per_eu(2, ipow2(2))))
anatofuz
parents:
diff changeset
196 __global__ void non_cexpr_waves_per_eu_2_4() {}