|
1 | 1 | #include "../Inputs/cuda.h" |
2 | 2 |
|
3 | | -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir \ |
4 | | -// RUN: -x hip -emit-cir %s -o %t.cir |
5 | | -// RUN: FileCheck --check-prefix=CIR-HOST --input-file=%t.cir %s |
| 3 | +// RUN: %clang_cc1 -triple=amdgcn-amd-amdhsa -x hip -fclangir \ |
| 4 | +// RUN: -emit-cir %s -o %t.cir |
| 5 | +// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s |
6 | 6 |
|
7 | | -// RUN: %clang_cc1 -triple=amdgcn-amd-amdhsa -x hip \ |
8 | | -// RUN: -fcuda-is-device -emit-cir %s -o %t.cir |
9 | | -// RUN: FileCheck --check-prefix=CIR-DEVICE --input-file=%t.cir %s |
10 | | - |
11 | | -// Attribute for global_fn |
12 | | -// CIR-HOST: [[Kernel:#[a-zA-Z_0-9]+]] = {{.*}}#cir.cuda_kernel_name<_Z9global_fnv>{{.*}} |
13 | 7 |
|
| 8 | +// This should emit as a normal C++ function. |
14 | 9 | __host__ void host_fn(int *a, int *b, int *c) {} |
15 | | -// CIR-HOST: cir.func @_Z7host_fnPiS_S_ |
16 | | -// CIR-DEVICE-NOT: cir.func @_Z7host_fnPiS_S_ |
17 | 10 |
|
18 | | -__device__ void device_fn(int *a, double b, float c) {} |
19 | | -// CIR-HOST-NOT: cir.func @_Z9device_fnPidf |
20 | | -// CIR-DEVICE: cir.func @_Z9device_fnPidf |
| 11 | +// CIR: cir.func @_Z7host_fnPiS_S_ |
21 | 12 |
|
22 | | -#ifdef __AMDGPU__ |
23 | | -__global__ void global_fn() {} |
24 | | -#else |
25 | | -__global__ void global_fn(); |
26 | | -#endif |
27 | | -// CIR-HOST: @_Z24__device_stub__global_fnv(){{.*}}extra([[Kernel]]) |
28 | | -// CIR-DEVICE: @_Z9global_fnv |
| 13 | +// This shouldn't emit. |
| 14 | +__device__ void device_fn(int* a, double b, float c) {} |
29 | 15 |
|
30 | | -// Make sure `global_fn` indeed gets emitted |
31 | | -__host__ void x() { auto v = global_fn; } |
| 16 | +// CHECK-NOT: cir.func @_Z9device_fnPidf |
0 commit comments