xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCUDA/launch-bounds.cu (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 // RUN: %clang_cc1 %s -triple nvptx-unknown-unknown -fcuda-is-device -emit-llvm -o - | FileCheck %s
2 
3 #include "Inputs/cuda.h"
4 
5 #define MAX_THREADS_PER_BLOCK 256
6 #define MIN_BLOCKS_PER_MP     2
7 
8 // Test both max threads per block and Min cta per sm.
9 extern "C" {
10 __global__ void
__launch_bounds__(MAX_THREADS_PER_BLOCK,MIN_BLOCKS_PER_MP)11 __launch_bounds__( MAX_THREADS_PER_BLOCK, MIN_BLOCKS_PER_MP )
12 Kernel1()
13 {
14 }
15 }
16 
17 // CHECK: !{{[0-9]+}} = !{void ()* @Kernel1, !"maxntidx", i32 256}
18 // CHECK: !{{[0-9]+}} = !{void ()* @Kernel1, !"minctasm", i32 2}
19 
20 // Test only max threads per block. Min cta per sm defaults to 0, and
21 // CodeGen doesn't output a zero value for minctasm.
22 extern "C" {
23 __global__ void
__launch_bounds__(MAX_THREADS_PER_BLOCK)24 __launch_bounds__( MAX_THREADS_PER_BLOCK )
25 Kernel2()
26 {
27 }
28 }
29 
30 // CHECK: !{{[0-9]+}} = !{void ()* @Kernel2, !"maxntidx", i32 256}
31