44// CHECK: #ifdef DPCT_COMPATIBILITY_TEMP
55// CHECK-NEXT: void hello(const sycl::stream &[[STREAM:stream_ct1]]) { [[STREAM]] << "foo"; }
66#ifdef __CUDA_ARCH__
7- __global__ void hello () { printf (" foo" ); }
7+ __device__ void hello () { printf (" foo" ); }
88#else
9- __global__ void hello () { printf (" other" ); }
9+ __device__ void hello () { printf (" other" ); }
1010#endif
1111
1212// CHECK: #ifndef DPCT_COMPATIBILITY_TEMP
1313#ifndef __NVCC__
14- __global__ void hello2 () { printf (" hello2" ); }
14+ __device__ void hello2 () { printf (" hello2" ); }
1515#endif
1616// CHECK: #if defined(SYCL_LANGUAGE_VERSION)
1717#if defined(__CUDACC__)
18- __global__ void hello3 () { printf (" hello2" ); }
18+ __device__ void hello3 () { printf (" hello2" ); }
1919#endif
2020
2121#if defined(xxx)
22- __global__ void hello4 () { printf (" hello2" ); }
22+ __device__ void hello4 () { printf (" hello2" ); }
2323// CHECK: #elif defined(DPCT_COMPATIBILITY_TEMP)
2424// CHECK-NEXT: void hello4(const sycl::stream &[[STREAM]]) { [[STREAM]] << "hello2"; }
2525#elif defined(__CUDA_ARCH__)
26- __global__ void hello4 () { printf (" hello2" ); }
26+ __device__ void hello4 () { printf (" hello2" ); }
2727#endif
2828
2929#if defined(xxx)
30- __global__ void hello5 () { printf (" hello2" ); }
30+ __device__ void hello5 () { printf (" hello2" ); }
3131// CHECK: #elif (DPCT_COMPATIBILITY_TEMP >= 400)
3232// CHECK-NEXT: void hello5(const sycl::stream &[[STREAM]]) { [[STREAM]] << "hello2"; }
3333#elif (__CUDA_ARCH__ >= 400)
34- __global__ void hello5 () { printf (" hello2" ); }
34+ __device__ void hello5 () { printf (" hello2" ); }
3535#endif
3636
3737// CHECK: #if defined(DPCT_COMPATIBILITY_TEMP)
3838// CHECK-NEXT: void hello6(const sycl::stream &[[STREAM]]) { [[STREAM]] << "hello2"; }
3939#if defined(__CUDA_ARCH__)
40- __global__ void hello6 () { printf (" hello2" ); }
40+ __device__ void hello6 () { printf (" hello2" ); }
4141#endif
4242
4343// CHECK: #ifndef DPCT_COMPATIBILITY_TEMP
44- // CHECK-NEXT: __global__ void hello7() { printf("hello2"); }
44+ // CHECK-NEXT: __device__ void hello7() { printf("hello2"); }
4545// CHECK-NEXT: #else
4646// CHECK-NEXT: void hello7(const sycl::stream &[[STREAM]]) { [[STREAM]] << "hello2"; }
4747#ifndef __CUDA_ARCH__
48- __global__ void hello7 () { printf (" hello2" ); }
48+ __device__ void hello7 () { printf (" hello2" ); }
4949#else
50- __global__ void hello7 () { printf (" hello2" ); }
50+ __device__ void hello7 () { printf (" hello2" ); }
5151#endif
5252
53- __global__ void test (){
53+ __global__ void hello8 () {}
54+
55+ __device__ void test (){
5456// CHECK:#if (DPCT_COMPATIBILITY_TEMP >= 400) && (DPCT_COMPATIBILITY_TEMP >= 400)
5557// CHECK-NEXT:[[STREAM]] << ">400, \n";
5658// CHECK-NEXT:#elif (DPCT_COMPATIBILITY_TEMP >200)
@@ -70,25 +72,25 @@ printf("<200, \n");
7072
7173int main () {
7274// CHECK: #if defined(DPCT_COMPATIBILITY_TEMP)
73- // CHECK-NEXT: q_ct1.submit (
75+ // CHECK-NEXT: q_ct1.parallel_for (
7476#if defined(__NVCC__)
75- hello <<<1 ,1 >>> ();
77+ hello8 <<<1 ,1 >>> ();
7678#else
7779 hello ();
7880#endif
7981
8082// CHECK: #ifdef DPCT_COMPATIBILITY_TEMP
81- // CHECK-NEXT: q_ct1.submit (
83+ // CHECK-NEXT: q_ct1.parallel_for (
8284 #ifdef __NVCC__
83- hello <<<1 ,1 >>> ();
85+ hello8 <<<1 ,1 >>> ();
8486#else
8587 hello ();
8688#endif
8789
8890// CHECK: #if DPCT_COMPATIBILITY_TEMP
89- // CHECK-NEXT: q_ct1.submit (
91+ // CHECK-NEXT: q_ct1.parallel_for (
9092 #if __NVCC__
91- hello <<<1 ,1 >>> ();
93+ hello8 <<<1 ,1 >>> ();
9294#else
9395 hello ();
9496#endif
@@ -131,6 +133,9 @@ int foo(int num) {
131133#else
132134 cudaThreadExit ();
133135#endif
136+
137+ return 0 ;
138+
134139}
135140
136141int foo1 () {
@@ -146,4 +151,6 @@ int2 a;
146151#ifndef CUDART_VERSION
147152int2 b;
148153#endif
149- }
154+ a.x = 1 ;
155+ return a.x ;
156+ }
0 commit comments