5
5
6
6
#include " sycl.hpp"
7
7
8
- constexpr const char AttrName1[] = " Attr1" ;
9
- constexpr const char AttrVal1[] = " Val1" ;
8
+ struct NameValuePair {
9
+ static constexpr const char *name = " Attr1" ;
10
+ static constexpr const int value = 1 ;
11
+ };
12
+
13
+ template <typename ... Pairs> struct Wrapper {
14
+ template <typename KernelName, typename KernelType>
15
+ [[__sycl_detail__::add_ir_attributes_function(Pairs::name..., Pairs::value...)]] __attribute__((sycl_kernel)) void kernel_single_task (const KernelType &kernelFunc) {
16
+ kernelFunc ();
17
+ }
18
+ };
19
+
20
+ template <typename ... Pairs> struct WrapperWithImplicit {
21
+ template <typename KernelName, typename KernelType>
22
+ [[__sycl_detail__::add_ir_attributes_function(" sycl-single-task" , Pairs::name..., 0 , Pairs::value...)]] __attribute__((sycl_kernel)) void kernel_single_task (const KernelType &kernelFunc) {
23
+ kernelFunc ();
24
+ }
25
+ };
26
+
27
+ template <typename ... Pairs> struct WrapperWithFilter {
28
+ template <typename KernelName, typename KernelType>
29
+ [[__sycl_detail__::add_ir_attributes_function({" some-filter-string" }, Pairs::name..., Pairs::value...)]] __attribute__((sycl_kernel)) void kernel_single_task (const KernelType &kernelFunc) {
30
+ kernelFunc ();
31
+ }
32
+ };
10
33
11
- template <const char * ... Strs > struct Wrapper {
34
+ template <typename ... Pairs > struct WrapperWithImplicitAndFilter {
12
35
template <typename KernelName, typename KernelType>
13
- [[__sycl_detail__::add_ir_attributes_function(Strs ...)]] __attribute__((sycl_kernel)) void kernel_single_task (const KernelType &kernelFunc) {
36
+ [[__sycl_detail__::add_ir_attributes_function({ " some-filter-string " }, " sycl-single-task " , Pairs::name..., 0 , Pairs::value ...)]] __attribute__((sycl_kernel)) void kernel_single_task (const KernelType &kernelFunc) {
14
37
kernelFunc ();
15
38
}
16
39
};
17
40
18
41
int main () {
19
42
Wrapper<> EmptyWrapper;
20
- Wrapper<AttrName1, AttrVal1> NonemptyWrapper;
43
+ Wrapper<NameValuePair> NonemptyWrapper;
44
+ WrapperWithImplicit<> EmptyWrapperWithImplicit;
45
+ WrapperWithImplicit<NameValuePair> NonemptyWrapperWithImplicit;
46
+ WrapperWithFilter<> EmptyWrapperWithFilter;
47
+ WrapperWithFilter<NameValuePair> NonemptyWrapperWithFilter;
48
+ WrapperWithImplicitAndFilter<> EmptyWrapperWithImplicitAndFilter;
49
+ WrapperWithImplicitAndFilter<NameValuePair> NonemptyWrapperWithImplicitAndFilter;
21
50
22
51
EmptyWrapper.kernel_single_task <class EK1 >([]() [[sycl::reqd_work_group_size (1 )]] {});
23
52
EmptyWrapper.kernel_single_task <class EK2 >([]() [[sycl::reqd_work_group_size (1 ,2 )]] {});
@@ -30,6 +59,39 @@ int main() {
30
59
EmptyWrapper.kernel_single_task <class EK9 >([]() [[sycl::device_has (sycl::aspect::cpu)]] {});
31
60
EmptyWrapper.kernel_single_task <class EK10 >([]() [[sycl::device_has (sycl::aspect::cpu, sycl::aspect::gpu)]] {});
32
61
62
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI1 >([]() [[sycl::reqd_work_group_size (1 )]] {});
63
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI2 >([]() [[sycl::reqd_work_group_size (1 ,2 )]] {});
64
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI3 >([]() [[sycl::reqd_work_group_size (1 ,2 ,3 )]] {});
65
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI4 >([]() [[sycl::work_group_size_hint (1 )]] {});
66
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI5 >([]() [[sycl::work_group_size_hint (1 ,2 )]] {});
67
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI6 >([]() [[sycl::work_group_size_hint (1 ,2 ,3 )]] {});
68
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI7 >([]() [[sycl::reqd_sub_group_size (1 )]] {});
69
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI8 >([]() [[sycl::device_has ()]] {});
70
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI9 >([]() [[sycl::device_has (sycl::aspect::cpu)]] {});
71
+ EmptyWrapperWithImplicit.kernel_single_task <class EKWI10 >([]() [[sycl::device_has (sycl::aspect::cpu, sycl::aspect::gpu)]] {});
72
+
73
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF1 >([]() [[sycl::reqd_work_group_size (1 )]] {});
74
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF2 >([]() [[sycl::reqd_work_group_size (1 ,2 )]] {});
75
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF3 >([]() [[sycl::reqd_work_group_size (1 ,2 ,3 )]] {});
76
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF4 >([]() [[sycl::work_group_size_hint (1 )]] {});
77
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF5 >([]() [[sycl::work_group_size_hint (1 ,2 )]] {});
78
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF6 >([]() [[sycl::work_group_size_hint (1 ,2 ,3 )]] {});
79
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF7 >([]() [[sycl::reqd_sub_group_size (1 )]] {});
80
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF8 >([]() [[sycl::device_has ()]] {});
81
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF9 >([]() [[sycl::device_has (sycl::aspect::cpu)]] {});
82
+ EmptyWrapperWithFilter.kernel_single_task <class EKWF10 >([]() [[sycl::device_has (sycl::aspect::cpu, sycl::aspect::gpu)]] {});
83
+
84
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF1 >([]() [[sycl::reqd_work_group_size (1 )]] {});
85
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF2 >([]() [[sycl::reqd_work_group_size (1 ,2 )]] {});
86
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF3 >([]() [[sycl::reqd_work_group_size (1 ,2 ,3 )]] {});
87
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF4 >([]() [[sycl::work_group_size_hint (1 )]] {});
88
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF5 >([]() [[sycl::work_group_size_hint (1 ,2 )]] {});
89
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF6 >([]() [[sycl::work_group_size_hint (1 ,2 ,3 )]] {});
90
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF7 >([]() [[sycl::reqd_sub_group_size (1 )]] {});
91
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF8 >([]() [[sycl::device_has ()]] {});
92
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF9 >([]() [[sycl::device_has (sycl::aspect::cpu)]] {});
93
+ EmptyWrapperWithImplicitAndFilter.kernel_single_task <class EKWIF10 >([]() [[sycl::device_has (sycl::aspect::cpu, sycl::aspect::gpu)]] {});
94
+
33
95
// expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
34
96
NonemptyWrapper.kernel_single_task <class NEK1 >([]() [[sycl::reqd_work_group_size (1 )]] {});
35
97
// expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
@@ -50,4 +112,67 @@ int main() {
50
112
NonemptyWrapper.kernel_single_task <class NEK9 >([]() [[sycl::device_has (sycl::aspect::cpu)]] {});
51
113
// expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
52
114
NonemptyWrapper.kernel_single_task <class NEK10 >([]() [[sycl::device_has (sycl::aspect::cpu, sycl::aspect::gpu)]] {});
115
+
116
+ // expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
117
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI1 >([]() [[sycl::reqd_work_group_size (1 )]] {});
118
+ // expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
119
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI2 >([]() [[sycl::reqd_work_group_size (1 ,2 )]] {});
120
+ // expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
121
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI3 >([]() [[sycl::reqd_work_group_size (1 ,2 ,3 )]] {});
122
+ // expected-warning@+1 {{kernel has both attribute 'work_group_size_hint' and kernel properties; conflicting properties are ignored}}
123
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI4 >([]() [[sycl::work_group_size_hint (1 )]] {});
124
+ // expected-warning@+1 {{kernel has both attribute 'work_group_size_hint' and kernel properties; conflicting properties are ignored}}
125
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI5 >([]() [[sycl::work_group_size_hint (1 ,2 )]] {});
126
+ // expected-warning@+1 {{kernel has both attribute 'work_group_size_hint' and kernel properties; conflicting properties are ignored}}
127
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI6 >([]() [[sycl::work_group_size_hint (1 ,2 ,3 )]] {});
128
+ // expected-warning@+1 {{kernel has both attribute 'reqd_sub_group_size' and kernel properties; conflicting properties are ignored}}
129
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI7 >([]() [[sycl::reqd_sub_group_size (1 )]] {});
130
+ // expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
131
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI8 >([]() [[sycl::device_has ()]] {});
132
+ // expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
133
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI9 >([]() [[sycl::device_has (sycl::aspect::cpu)]] {});
134
+ // expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
135
+ NonemptyWrapperWithImplicit.kernel_single_task <class NEKWI10 >([]() [[sycl::device_has (sycl::aspect::cpu, sycl::aspect::gpu)]] {});
136
+
137
+ // expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
138
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF1 >([]() [[sycl::reqd_work_group_size (1 )]] {});
139
+ // expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
140
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF2 >([]() [[sycl::reqd_work_group_size (1 ,2 )]] {});
141
+ // expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
142
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF3 >([]() [[sycl::reqd_work_group_size (1 ,2 ,3 )]] {});
143
+ // expected-warning@+1 {{kernel has both attribute 'work_group_size_hint' and kernel properties; conflicting properties are ignored}}
144
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF4 >([]() [[sycl::work_group_size_hint (1 )]] {});
145
+ // expected-warning@+1 {{kernel has both attribute 'work_group_size_hint' and kernel properties; conflicting properties are ignored}}
146
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF5 >([]() [[sycl::work_group_size_hint (1 ,2 )]] {});
147
+ // expected-warning@+1 {{kernel has both attribute 'work_group_size_hint' and kernel properties; conflicting properties are ignored}}
148
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF6 >([]() [[sycl::work_group_size_hint (1 ,2 ,3 )]] {});
149
+ // expected-warning@+1 {{kernel has both attribute 'reqd_sub_group_size' and kernel properties; conflicting properties are ignored}}
150
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF7 >([]() [[sycl::reqd_sub_group_size (1 )]] {});
151
+ // expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
152
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF8 >([]() [[sycl::device_has ()]] {});
153
+ // expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
154
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF9 >([]() [[sycl::device_has (sycl::aspect::cpu)]] {});
155
+ // expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
156
+ NonemptyWrapperWithFilter.kernel_single_task <class NEKWF10 >([]() [[sycl::device_has (sycl::aspect::cpu, sycl::aspect::gpu)]] {});
157
+
158
+ // expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
159
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF1 >([]() [[sycl::reqd_work_group_size (1 )]] {});
160
+ // expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
161
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF2 >([]() [[sycl::reqd_work_group_size (1 ,2 )]] {});
162
+ // expected-warning@+1 {{kernel has both attribute 'reqd_work_group_size' and kernel properties; conflicting properties are ignored}}
163
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF3 >([]() [[sycl::reqd_work_group_size (1 ,2 ,3 )]] {});
164
+ // expected-warning@+1 {{kernel has both attribute 'work_group_size_hint' and kernel properties; conflicting properties are ignored}}
165
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF4 >([]() [[sycl::work_group_size_hint (1 )]] {});
166
+ // expected-warning@+1 {{kernel has both attribute 'work_group_size_hint' and kernel properties; conflicting properties are ignored}}
167
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF5 >([]() [[sycl::work_group_size_hint (1 ,2 )]] {});
168
+ // expected-warning@+1 {{kernel has both attribute 'work_group_size_hint' and kernel properties; conflicting properties are ignored}}
169
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF6 >([]() [[sycl::work_group_size_hint (1 ,2 ,3 )]] {});
170
+ // expected-warning@+1 {{kernel has both attribute 'reqd_sub_group_size' and kernel properties; conflicting properties are ignored}}
171
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF7 >([]() [[sycl::reqd_sub_group_size (1 )]] {});
172
+ // expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
173
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF8 >([]() [[sycl::device_has ()]] {});
174
+ // expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
175
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF9 >([]() [[sycl::device_has (sycl::aspect::cpu)]] {});
176
+ // expected-warning@+1 {{kernel has both attribute 'device_has' and kernel properties; conflicting properties are ignored}}
177
+ NonemptyWrapperWithImplicitAndFilter.kernel_single_task <class NEKWIF10 >([]() [[sycl::device_has (sycl::aspect::cpu, sycl::aspect::gpu)]] {});
53
178
}
0 commit comments