Debian Codegraph @

clang/test/CodeGenCUDA/grid-constant.cu

raw
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --version 5
2 // RUN: %clang_cc1 "-triple" "nvptx64-nvidia-cuda" -emit-llvm -fcuda-is-device -o - %s | FileCheck %s
3
4 #include "Inputs/cuda.h"
5
6 struct S {};
7
8 __global__ void kernel(__grid_constant__ const S gc_arg1, int arg2, __grid_constant__ const int gc_arg3) {}
9
10 // dependent arguments get diagnosed after instantiation.
11 template <typename T>
12 __global__ void tkernel_const(__grid_constant__ const T arg) {}
13
14 template <typename T>
15 __global__ void tkernel(int dummy, __grid_constant__ T arg) {}
16
17 void foo() {
18 tkernel_const<const S><<<1,1>>>({});
19 tkernel_const<S><<<1,1>>>({});
20 tkernel<const S><<<1,1>>>(1, {});
21 }
22
23 // CHECK: define dso_local ptx_kernel void @_Z6kernel1Sii(ptr noundef byval(%struct.S) align 1 "nvvm.grid_constant" %gc_arg1, i32 noundef %arg2, i32 noundef "nvvm.grid_constant" %gc_arg3)
24 // CHECK: define ptx_kernel void @_Z13tkernel_constIK1SEvT_(ptr noundef byval(%struct.S) align 1 "nvvm.grid_constant" %arg)
25 // CHECK: define ptx_kernel void @_Z13tkernel_constI1SEvT_(ptr noundef byval(%struct.S) align 1 "nvvm.grid_constant" %arg)
26 // CHECK: define ptx_kernel void @_Z7tkernelIK1SEviT_(i32 noundef %dummy, ptr noundef byval(%struct.S) align 1 "nvvm.grid_constant" %arg)
27