|
| 1 | +// RUN: %clang_cc1 %s -I %S/Inputs -fsyntax-only -fsycl -fsycl-is-device -triple spir64 -Wno-sycl-2017-compat -verify |
| 2 | +// RUN: %clang_cc1 %s -I %S/Inputs -fsyntax-only -fsycl -fsycl-is-device -triple spir64 -DTRIGGER_ERROR -Wno-sycl-2017-compat -verify |
| 3 | +// RUN: %clang_cc1 %s -I %S/Inputs -fsyntax-only -ast-dump -fsycl -fsycl-is-device -triple spir64 -Wno-sycl-2017-compat | FileCheck %s |
| 4 | + |
| 5 | +#include <sycl.hpp> |
| 6 | + |
| 7 | +#ifndef TRIGGER_ERROR |
| 8 | +//first case - good case |
| 9 | +[[intelfpga::no_global_work_offset]] // expected-no-diagnostics |
| 10 | +void |
| 11 | +func1(); |
| 12 | + |
| 13 | +[[intelfpga::max_work_group_size(4, 4, 4)]] void func1(); |
| 14 | + |
| 15 | +[[cl::reqd_work_group_size(2, 2, 2)]] void func1() {} |
| 16 | + |
| 17 | +#else |
| 18 | +//second case - expect error |
| 19 | +[[intelfpga::max_work_group_size(4, 4, 4)]] // expected-note {{conflicting attribute is here}} |
| 20 | +void |
| 21 | +func2(); |
| 22 | + |
| 23 | +[[cl::reqd_work_group_size(8, 8, 8)]] // expected-note {{conflicting attribute is here}} |
| 24 | +void |
| 25 | +func2() {} |
| 26 | + |
| 27 | +//third case - expect error |
| 28 | +[[cl::reqd_work_group_size(4, 4, 4)]] // expected-note {{conflicting attribute is here}} |
| 29 | +void |
| 30 | +func3(); |
| 31 | + |
| 32 | +[[cl::reqd_work_group_size(1, 1, 1)]] // expected-note {{conflicting attribute is here}} |
| 33 | +void |
| 34 | +// expected-warning@+1 {{attribute 'reqd_work_group_size' is already applied with different parameters}} |
| 35 | +func3() {} // expected-error {{'reqd_work_group_size' attribute conflicts with ''reqd_work_group_size'' attribute}} |
| 36 | + |
| 37 | +//fourth case - expect error |
| 38 | +[[intelfpga::max_work_group_size(4, 4, 4)]] // expected-note {{conflicting attribute is here}} |
| 39 | +void |
| 40 | +func4(); |
| 41 | + |
| 42 | +[[intelfpga::max_work_group_size(8, 8, 8)]] // expected-note {{conflicting attribute is here}} |
| 43 | +void |
| 44 | +// expected-warning@+1 {{attribute 'max_work_group_size' is already applied with different parameters}} |
| 45 | +func4() {} // expected-error {{'max_work_group_size' attribute conflicts with ''max_work_group_size'' attribute}} |
| 46 | +#endif |
| 47 | + |
| 48 | +int main() { |
| 49 | +#ifndef TRIGGER_ERROR |
| 50 | + // CHECK-LABEL: FunctionDecl {{.*}} main 'int ()' |
| 51 | + // CHECK: `-FunctionDecl {{.*}}test_kernel1 'void ()' |
| 52 | + // CHECK: -SYCLIntelMaxWorkGroupSizeAttr {{.*}} Inherited 4 4 4 |
| 53 | + // CHECK: -SYCLIntelNoGlobalWorkOffsetAttr {{.*}} Inherited Enabled |
| 54 | + // CHECK: `-ReqdWorkGroupSizeAttr {{.*}} 2 2 2 |
| 55 | + cl::sycl::kernel_single_task<class test_kernel1>( |
| 56 | + []() { func1(); }); |
| 57 | + |
| 58 | +#else |
| 59 | + cl::sycl::kernel_single_task<class test_kernel2>( |
| 60 | + []() { func2(); }); // expected-error {{conflicting attributes applied to a SYCL kernel or SYCL_EXTERNAL function}} |
| 61 | + |
| 62 | + cl::sycl::kernel_single_task<class test_kernel3>( |
| 63 | + []() { func3(); }); |
| 64 | + |
| 65 | + cl::sycl::kernel_single_task<class test_kernel4>( |
| 66 | + []() { func4(); }); |
| 67 | +#endif |
| 68 | +} |
0 commit comments