xref: /llvm-project/llvm/test/Analysis/KernelInfo/launch-bounds/amdgpu.ll (revision 18f8106f310ee702046a11f360af47947c030d2e)
1; Check info on launch bounds for AMD GPU.
2
3; REQUIRES: amdgpu-registered-target
4
5; RUN: opt -pass-remarks=kernel-info -passes=kernel-info \
6; RUN:     -disable-output %s 2>&1 | \
7; RUN:   FileCheck -match-full-lines %s
8
9target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9"
10target triple = "amdgcn-amd-amdhsa"
11
12; CHECK: remark: test.c:10:0: in artificial function 'all', omp_target_num_teams = 100
13; CHECK: remark: test.c:10:0: in artificial function 'all', omp_target_thread_limit = 101
14; CHECK: remark: test.c:10:0: in artificial function 'all', amdgpu-max-num-workgroups[0] = 200
15; CHECK: remark: test.c:10:0: in artificial function 'all', amdgpu-max-num-workgroups[1] = 201
16; CHECK: remark: test.c:10:0: in artificial function 'all', amdgpu-max-num-workgroups[2] = 202
17; CHECK: remark: test.c:10:0: in artificial function 'all', amdgpu-flat-work-group-size[0] = 210
18; CHECK: remark: test.c:10:0: in artificial function 'all', amdgpu-flat-work-group-size[1] = 211
19; CHECK: remark: test.c:10:0: in artificial function 'all', amdgpu-waves-per-eu[0] = 2
20; CHECK: remark: test.c:10:0: in artificial function 'all', amdgpu-waves-per-eu[1] = 9
21define void @all() #0 !dbg !5 {
22entry:
23  ret void
24}
25
26; CHECK-NOT: remark: test.c:11:0: in function 'none', omp_target_num_teams = {{.*}}
27; CHECK-NOT: remark: test.c:11:0: in function 'none', omp_target_thread_limit = {{.*}}
28; CHECK: remark: test.c:11:0: in function 'none', amdgpu-max-num-workgroups[0] = 4294967295
29; CHECK: remark: test.c:11:0: in function 'none', amdgpu-max-num-workgroups[1] = 4294967295
30; CHECK: remark: test.c:11:0: in function 'none', amdgpu-max-num-workgroups[2] = 4294967295
31; CHECK: remark: test.c:11:0: in function 'none', amdgpu-flat-work-group-size[0] = 1
32; CHECK: remark: test.c:11:0: in function 'none', amdgpu-flat-work-group-size[1] = 1024
33; CHECK: remark: test.c:11:0: in function 'none', amdgpu-waves-per-eu[0] = 4
34; CHECK: remark: test.c:11:0: in function 'none', amdgpu-waves-per-eu[1] = 10
35define void @none() !dbg !6 {
36entry:
37  ret void
38}
39
40; CHECK: remark: test.c:12:0: in function 'bogus', omp_target_num_teams = 987654321
41; CHECK: remark: test.c:12:0: in function 'bogus', omp_target_thread_limit = 987654321
42; CHECK: remark: test.c:12:0: in function 'bogus', amdgpu-max-num-workgroups[0] = 987654321
43; CHECK: remark: test.c:12:0: in function 'bogus', amdgpu-max-num-workgroups[1] = 987654321
44; CHECK: remark: test.c:12:0: in function 'bogus', amdgpu-max-num-workgroups[2] = 987654321
45; CHECK: remark: test.c:12:0: in function 'bogus', amdgpu-flat-work-group-size[0] = 1
46; CHECK: remark: test.c:12:0: in function 'bogus', amdgpu-flat-work-group-size[1] = 1024
47; CHECK: remark: test.c:12:0: in function 'bogus', amdgpu-waves-per-eu[0] = 4
48; CHECK: remark: test.c:12:0: in function 'bogus', amdgpu-waves-per-eu[1] = 10
49define void @bogus() #1 !dbg !7 {
50entry:
51  ret void
52}
53
54attributes #0 = {
55  "omp_target_num_teams"="100"
56  "omp_target_thread_limit"="101"
57  "amdgpu-max-num-workgroups"="200,201,202"
58  "amdgpu-flat-work-group-size"="210,211"
59  "amdgpu-waves-per-eu"="2,9"
60}
61
62; We choose values that are small enough to parse successfully but that are
63; impossibly large.  For values that are validated, we check that they are
64; overridden with realistic values.
65attributes #1 = {
66  "omp_target_num_teams"="987654321"
67  "omp_target_thread_limit"="987654321"
68  "amdgpu-max-num-workgroups"="987654321,987654321,987654321"
69  "amdgpu-flat-work-group-size"="987654321,987654321"
70  "amdgpu-waves-per-eu"="987654321,987654321"
71}
72
73!llvm.module.flags = !{!0}
74!llvm.dbg.cu = !{!1}
75
76!0 = !{i32 2, !"Debug Info Version", i32 3}
77!1 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "clang version 19.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
78!2 = !DIFile(filename: "test.c", directory: "/tmp")
79!3 = !{}
80!4 = !DISubroutineType(types: !3)
81!5 = distinct !DISubprogram(name: "all", scope: !2, file: !2, line: 10, type: !4, scopeLine: 10, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1, retainedNodes: !3)
82!6 = distinct !DISubprogram(name: "none", scope: !2, file: !2, line: 11, type: !4, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1, retainedNodes: !3)
83!7 = distinct !DISubprogram(name: "bogus", scope: !2, file: !2, line: 12, type: !4, scopeLine: 12, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1, retainedNodes: !3)
84