1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -pass-remarks-output=%t -pass-remarks-analysis=kernel-resource-usage -filetype=null %s 2>&1 | FileCheck -check-prefix=STDERR %s
2 ; RUN: FileCheck -check-prefix=REMARK %s < %t
4 ; STDERR: remark: foo.cl:27:0: Function Name: test_kernel
5 ; STDERR-NEXT: remark: foo.cl:27:0: SGPRs: 28
6 ; STDERR-NEXT: remark: foo.cl:27:0: VGPRs: 9
7 ; STDERR-NEXT: remark: foo.cl:27:0: AGPRs: 43
8 ; STDERR-NEXT: remark: foo.cl:27:0: ScratchSize [bytes/lane]: 0
9 ; STDERR-NEXT: remark: foo.cl:27:0: Dynamic Stack: False
10 ; STDERR-NEXT: remark: foo.cl:27:0: Occupancy [waves/SIMD]: 5
11 ; STDERR-NEXT: remark: foo.cl:27:0: SGPRs Spill: 0
12 ; STDERR-NEXT: remark: foo.cl:27:0: VGPRs Spill: 0
13 ; STDERR-NEXT: remark: foo.cl:27:0: LDS Size [bytes/block]: 512
15 ; REMARK-LABEL: --- !Analysis
16 ; REMARK: Pass: kernel-resource-usage
17 ; REMARK-NEXT: Name: FunctionName
18 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
19 ; REMARK-NEXT: Function: test_kernel
21 ; REMARK-NEXT: - String: 'Function Name: '
22 ; REMARK-NEXT: - FunctionName: test_kernel
24 ; REMARK-NEXT: --- !Analysis
25 ; REMARK-NEXT: Pass: kernel-resource-usage
26 ; REMARK-NEXT: Name: NumSGPR
27 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
28 ; REMARK-NEXT: Function: test_kernel
30 ; REMARK-NEXT: - String: ' SGPRs: '
31 ; REMARK-NEXT: - NumSGPR: '28'
33 ; REMARK-NEXT: --- !Analysis
34 ; REMARK-NEXT: Pass: kernel-resource-usage
35 ; REMARK-NEXT: Name: NumVGPR
36 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
37 ; REMARK-NEXT: Function: test_kernel
39 ; REMARK-NEXT: - String: ' VGPRs: '
40 ; REMARK-NEXT: - NumVGPR: '9'
42 ; REMARK-NEXT: --- !Analysis
43 ; REMARK-NEXT: Pass: kernel-resource-usage
44 ; REMARK-NEXT: Name: NumAGPR
45 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
46 ; REMARK-NEXT: Function: test_kernel
48 ; REMARK-NEXT: - String: ' AGPRs: '
49 ; REMARK-NEXT: - NumAGPR: '43'
51 ; REMARK-NEXT: --- !Analysis
52 ; REMARK-NEXT: Pass: kernel-resource-usage
53 ; REMARK-NEXT: Name: ScratchSize
54 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
55 ; REMARK-NEXT: Function: test_kernel
57 ; REMARK-NEXT: - String: ' ScratchSize [bytes/lane]: '
58 ; REMARK-NEXT: - ScratchSize: '0'
60 ; REMARK-NEXT: --- !Analysis
61 ; REMARK-NEXT: Pass: kernel-resource-usage
62 ; REMARK-NEXT: Name: DynamicStack
63 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
64 ; REMARK-NEXT: Function: test_kernel
66 ; REMARK-NEXT: - String: ' Dynamic Stack:
67 ; REMARK-NEXT: - DynamicStack: 'False'
69 ; REMARK-NEXT: --- !Analysis
70 ; REMARK-NEXT: Pass: kernel-resource-usage
71 ; REMARK-NEXT: Name: Occupancy
72 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
73 ; REMARK-NEXT: Function: test_kernel
75 ; REMARK-NEXT: - String: ' Occupancy [waves/SIMD]: '
76 ; REMARK-NEXT: - Occupancy: '5'
78 ; REMARK-NEXT: --- !Analysis
79 ; REMARK-NEXT: Pass: kernel-resource-usage
80 ; REMARK-NEXT: Name: SGPRSpill
81 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
82 ; REMARK-NEXT: Function: test_kernel
84 ; REMARK-NEXT: - String: ' SGPRs Spill: '
85 ; REMARK-NEXT: - SGPRSpill: '0'
87 ; REMARK-NEXT: --- !Analysis
88 ; REMARK-NEXT: Pass: kernel-resource-usage
89 ; REMARK-NEXT: Name: VGPRSpill
90 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
91 ; REMARK-NEXT: Function: test_kernel
93 ; REMARK-NEXT: - String: ' VGPRs Spill: '
94 ; REMARK-NEXT: - VGPRSpill: '0'
96 ; REMARK-NEXT: --- !Analysis
97 ; REMARK-NEXT: Pass: kernel-resource-usage
98 ; REMARK-NEXT: Name: BytesLDS
99 ; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }
100 ; REMARK-NEXT: Function: test_kernel
102 ; REMARK-NEXT: - String: ' LDS Size [bytes/block]: '
103 ; REMARK-NEXT: - BytesLDS: '512'
106 @lds = internal unnamed_addr addrspace(3) global [128 x i32] undef, align 4
108 define amdgpu_kernel void @test_kernel() !dbg !3 {
109 call void asm sideeffect "; clobber v8", "~{v8}"()
110 call void asm sideeffect "; clobber s23", "~{s23}"()
111 call void asm sideeffect "; clobber a42", "~{a42}"()
112 call void asm sideeffect "; use $0", "v"(ptr addrspace(3) @lds)
116 ; STDERR: remark: foo.cl:42:0: Function Name: test_func
117 ; STDERR-NEXT: remark: foo.cl:42:0: SGPRs: 0
118 ; STDERR-NEXT: remark: foo.cl:42:0: VGPRs: 0
119 ; STDERR-NEXT: remark: foo.cl:42:0: AGPRs: 0
120 ; STDERR-NEXT: remark: foo.cl:42:0: ScratchSize [bytes/lane]: 0
121 ; STDERR-NEXT: remark: foo.cl:42:0: Dynamic Stack: False
122 ; STDERR-NEXT: remark: foo.cl:42:0: Occupancy [waves/SIMD]: 0
123 ; STDERR-NEXT: remark: foo.cl:42:0: SGPRs Spill: 0
124 ; STDERR-NEXT: remark: foo.cl:42:0: VGPRs Spill: 0
125 ; STDERR-NOT: LDS Size
126 define void @test_func() !dbg !6 {
127 call void asm sideeffect "; clobber v17", "~{v17}"()
128 call void asm sideeffect "; clobber s11", "~{s11}"()
129 call void asm sideeffect "; clobber a9", "~{a9}"()
133 ; STDERR: remark: foo.cl:8:0: Function Name: empty_kernel
134 ; STDERR-NEXT: remark: foo.cl:8:0: SGPRs: 4
135 ; STDERR-NEXT: remark: foo.cl:8:0: VGPRs: 0
136 ; STDERR-NEXT: remark: foo.cl:8:0: AGPRs: 0
137 ; STDERR-NEXT: remark: foo.cl:8:0: ScratchSize [bytes/lane]: 0
138 ; STDERR-NEXT: remark: foo.cl:8:0: Dynamic Stack: False
139 ; STDERR-NEXT: remark: foo.cl:8:0: Occupancy [waves/SIMD]: 8
140 ; STDERR-NEXT: remark: foo.cl:8:0: SGPRs Spill: 0
141 ; STDERR-NEXT: remark: foo.cl:8:0: VGPRs Spill: 0
142 ; STDERR-NEXT: remark: foo.cl:8:0: LDS Size [bytes/block]: 0
143 define amdgpu_kernel void @empty_kernel() !dbg !7 {
147 ; STDERR: remark: foo.cl:52:0: Function Name: empty_func
148 ; STDERR-NEXT: remark: foo.cl:52:0: SGPRs: 0
149 ; STDERR-NEXT: remark: foo.cl:52:0: VGPRs: 0
150 ; STDERR-NEXT: remark: foo.cl:52:0: AGPRs: 0
151 ; STDERR-NEXT: remark: foo.cl:52:0: ScratchSize [bytes/lane]: 0
152 ; STDERR-NEXT: remark: foo.cl:52:0: Dynamic Stack: False
153 ; STDERR-NEXT: remark: foo.cl:52:0: Occupancy [waves/SIMD]: 0
154 ; STDERR-NEXT: remark: foo.cl:52:0: SGPRs Spill: 0
155 ; STDERR-NEXT: remark: foo.cl:52:0: VGPRs Spill: 0
156 define void @empty_func() !dbg !8 {
160 ; STDERR: remark: foo.cl:64:0: Function Name: test_indirect_call
161 ; STDERR-NEXT: remark: foo.cl:64:0: SGPRs: 39
162 ; STDERR-NEXT: remark: foo.cl:64:0: VGPRs: 32
163 ; STDERR-NEXT: remark: foo.cl:64:0: AGPRs: 10
164 ; STDERR-NEXT: remark: foo.cl:64:0: ScratchSize [bytes/lane]: 0
165 ; STDERR-NEXT: remark: foo.cl:64:0: Dynamic Stack: True
166 ; STDERR-NEXT: remark: foo.cl:64:0: Occupancy [waves/SIMD]: 8
167 ; STDERR-NEXT: remark: foo.cl:64:0: SGPRs Spill: 0
168 ; STDERR-NEXT: remark: foo.cl:64:0: VGPRs Spill: 0
169 ; STDERR-NEXT: remark: foo.cl:64:0: LDS Size [bytes/block]: 0
170 @gv.fptr0 = external hidden unnamed_addr addrspace(4) constant ptr, align 4
172 define amdgpu_kernel void @test_indirect_call() !dbg !9 {
173 %fptr = load ptr, ptr addrspace(4) @gv.fptr0
178 ; STDERR: remark: foo.cl:74:0: Function Name: test_indirect_w_static_stack
179 ; STDERR-NEXT: remark: foo.cl:74:0: SGPRs: 39
180 ; STDERR-NEXT: remark: foo.cl:74:0: VGPRs: 32
181 ; STDERR-NEXT: remark: foo.cl:74:0: AGPRs: 10
182 ; STDERR-NEXT: remark: foo.cl:74:0: ScratchSize [bytes/lane]: 144
183 ; STDERR-NEXT: remark: foo.cl:74:0: Dynamic Stack: True
184 ; STDERR-NEXT: remark: foo.cl:74:0: Occupancy [waves/SIMD]: 8
185 ; STDERR-NEXT: remark: foo.cl:74:0: SGPRs Spill: 0
186 ; STDERR-NEXT: remark: foo.cl:74:0: VGPRs Spill: 0
187 ; STDERR-NEXT: remark: foo.cl:74:0: LDS Size [bytes/block]: 0
189 declare void @llvm.memset.p5.i64(ptr addrspace(5) nocapture readonly, i8, i64, i1 immarg)
191 define amdgpu_kernel void @test_indirect_w_static_stack() !dbg !10 {
192 %alloca = alloca <10 x i64>, align 16, addrspace(5)
193 call void @llvm.memset.p5.i64(ptr addrspace(5) %alloca, i8 0, i64 40, i1 false)
194 %fptr = load ptr, ptr addrspace(4) @gv.fptr0
200 !llvm.module.flags = !{!2}
201 !llvm.module.flags = !{!11}
203 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
204 !1 = !DIFile(filename: "foo.cl", directory: "/tmp")
205 !2 = !{i32 2, !"Debug Info Version", i32 3}
206 !3 = distinct !DISubprogram(name: "test_kernel", scope: !1, file: !1, type: !4, scopeLine: 27, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
207 !4 = !DISubroutineType(types: !5)
209 !6 = distinct !DISubprogram(name: "test_func", scope: !1, file: !1, type: !4, scopeLine: 42, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
210 !7 = distinct !DISubprogram(name: "empty_kernel", scope: !1, file: !1, type: !4, scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
211 !8 = distinct !DISubprogram(name: "empty_func", scope: !1, file: !1, type: !4, scopeLine: 52, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
212 !9 = distinct !DISubprogram(name: "test_indirect_call", scope: !1, file: !1, type: !4, scopeLine: 64, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
213 !10 = distinct !DISubprogram(name: "test_indirect_w_static_stack", scope: !1, file: !1, type: !4, scopeLine: 74, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
214 !11 = !{i32 1, !"amdgpu_code_object_version", i32 500}