1
+ #include " ../Inputs/cuda.h"
2
+
3
+ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir \
4
+ // RUN: -x cuda -emit-cir -target-sdk-version=12.3 \
5
+ // RUN: %s -o %t.cir
6
+ // RUN: FileCheck --check-prefix=CIR-HOST --input-file=%t.cir %s
7
+
8
+ // RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fclangir \
9
+ // RUN: -fcuda-is-device -emit-cir -target-sdk-version=12.3 \
10
+ // RUN: %s -o %t.cir
11
+ // RUN: FileCheck --check-prefix=CIR-DEVICE --input-file=%t.cir %s
12
+
13
+ namespace ns {
14
+ __global__ void cpp_global_function_1 (int a, int * b, float c) {}
15
+ // CIR-HOST: cir.func @_ZN2ns36__device_stub__cpp_global_function_1EiPif
16
+ // CIR-DEVICE: cir.func @_ZN2ns21cpp_global_function_1EiPif
17
+
18
+ __global__ void cpp_global_function_2 (int a, int * b, float c) {}
19
+
20
+ // CIR-HOST: cir.func @_ZN2ns36__device_stub__cpp_global_function_2EiPif
21
+ // CIR-DEVICE: cir.func @_ZN2ns21cpp_global_function_2EiPif
22
+
23
+ __host__ void cpp_host_function_1 (int a, int * b, float c) {}
24
+
25
+ // CIR-HOST: cir.func @_ZN2ns19cpp_host_function_1EiPif
26
+
27
+ __host__ void cpp_host_function_2 (int a, int * b, float c) {}
28
+
29
+ // CIR-HOST: cir.func @_ZN2ns19cpp_host_function_2EiPif
30
+
31
+ __device__ void cpp_device_function_1 (int a, int * b, float c) {}
32
+
33
+ // CIR-DEVICE: cir.func @_ZN2ns21cpp_device_function_1EiPif
34
+
35
+ __device__ void cpp_device_function_2 (int a, int * b, float c) {}
36
+
37
+ // CIR-DEVICE: cir.func @_ZN2ns21cpp_device_function_2EiPif
38
+ }
39
+
40
+ __global__ void cpp_global_function_1 (int a, int * b, float c) {}
41
+
42
+ // CIR-HOST: cir.func @_Z36__device_stub__cpp_global_function_1iPif
43
+ // CIR-DEVICE: cir.func @_Z21cpp_global_function_1iPif
44
+
45
+ __global__ void cpp_global_function_2 (int a, int * b, float c) {}
46
+
47
+ // CIR-HOST: cir.func @_Z36__device_stub__cpp_global_function_2iPif
48
+ // CIR-DEVICE: cir.func @_Z21cpp_global_function_2iPif
49
+
50
+ __host__ void cpp_host_function_1 (int a, int * b, float c) {}
51
+
52
+ // CIR-HOST: cir.func @_Z19cpp_host_function_1iPif
53
+
54
+ __host__ void cpp_host_function_2 (int a, int * b, float c) {}
55
+
56
+ // CIR-HOST: cir.func @_Z19cpp_host_function_2iPif
57
+
58
+ __device__ void cpp_device_function_1 (int a, int * b, float c) {}
59
+
60
+ // CIR-DEVICE: cir.func @_Z21cpp_device_function_1iPif
61
+
62
+ __device__ void cpp_device_function_2 (int a, int * b, float c) {}
63
+
64
+ // CIR-DEVICE: cir.func @_Z21cpp_device_function_2iPif
65
+
66
+ extern " C" {
67
+ __global__ void c_global_function_1 (int a, int * b, float c) {}
68
+
69
+ // CIR-HOST: cir.func @__device_stub__c_global_function_1
70
+ // CIR-DEVICE: cir.func @c_global_function_1
71
+
72
+ __global__ void c_global_function_2 (int a, int * b, float c) {}
73
+
74
+ // CIR-HOST: cir.func @__device_stub__c_global_function_2
75
+ // CIR-DEVICE: cir.func @c_global_function_2
76
+
77
+ __host__ void c_host_function_1 (int a, int * b, float c) {}
78
+
79
+ // CIR-HOST: cir.func @c_host_function_1
80
+
81
+ __host__ void c_host_function_2 (int a, int * b, float c) {}
82
+
83
+ // CIR-HOST: cir.func @c_host_function_2
84
+
85
+ __device__ void c_device_function_1 (int a, int * b, float c) {}
86
+
87
+ // CIR-DEVICE: cir.func @c_device_function_1
88
+
89
+ __device__ void c_device_function_2 (int a, int * b, float c) {}
90
+
91
+ // CIR-DEVICE: cir.func @c_device_function_2
92
+ }
0 commit comments