| 1 |
// RUN: %clang_cc1 -triple spirv64 -aux-triple x86_64-unknown-linux-gnu \ |
| 2 |
// RUN: -fcuda-is-device -verify -fsyntax-only %s |
| 3 |
|
| 4 |
#define __global__ __attribute__((global)) |
| 5 |
|
| 6 |
__attribute__((reqd_work_group_size(0x100000000, 1, 1))) // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}} |
| 7 |
__global__ void TestTooBigArg1(void); |
| 8 |
|
| 9 |
__attribute__((work_group_size_hint(0x100000000, 1, 1))) // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}} |
| 10 |
__global__ void TestTooBigArg2(void); |
| 11 |
|
| 12 |
template <int... Args> |
| 13 |
__attribute__((reqd_work_group_size(Args))) // expected-error {{expression contains unexpanded parameter pack 'Args'}} |
| 14 |
__global__ void TestTemplateVariadicArgs1(void) {} |
| 15 |
|
| 16 |
template <int... Args> |
| 17 |
__attribute__((work_group_size_hint(Args))) // expected-error {{expression contains unexpanded parameter pack 'Args'}} |
| 18 |
__global__ void TestTemplateVariadicArgs2(void) {} |
| 19 |
|
| 20 |
template <class a> // expected-note {{declared here}} |
| 21 |
__attribute__((reqd_work_group_size(a, 1, 1))) // expected-error {{'a' does not refer to a value}} |
| 22 |
__global__ void TestTemplateArgClass1(void) {} |
| 23 |
|
| 24 |
template <class a> // expected-note {{declared here}} |
| 25 |
__attribute__((work_group_size_hint(a, 1, 1))) // expected-error {{'a' does not refer to a value}} |
| 26 |
__global__ void TestTemplateArgClass2(void) {} |
| 27 |
|
| 28 |
constexpr int A = 512; |
| 29 |
|
| 30 |
__attribute__((reqd_work_group_size(A, A, A))) |
| 31 |
__global__ void TestConstIntArg1(void) {} |
| 32 |
|
| 33 |
__attribute__((work_group_size_hint(A, A, A))) |
| 34 |
__global__ void TestConstIntArg2(void) {} |
| 35 |
|
| 36 |
int B = 512; |
| 37 |
__attribute__((reqd_work_group_size(B, 1, 1))) // expected-error {{attribute requires parameter 0 to be an integer constant}} |
| 38 |
__global__ void TestNonConstIntArg1(void) {} |
| 39 |
|
| 40 |
__attribute__((work_group_size_hint(B, 1, 1))) // expected-error {{attribute requires parameter 0 to be an integer constant}} |
| 41 |
__global__ void TestNonConstIntArg2(void) {} |
| 42 |
|
| 43 |
constexpr int C = -512; |
| 44 |
__attribute__((reqd_work_group_size(C, 1, 1))) // expected-error {{attribute requires a non-negative integral compile time constant expression}} |
| 45 |
__global__ void TestNegativeConstIntArg1(void) {} |
| 46 |
|
| 47 |
__attribute__((work_group_size_hint(C, 1, 1))) // expected-error {{attribute requires a non-negative integral compile time constant expression}} |
| 48 |
__global__ void TestNegativeConstIntArg2(void) {} |
| 49 |
|
| 50 |
|
| 51 |
__attribute__((reqd_work_group_size(A, 0, 1))) // expected-error {{attribute must be greater than 0}} |
| 52 |
__global__ void TestZeroArg1(void) {} |
| 53 |
|
| 54 |
__attribute__((work_group_size_hint(A, 0, 1))) // expected-error {{attribute must be greater than 0}} |
| 55 |
__global__ void TestZeroArg2(void) {} |
| 56 |
|
| 57 |
|
| 58 |
|