55// RUN: cd %T
66// RUN: rm -rf %T/macro_test_output
77// RUN: mkdir %T/macro_test_output
8- // RUN: dpct --no-dpcpp-extensions=free-function-queries - out-root %T/macro_test_output macro_test.cu --cuda-include-path="%cuda-path/include" -- -x cuda --cuda-host-only
8+ // RUN: dpct -out-root %T/macro_test_output macro_test.cu --cuda-include-path="%cuda-path/include" -- -x cuda --cuda-host-only
99// RUN: FileCheck --input-file %T/macro_test_output/macro_test.dp.cpp --match-full-lines macro_test.cu
1010// RUN: %if build_lit %{icpx -c -fsycl -DNO_BUILD_TEST %T/macro_test_output/macro_test.dp.cpp -o %T/macro_test_output/macro_test.dp.o %}
1111// RUN: FileCheck --input-file %T/macro_test_output/macro_test.h --match-full-lines macro_test.h
@@ -67,8 +67,8 @@ __global__ void foo_kernel() {}
6767// CHECK-NEXT: #ifdef MACRO_CC
6868// CHECK-NEXT: , int c
6969// CHECK-NEXT: #endif
70- // CHECK-NEXT: , const sycl::nd_item<3> &item_ct1 ) {
71- // CHECK-NEXT: int x = item_ct1 .get_group(2);
70+ // CHECK-NEXT: ) {
71+ // CHECK-NEXT: int x = sycl::ext::oneapi::this_work_item::get_nd_item<3>() .get_group(2);
7272// CHECK-NEXT: }
7373__global__ void foo_kernel2 (int a, int b
7474#ifdef MACRO_CC
@@ -288,7 +288,7 @@ int b;
288288 // CHECK-NEXT: sycl::nd_range<3>(sycl::range<3>(1, 1, 2) * sycl::range<3>(1, 1, 2),
289289 // CHECK-NEXT: sycl::range<3>(1, 1, 2)),
290290 // CHECK-NEXT: [=](sycl::nd_item<3> item_ct1) {
291- // CHECK-NEXT: foo_kernel2(3, 3, item_ct1 );
291+ // CHECK-NEXT: foo_kernel2(3, 3);
292292 // CHECK-NEXT: });
293293 foo_kernel2<<<2 , 2 , 0 >>> (3 ,3
294294 #ifdef MACRO_CC
@@ -435,13 +435,14 @@ FFF
435435
436436}
437437
438- // CHECK: #define FFFFF(aaa,bbb) void foo4(const int * __restrict__ aaa, const float * __restrict__ bbb, int *c, BBB, const sycl::nd_item<3> &item_ct1, float *sp_lj, float *sp_coul, int *ljd, double la[8][1])
438+ // CHECK: #define FFFFF(aaa,bbb) void foo4(const int * __restrict__ aaa, const float * __restrict__ bbb, int *c, BBB, float *sp_lj, float *sp_coul, int *ljd, double la[8][1])
439439#define FFFFF (aaa,bbb ) __device__ void foo4 (const int * __restrict__ aaa, const float * __restrict__ bbb, int *c, BBB)
440440
441441// CHECK: FFFFF(pos, q)
442442// CHECK-NEXT: {
443443// CHECK-EMPTY:
444- // CHECK-NEXT: const int tid = item_ct1.get_local_id(2);
444+ // CHECK-NEXT: const int tid =
445+ // CHECK-NEXT: sycl::ext::oneapi::this_work_item::get_nd_item<3>().get_local_id(2);
445446// CHECK-NEXT: }
446447FFFFF(pos, q)
447448{
@@ -452,13 +453,14 @@ FFFFF(pos, q)
452453 const int tid = threadIdx .x ;
453454}
454455
455- // CHECK: #define FFFFFF(aaa,bbb) void foo5(const int * __restrict__ aaa, const float * __restrict__ bbb, const sycl::nd_item<3> &item_ct1, float *sp_lj, float *sp_coul, int *ljd, double la[8][1])
456+ // CHECK: #define FFFFFF(aaa,bbb) void foo5(const int * __restrict__ aaa, const float * __restrict__ bbb, float *sp_lj, float *sp_coul, int *ljd, double la[8][1])
456457#define FFFFFF (aaa,bbb ) __device__ void foo5 (const int * __restrict__ aaa, const float * __restrict__ bbb)
457458
458459// CHECK: FFFFFF(pos, q)
459460// CHECK-NEXT: {
460461// CHECK-EMPTY:
461- // CHECK-NEXT: const int tid = item_ct1.get_local_id(2);
462+ // CHECK-NEXT: const int tid =
463+ // CHECK-NEXT: sycl::ext::oneapi::this_work_item::get_nd_item<3>().get_local_id(2);
462464// CHECK-NEXT: }
463465FFFFFF(pos, q)
464466{
@@ -483,9 +485,13 @@ __device__ void foo6(AAA, BBB)
483485
484486// CHECK: #define MM __umul24
485487// CHECK-NEXT: #define MUL(a, b) sycl::mul24((unsigned int)a, (unsigned int)b)
486- // CHECK-NEXT: void foo7(const sycl::nd_item<3> &item_ct1) {
487- // CHECK-NEXT: unsigned int tid = MUL(item_ct1.get_local_range(2), item_ct1.get_group(2)) +
488- // CHECK-NEXT: item_ct1.get_local_range(2);
488+ // CHECK-NEXT: void foo7() {
489+ // CHECK-NEXT: auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item<3>();
490+ // CHECK-NEXT: unsigned int tid =
491+ // CHECK-NEXT: MUL(sycl::ext::oneapi::this_work_item::get_nd_item<3>().get_local_range(
492+ // CHECK-NEXT: 2),
493+ // CHECK-NEXT: sycl::ext::oneapi::this_work_item::get_nd_item<3>().get_group(2)) +
494+ // CHECK-NEXT: item_ct1.get_local_range(2);
489495// CHECK-NEXT: unsigned int tid2 = sycl::mul24((unsigned int)item_ct1.get_local_range(2),
490496// CHECK-NEXT: (unsigned int)item_ct1.get_group_range(2));
491497// CHECK-NEXT: }
@@ -573,7 +579,7 @@ void templatefoo2(){
573579 CALL_KERNEL2 (8 , AAA)
574580}
575581
576- // CHECK: void foo11(const sycl::nd_item<3> &item_ct1 ){
582+ // CHECK: void foo11(){
577583// CHECK-NEXT: sycl::exp((double)(THREAD_IDX_X));
578584// CHECK-NEXT: }
579585__global__ void foo11 (){
@@ -915,13 +921,14 @@ void foo20() {
915921}
916922
917923// CHECK: #define CALLSHFLSYNC(x) \
918- //CHECK-NEXT: dpct::select_from_sub_group(item_ct1.get_sub_group(), x, 3 ^ 1);
924+ //CHECK-NEXT: dpct::select_from_sub_group( \
925+ //CHECK-NEXT: sycl::ext::oneapi::this_work_item::get_sub_group(), x, 3 ^ 1);
919926#define CALLSHFLSYNC (x ) __shfl_sync(0xffffffff , x, 3 ^ 1 );
920927// CHECK: #define CALLANYSYNC(x) \
921928//CHECK-NEXT: sycl::any_of_group( \
922- //CHECK-NEXT: item_ct1. get_sub_group(), \
923- //CHECK-NEXT: (0xffffffff & \
924- //CHECK-NEXT: (0x1 << item_ct1.get_sub_group(). get_local_linear_id())) && \
929+ //CHECK-NEXT: sycl::ext::oneapi::this_work_item:: get_sub_group(), \
930+ //CHECK-NEXT: (0xffffffff & (0x1 << sycl::ext::oneapi::this_work_item::get_sub_group() \
931+ //CHECK-NEXT: . get_local_linear_id())) && \
925932//CHECK-NEXT: x != 0.0f);
926933#define CALLANYSYNC (x ) __any_sync(0xffffffff , x != 0 .0f );
927934
@@ -964,7 +971,8 @@ foo23(void)
964971}
965972
966973// CHECK: #define SHFL(x, y, z) \
967- //CHECK-NEXT: dpct::select_from_sub_group(item_ct1.get_sub_group(), (x), (y), (z))
974+ //CHECK-NEXT: dpct::select_from_sub_group( \
975+ //CHECK-NEXT: sycl::ext::oneapi::this_work_item::get_sub_group(), (x), (y), (z))
968976#define SHFL (x, y, z ) __shfl ((x), (y), (z))
969977__global__ void foo24 (){
970978 int i;
0 commit comments