Skip to content

Commit be9635e

Browse files
committed
Add conflicting attributes case to test
1 parent 3b06d7b commit be9635e

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed
Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
1-
// RUN: %clang %s -fsyntax-only -Xclang -ast-dump -fsycl-device-only | FileCheck %s
1+
// RUN: %clang_cc1 %s -fsyntax-only -fsycl -fsycl-is-device -triple spir64 -verify
2+
// RUN: %clang_cc1 %s -fsyntax-only -fsycl -fsycl-is-device -triple spir64 -DTRIGGER_ERROR -verify
3+
// RUN: %clang_cc1 %s -fsyntax-only -ast-dump -fsycl -fsycl-is-device -triple spir64 | FileCheck %s
24

5+
#ifndef TRIGGER_ERROR
36
[[intelfpga::no_global_work_offset]] // expected-no-diagnostics
47
void
5-
func();
8+
func1();
69

7-
[[intelfpga::max_work_group_size(8, 8, 8)]] // expected-no-diagnostics
10+
[[intelfpga::max_work_group_size(4, 4, 4)]] void func1();
11+
12+
[[cl::reqd_work_group_size(2, 2, 2)]] void func1() {}
13+
14+
#else
15+
[[intelfpga::max_work_group_size(4, 4, 4)]] // expected-note {{conflicting attribute is here}}
816
void
9-
func();
17+
func2();
1018

11-
[[cl::reqd_work_group_size(4, 4, 4)]] // expected-no-diagnostics
19+
[[cl::reqd_work_group_size(8, 8, 8)]] // expected-note {{conflicting attribute is here}}
1220
void
13-
func() {}
21+
func2() {}
22+
#endif
1423

1524
template <typename Name, typename Type>
1625
[[clang::sycl_kernel]] void __my_kernel__(Type bar) {
1726
bar();
18-
func();
27+
#ifndef TRIGGER_ERROR
28+
func1();
29+
#else
30+
func2();
31+
#endif
1932
}
2033

2134
template <typename Name, typename Type>
@@ -24,10 +37,14 @@ void parallel_for(Type func) {
2437
}
2538

2639
void invoke_foo2() {
40+
#ifndef TRIGGER_ERROR
2741
// CHECK-LABEL: FunctionDecl {{.*}} invoke_foo2 'void ()'
2842
// CHECK: `-FunctionDecl {{.*}} _ZTSZ11invoke_foo2vE10KernelName 'void ()'
29-
// CHECK: -SYCLIntelMaxWorkGroupSizeAttr {{.*}} Inherited 8 8 8
43+
// CHECK: -SYCLIntelMaxWorkGroupSizeAttr {{.*}} Inherited 4 4 4
3044
// CHECK: -SYCLIntelNoGlobalWorkOffsetAttr {{.*}} Inherited Enabled
31-
// CHECK: `-ReqdWorkGroupSizeAttr {{.*}} 4 4 4
45+
// CHECK: `-ReqdWorkGroupSizeAttr {{.*}} 2 2 2
3246
parallel_for<class KernelName>([]() {});
47+
#else
48+
parallel_for<class KernelName>([]() {}); // expected-error {{conflicting attributes applied to a SYCL kernel or SYCL_EXTERNAL function}}
49+
#endif
3350
}

0 commit comments

Comments
 (0)