Debian Codegraph @

clang/test/CodeGenCUDA/cluster_dims.cu

raw
1 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx1250 -fcuda-is-device -emit-llvm -x hip -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -aux-triple amdgcn-amd-amdhsa -emit-llvm -x hip -o - %s | FileCheck --check-prefix=HOST %s
3
4 #include "Inputs/cuda.h"
5
6 const int constint = 4;
7
8 // HOST-NOT: "amdgpu-cluster-dims"
9
10 // CHECK: "amdgpu-cluster-dims"="2,2,2"
11 __global__ void __cluster_dims__(2, 2, 2) test_literal_3d() {}
12
13 // CHECK: "amdgpu-cluster-dims"="2,2,1"
14 __global__ void __cluster_dims__(2, 2) test_literal_2d() {}
15
16 // CHECK: "amdgpu-cluster-dims"="4,1,1"
17 __global__ void __cluster_dims__(4) test_literal_1d() {}
18
19 // CHECK: "amdgpu-cluster-dims"="4,2,1"
20 __global__ void __cluster_dims__(constint, constint / 2, 1) test_constant() {}
21
22 // CHECK: "amdgpu-cluster-dims"="0,0,0"
23 __global__ void __no_cluster__ test_no_cluster() {}
24
25 // CHECK: "amdgpu-cluster-dims"="7,1,1"
26 template<unsigned a>
27 __global__ void __cluster_dims__(a) test_template_1d() {}
28 template __global__ void test_template_1d<7>();
29
30 // CHECK: "amdgpu-cluster-dims"="2,6,1"
31 template<unsigned a, unsigned b>
32 __global__ void __cluster_dims__(a, b) test_template_2d() {}
33 template __global__ void test_template_2d<2, 6>();
34
35 // CHECK: "amdgpu-cluster-dims"="1,2,3"
36 template<unsigned a, unsigned b, unsigned c>
37 __global__ void __cluster_dims__(a, b, c) test_template_3d() {}
38 template __global__ void test_template_3d<1, 2, 3>();