|
1 |
| -// RUN: %clang_cc1 -fsycl -fsycl-is-device -Wno-return-type -fcxx-exceptions -fsyntax-only -ast-dump -verify -pedantic %s | FileCheck %s |
| 1 | +// RUN: %clang_cc1 -fsycl -fsycl-is-device -internal-isystem %S/Inputs -Wno-return-type -Wno-sycl-2017-compat -fcxx-exceptions -fsyntax-only -ast-dump -verify -pedantic %s | FileCheck %s |
| 2 | + |
| 3 | +#include "sycl.hpp" |
| 4 | + |
| 5 | +using namespace cl::sycl; |
| 6 | +queue q; |
2 | 7 |
|
3 | 8 | struct FuncObj {
|
4 | 9 | //expected-warning@+2 {{attribute 'intelfpga::no_global_work_offset' is deprecated}}
|
5 | 10 | //expected-note@+1 {{did you mean to use 'intel::no_global_work_offset' instead?}}
|
6 |
| - [[intelfpga::no_global_work_offset]] void operator()() {} |
| 11 | + [[intelfpga::no_global_work_offset]] void operator()() const {} |
7 | 12 | };
|
8 | 13 |
|
9 |
| -template <typename name, typename Func> |
10 |
| -void kernel(Func kernelFunc) { |
11 |
| - kernelFunc(); |
12 |
| -} |
13 |
| - |
14 | 14 | int main() {
|
15 |
| - // CHECK: SYCLIntelNoGlobalWorkOffsetAttr{{.*}}Enabled |
16 |
| - kernel<class test_kernel1>([]() { |
17 |
| - FuncObj(); |
18 |
| - }); |
19 |
| - |
20 |
| - // CHECK: SYCLIntelNoGlobalWorkOffsetAttr |
21 |
| - // CHECK-NOT: Enabled |
22 |
| - kernel<class test_kernel2>( |
23 |
| - []() [[intel::no_global_work_offset(0)]]{}); |
24 |
| - |
25 |
| - // CHECK: SYCLIntelNoGlobalWorkOffsetAttr{{.*}}Enabled |
26 |
| - // expected-warning@+2{{'no_global_work_offset' attribute should be 0 or 1. Adjusted to 1}} |
27 |
| - kernel<class test_kernel3>( |
28 |
| - []() [[intel::no_global_work_offset(42)]]{}); |
29 |
| - |
30 |
| - // expected-error@+2{{'no_global_work_offset' attribute requires a non-negative integral compile time constant expression}} |
31 |
| - kernel<class test_kernel4>( |
32 |
| - []() [[intel::no_global_work_offset(-1)]]{}); |
33 |
| - |
34 |
| - // expected-error@+2{{'no_global_work_offset' attribute requires parameter 0 to be an integer constant}} |
35 |
| - kernel<class test_kernel5>( |
36 |
| - []() [[intel::no_global_work_offset("foo")]]{}); |
37 |
| - |
38 |
| - kernel<class test_kernel6>([]() { |
39 |
| - // expected-error@+1{{'no_global_work_offset' attribute only applies to functions}} |
40 |
| - [[intel::no_global_work_offset(1)]] int a; |
| 15 | + q.submit([&](handler &h) { |
| 16 | + // CHECK: SYCLIntelNoGlobalWorkOffsetAttr {{.*}} |
| 17 | + // CHECK-NEXT: IntegerLiteral{{.*}}1{{$}} |
| 18 | + h.single_task<class test_kernel1>(FuncObj()); |
| 19 | + |
| 20 | + // CHECK: SYCLIntelNoGlobalWorkOffsetAttr {{.*}} |
| 21 | + // CHECK-NEXT: IntegerLiteral{{.*}}0{{$}} |
| 22 | + h.single_task<class test_kernel2>( |
| 23 | + []() [[intel::no_global_work_offset(0)]]{}); |
| 24 | + |
| 25 | + // CHECK: SYCLIntelNoGlobalWorkOffsetAttr{{.*}} |
| 26 | + // CHECK-NEXT: IntegerLiteral{{.*}}42{{$}} |
| 27 | + h.single_task<class test_kernel3>( |
| 28 | + []() [[intel::no_global_work_offset(42)]]{}); |
| 29 | + |
| 30 | + // CHECK: SYCLIntelNoGlobalWorkOffsetAttr{{.*}} |
| 31 | + // CHECK-NEXT: UnaryOperator{{.*}} 'int' prefix '-' |
| 32 | + // CHECK-NEXT-NEXT: IntegerLiteral{{.*}}1{{$}} |
| 33 | + h.single_task<class test_kernel4>( |
| 34 | + []() [[intel::no_global_work_offset(-1)]]{}); |
| 35 | + |
| 36 | + // expected-error@+2{{'no_global_work_offset' attribute requires an integer constant}} |
| 37 | + h.single_task<class test_kernel5>( |
| 38 | + []() [[intel::no_global_work_offset("foo")]]{}); |
| 39 | + |
| 40 | + h.single_task<class test_kernel6>([]() { |
| 41 | + // expected-error@+1{{'no_global_work_offset' attribute only applies to functions}} |
| 42 | + [[intel::no_global_work_offset(1)]] int a; |
| 43 | + }); |
| 44 | + |
| 45 | + // expected-warning@+2{{attribute 'no_global_work_offset' is already applied}} |
| 46 | + h.single_task<class test_kernel7>( |
| 47 | + []() [[intel::no_global_work_offset(0), intel::no_global_work_offset(1)]]{}); |
41 | 48 | });
|
42 |
| - |
43 |
| - // CHECK: SYCLIntelNoGlobalWorkOffsetAttr{{.*}} |
44 |
| - // CHECK-NOT: Enabled |
45 |
| - // CHECK: SYCLIntelNoGlobalWorkOffsetAttr{{.*}}Enabled |
46 |
| - // expected-warning@+2{{attribute 'no_global_work_offset' is already applied}} |
47 |
| - kernel<class test_kernel7>( |
48 |
| - []() [[intel::no_global_work_offset(0), intel::no_global_work_offset(1)]]{}); |
49 |
| - |
50 | 49 | return 0;
|
51 | 50 | }
|
0 commit comments