[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGenCUDA / amdgpu-kernel-attrs.cu
bloba1642421af2c8c096cbeb15354d3d46bf42bc859
1 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa \
2 // RUN:     -fcuda-is-device -emit-llvm -o - -x hip %s \
3 // RUN:     | FileCheck -check-prefixes=CHECK,DEFAULT %s
4 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa --gpu-max-threads-per-block=1024 \
5 // RUN:     -fcuda-is-device -emit-llvm -o - -x hip %s \
6 // RUN:     | FileCheck -check-prefixes=CHECK,MAX1024 %s
7 // RUN: %clang_cc1 -triple nvptx \
8 // RUN:     -fcuda-is-device -emit-llvm -o - %s | FileCheck %s \
9 // RUN:     -check-prefix=NAMD
10 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm \
11 // RUN:     -verify -o - -x hip %s | FileCheck -check-prefix=NAMD %s
13 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -foffload-uniform-block \
14 // RUN:     -fcuda-is-device -emit-llvm -o - -x hip %s \
15 // RUN:     | FileCheck -check-prefixes=CHECK,DEFAULT %s
16 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fno-offload-uniform-block \
17 // RUN:     -fcuda-is-device -emit-llvm -o - -x hip %s \
18 // RUN:     | FileCheck -check-prefixes=NOUB %s
20 #include "Inputs/cuda.h"
22 __global__ void flat_work_group_size_default() {
23 // CHECK: define{{.*}} amdgpu_kernel void @_Z28flat_work_group_size_defaultv() [[FLAT_WORK_GROUP_SIZE_DEFAULT:#[0-9]+]]
24 // NOUB: define{{.*}} void @_Z28flat_work_group_size_defaultv() [[NOUB:#[0-9]+]]
27 __attribute__((amdgpu_flat_work_group_size(32, 64))) // expected-no-diagnostics
28 __global__ void flat_work_group_size_32_64() {
29 // CHECK: define{{.*}} amdgpu_kernel void @_Z26flat_work_group_size_32_64v() [[FLAT_WORK_GROUP_SIZE_32_64:#[0-9]+]]
31 __attribute__((amdgpu_waves_per_eu(2))) // expected-no-diagnostics
32 __global__ void waves_per_eu_2() {
33 // CHECK: define{{.*}} amdgpu_kernel void @_Z14waves_per_eu_2v() [[WAVES_PER_EU_2:#[0-9]+]]
35 __attribute__((amdgpu_num_sgpr(32))) // expected-no-diagnostics
36 __global__ void num_sgpr_32() {
37 // CHECK: define{{.*}} amdgpu_kernel void @_Z11num_sgpr_32v() [[NUM_SGPR_32:#[0-9]+]]
39 __attribute__((amdgpu_num_vgpr(64))) // expected-no-diagnostics
40 __global__ void num_vgpr_64() {
41 // CHECK: define{{.*}} amdgpu_kernel void @_Z11num_vgpr_64v() [[NUM_VGPR_64:#[0-9]+]]
44 // Make sure this is silently accepted on other targets.
45 // NAMD-NOT: "amdgpu-flat-work-group-size"
46 // NAMD-NOT: "amdgpu-waves-per-eu"
47 // NAMD-NOT: "amdgpu-num-vgpr"
48 // NAMD-NOT: "amdgpu-num-sgpr"
50 // DEFAULT-DAG: attributes [[FLAT_WORK_GROUP_SIZE_DEFAULT]] = {{.*}}"amdgpu-flat-work-group-size"="1,1024"{{.*}}"uniform-work-group-size"="true"
51 // MAX1024-DAG: attributes [[FLAT_WORK_GROUP_SIZE_DEFAULT]] = {{.*}}"amdgpu-flat-work-group-size"="1,1024"
52 // CHECK-DAG: attributes [[FLAT_WORK_GROUP_SIZE_32_64]] = {{.*}}"amdgpu-flat-work-group-size"="32,64"
53 // CHECK-DAG: attributes [[WAVES_PER_EU_2]] = {{.*}}"amdgpu-waves-per-eu"="2"
54 // CHECK-DAG: attributes [[NUM_SGPR_32]] = {{.*}}"amdgpu-num-sgpr"="32"
55 // CHECK-DAG: attributes [[NUM_VGPR_64]] = {{.*}}"amdgpu-num-vgpr"="64"
57 // NOUB-NOT: "uniform-work-group-size"="true"