88// XFAIL: target-native_cpu
99// XFAIL-TRACKER: https://github.com/intel/llvm/issues/20142
1010
11- // CUDA-`<<<>>>`-style bare-name launch via the SYCL_EXT_ONEAPI_KERNEL_FUNCTION macro. The existing
12- // enqueue-function API (nd_launch / single_task taking a kernel_function<Func>
13- // selector) is kept unchanged; SYCL_EXT_ONEAPI_KERNEL_FUNCTION(name, args...) expands to
11+ // CUDA-`<<<>>>`-style bare-name launch via the SYCL_EXT_ONEAPI_KERNEL_FUNCTION
12+ // macro. The existing enqueue-function API (nd_launch / single_task taking a
13+ // kernel_function<Func> selector) is kept unchanged;
14+ // SYCL_EXT_ONEAPI_KERNEL_FUNCTION(name, args...) expands to
1415// kernel_function<__builtin_sycl_launch_kernel(name, args...)>, args...
1516// so the compiler deduces the kernel's template arguments / resolves the
1617// overload from the launch arguments while the launched SPIR-V kernel remains
@@ -38,7 +39,9 @@ void store42(int *p) { *p = 42; }
3839// Templated single_task.
3940template <typename T>
4041SYCL_EXT_ONEAPI_FUNCTION_PROPERTY ((syclexp::single_task_kernel))
41- void store_one (T *p) { *p = T{1 }; }
42+ void store_one (T *p) {
43+ *p = T{1 };
44+ }
4245
4346// Non-templated nd_range.
4447SYCL_EXT_ONEAPI_FUNCTION_PROPERTY ((syclexp::nd_range_kernel<1 >))
@@ -90,12 +93,14 @@ void fill(float *p, float v, int n) {
9093 p[i] = v;
9194}
9295
93- // A SYCL_EXT_ONEAPI_KERNEL_FUNCTION launch from inside an ordinary function template, so the launch
94- // arguments are dependent and the macro's builtin call is deferred to
95- // instantiation (regression guard: this dependent-context use previously
96- // crashed the front end before the builtin call was made type-dependent).
96+ // A SYCL_EXT_ONEAPI_KERNEL_FUNCTION launch from inside an ordinary function
97+ // template, so the launch arguments are dependent and the macro's builtin call
98+ // is deferred to instantiation (regression guard: this dependent-context use
99+ // previously crashed the front end before the builtin call was made
100+ // type-dependent).
97101template <typename T>
98- void run_axpy (sycl::queue q, sycl::nd_range<1 > r, T *y, const T *x, T a, int n) {
102+ void run_axpy (sycl::queue q, sycl::nd_range<1 > r, T *y, const T *x, T a,
103+ int n) {
99104 syclexp::nd_launch (q, r, SYCL_EXT_ONEAPI_KERNEL_FUNCTION (axpy, y, x, a, n));
100105}
101106
@@ -147,8 +152,8 @@ int main() {
147152 for (int i = 0 ; i < N; ++i)
148153 assert (y[i] == a * static_cast <float >(i) + 1 .0f );
149154
150- // Zero launch arguments: SYCL_EXT_ONEAPI_KERNEL_FUNCTION(tick) must expand without a dangling
151- // comma and launch cleanly.
155+ // Zero launch arguments: SYCL_EXT_ONEAPI_KERNEL_FUNCTION(tick) must expand
156+ // without a dangling comma and launch cleanly.
152157 syclexp::single_task (q, SYCL_EXT_ONEAPI_KERNEL_FUNCTION (tick));
153158 q.wait ();
154159
@@ -158,7 +163,8 @@ int main() {
158163 // general).
159164 for (int i = 0 ; i < N; ++i)
160165 y[i] = 0 .0f ;
161- syclexp::nd_launch (q, r, SYCL_EXT_ONEAPI_KERNEL_FUNCTION ((fill_val<1 >), y, 7 .0f , N));
166+ syclexp::nd_launch (
167+ q, r, SYCL_EXT_ONEAPI_KERNEL_FUNCTION ((fill_val<1 >), y, 7 .0f , N));
162168 q.wait ();
163169 for (int i = 0 ; i < N; ++i)
164170 assert (y[i] == 7 .0f );
@@ -191,7 +197,8 @@ int main() {
191197 for (int i = 0 ; i < N; ++i)
192198 y[i] = 2 .0f ;
193199 syclexp::submit (q, [&](sycl::handler &h) {
194- syclexp::nd_launch (h, r, SYCL_EXT_ONEAPI_KERNEL_FUNCTION (scale, y, 3 .0f , N));
200+ syclexp::nd_launch (h, r,
201+ SYCL_EXT_ONEAPI_KERNEL_FUNCTION (scale, y, 3 .0f , N));
195202 });
196203 q.wait ();
197204 for (int i = 0 ; i < N; ++i)
@@ -201,7 +208,8 @@ int main() {
201208 for (int i = 0 ; i < N; ++i)
202209 y[i] = 2 .0f ;
203210 syclexp::launch_config<sycl::nd_range<1 >> cfg{r};
204- syclexp::nd_launch (q, cfg, SYCL_EXT_ONEAPI_KERNEL_FUNCTION (scale, y, 4 .0f , N));
211+ syclexp::nd_launch (q, cfg,
212+ SYCL_EXT_ONEAPI_KERNEL_FUNCTION (scale, y, 4 .0f , N));
205213 q.wait ();
206214 for (int i = 0 ; i < N; ++i)
207215 assert (y[i] == 8 .0f );
0 commit comments