198 lines · plain
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 %s2; RUN: FileCheck -check-prefix=REMARK %s < %t3 4; STDERR: remark: foo.cl:27:0: Function Name: test_kernel5; STDERR-NEXT: remark: foo.cl:27:0: TotalSGPRs: 286; STDERR-NEXT: remark: foo.cl:27:0: VGPRs: 97; STDERR-NEXT: remark: foo.cl:27:0: AGPRs: 438; STDERR-NEXT: remark: foo.cl:27:0: ScratchSize [bytes/lane]: 09; STDERR-NEXT: remark: foo.cl:27:0: Dynamic Stack: False10; STDERR-NEXT: remark: foo.cl:27:0: Occupancy [waves/SIMD]: 511; STDERR-NEXT: remark: foo.cl:27:0: SGPRs Spill: 012; STDERR-NEXT: remark: foo.cl:27:0: VGPRs Spill: 013; STDERR-NEXT: remark: foo.cl:27:0: LDS Size [bytes/block]: 51214 15; REMARK-LABEL: --- !Analysis16; REMARK: Pass: kernel-resource-usage17; REMARK-NEXT: Name: FunctionName18; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }19; REMARK-NEXT: Function: test_kernel20; REMARK-NEXT: Args:21; REMARK-NEXT: - String: 'Function Name: '22; REMARK-NEXT: - FunctionName: test_kernel23; REMARK-NEXT: ...24; REMARK-NEXT: --- !Analysis25; REMARK-NEXT: Pass: kernel-resource-usage26; REMARK-NEXT: Name: NumSGPR27; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }28; REMARK-NEXT: Function: test_kernel29; REMARK-NEXT: Args:30; REMARK-NEXT: - String: ' TotalSGPRs: '31; REMARK-NEXT: - NumSGPR: '28'32; REMARK-NEXT: ...33; REMARK-NEXT: --- !Analysis34; REMARK-NEXT: Pass: kernel-resource-usage35; REMARK-NEXT: Name: NumVGPR36; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }37; REMARK-NEXT: Function: test_kernel38; REMARK-NEXT: Args:39; REMARK-NEXT: - String: ' VGPRs: '40; REMARK-NEXT: - NumVGPR: '9'41; REMARK-NEXT: ...42; REMARK-NEXT: --- !Analysis43; REMARK-NEXT: Pass: kernel-resource-usage44; REMARK-NEXT: Name: NumAGPR45; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }46; REMARK-NEXT: Function: test_kernel47; REMARK-NEXT: Args:48; REMARK-NEXT: - String: ' AGPRs: '49; REMARK-NEXT: - NumAGPR: '43'50; REMARK-NEXT: ...51; REMARK-NEXT: --- !Analysis52; REMARK-NEXT: Pass: kernel-resource-usage53; REMARK-NEXT: Name: ScratchSize54; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }55; REMARK-NEXT: Function: test_kernel56; REMARK-NEXT: Args:57; REMARK-NEXT: - String: ' ScratchSize [bytes/lane]: '58; REMARK-NEXT: - ScratchSize: '0'59; REMARK-NEXT: ..60; REMARK-NEXT: --- !Analysis61; REMARK-NEXT: Pass: kernel-resource-usage62; REMARK-NEXT: Name: DynamicStack63; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }64; REMARK-NEXT: Function: test_kernel65; REMARK-NEXT: Args:66; REMARK-NEXT: - String: ' Dynamic Stack:67; REMARK-NEXT: - DynamicStack: 'False'68; REMARK-NEXT: ..69; REMARK-NEXT: --- !Analysis70; REMARK-NEXT: Pass: kernel-resource-usage71; REMARK-NEXT: Name: Occupancy72; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }73; REMARK-NEXT: Function: test_kernel74; REMARK-NEXT: Args:75; REMARK-NEXT: - String: ' Occupancy [waves/SIMD]: '76; REMARK-NEXT: - Occupancy: '5'77; REMARK-NEXT: ...78; REMARK-NEXT: --- !Analysis79; REMARK-NEXT: Pass: kernel-resource-usage80; REMARK-NEXT: Name: SGPRSpill81; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }82; REMARK-NEXT: Function: test_kernel83; REMARK-NEXT: Args:84; REMARK-NEXT: - String: ' SGPRs Spill: '85; REMARK-NEXT: - SGPRSpill: '0'86; REMARK-NEXT: ...87; REMARK-NEXT: --- !Analysis88; REMARK-NEXT: Pass: kernel-resource-usage89; REMARK-NEXT: Name: VGPRSpill90; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }91; REMARK-NEXT: Function: test_kernel92; REMARK-NEXT: Args:93; REMARK-NEXT: - String: ' VGPRs Spill: '94; REMARK-NEXT: - VGPRSpill: '0'95; REMARK-NEXT: ...96; REMARK-NEXT: --- !Analysis97; REMARK-NEXT: Pass: kernel-resource-usage98; REMARK-NEXT: Name: BytesLDS99; REMARK-NEXT: DebugLoc: { File: foo.cl, Line: 27, Column: 0 }100; REMARK-NEXT: Function: test_kernel101; REMARK-NEXT: Args:102; REMARK-NEXT: - String: ' LDS Size [bytes/block]: '103; REMARK-NEXT: - BytesLDS: '512'104; REMARK-NEXT: ...105 106@lds = internal unnamed_addr addrspace(3) global [128 x i32] poison, align 4107 108define 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)113 ret void114}115 116; STDERR-NOT: test_func117define void @test_func() !dbg !6 {118 call void asm sideeffect "; clobber v17", "~{v17}"()119 call void asm sideeffect "; clobber s11", "~{s11}"()120 call void asm sideeffect "; clobber a9", "~{a9}"()121 ret void122}123 124; STDERR: remark: foo.cl:8:0: Function Name: empty_kernel125; STDERR-NEXT: remark: foo.cl:8:0: TotalSGPRs: 4126; STDERR-NEXT: remark: foo.cl:8:0: VGPRs: 0127; STDERR-NEXT: remark: foo.cl:8:0: AGPRs: 0128; STDERR-NEXT: remark: foo.cl:8:0: ScratchSize [bytes/lane]: 0129; STDERR-NEXT: remark: foo.cl:8:0: Dynamic Stack: False130; STDERR-NEXT: remark: foo.cl:8:0: Occupancy [waves/SIMD]: 10131; STDERR-NEXT: remark: foo.cl:8:0: SGPRs Spill: 0132; STDERR-NEXT: remark: foo.cl:8:0: VGPRs Spill: 0133; STDERR-NEXT: remark: foo.cl:8:0: LDS Size [bytes/block]: 0134define amdgpu_kernel void @empty_kernel() !dbg !7 {135 ret void136}137 138; STDERR-NOT: empty_func139define void @empty_func() !dbg !8 {140 ret void141}142 143; STDERR: remark: foo.cl:64:0: Function Name: test_indirect_call144; STDERR-NEXT: remark: foo.cl:64:0: TotalSGPRs: test_indirect_call.numbered_sgpr+6145; STDERR-NEXT: remark: foo.cl:64:0: VGPRs: test_indirect_call.num_vgpr146; STDERR-NEXT: remark: foo.cl:64:0: AGPRs: test_indirect_call.num_agpr147; STDERR-NEXT: remark: foo.cl:64:0: ScratchSize [bytes/lane]: 0148; STDERR-NEXT: remark: foo.cl:64:0: Dynamic Stack: True149; STDERR-NEXT: remark: foo.cl:64:0: Occupancy [waves/SIMD]: occupancy(10, 4, 256, 8, 10, max(test_indirect_call.numbered_sgpr+extrasgprs(test_indirect_call.uses_vcc, test_indirect_call.uses_flat_scratch, 1), 1, 0), max(totalnumvgprs(test_indirect_call.num_agpr, test_indirect_call.num_vgpr), 1, 0))150; STDERR-NEXT: remark: foo.cl:64:0: SGPRs Spill: 0151; STDERR-NEXT: remark: foo.cl:64:0: VGPRs Spill: 0152; STDERR-NEXT: remark: foo.cl:64:0: LDS Size [bytes/block]: 0153@gv.fptr0 = external hidden unnamed_addr addrspace(4) constant ptr, align 4154 155define amdgpu_kernel void @test_indirect_call() !dbg !9 {156 %fptr = load ptr, ptr addrspace(4) @gv.fptr0157 call void %fptr()158 ret void159}160 161; STDERR: remark: foo.cl:74:0: Function Name: test_indirect_w_static_stack162; STDERR-NEXT: remark: foo.cl:74:0: TotalSGPRs: test_indirect_w_static_stack.numbered_sgpr+6163; STDERR-NEXT: remark: foo.cl:74:0: VGPRs: test_indirect_w_static_stack.num_vgpr164; STDERR-NEXT: remark: foo.cl:74:0: AGPRs: test_indirect_w_static_stack.num_agpr165; STDERR-NEXT: remark: foo.cl:74:0: ScratchSize [bytes/lane]: 144166; STDERR-NEXT: remark: foo.cl:74:0: Dynamic Stack: True167; STDERR-NEXT: remark: foo.cl:74:0: Occupancy [waves/SIMD]: occupancy(10, 4, 256, 8, 10, max(test_indirect_w_static_stack.numbered_sgpr+extrasgprs(test_indirect_w_static_stack.uses_vcc, test_indirect_w_static_stack.uses_flat_scratch, 1), 1, 0), max(totalnumvgprs(test_indirect_w_static_stack.num_agpr, test_indirect_w_static_stack.num_vgpr), 1, 0))168; STDERR-NEXT: remark: foo.cl:74:0: SGPRs Spill: 0169; STDERR-NEXT: remark: foo.cl:74:0: VGPRs Spill: 0170; STDERR-NEXT: remark: foo.cl:74:0: LDS Size [bytes/block]: 0171 172declare void @llvm.memset.p5.i64(ptr addrspace(5) nocapture readonly, i8, i64, i1 immarg)173 174define amdgpu_kernel void @test_indirect_w_static_stack() !dbg !10 {175 %alloca = alloca <10 x i64>, align 16, addrspace(5)176 call void @llvm.memset.p5.i64(ptr addrspace(5) %alloca, i8 0, i64 40, i1 false)177 %fptr = load ptr, ptr addrspace(4) @gv.fptr0178 call void %fptr()179 ret void180}181 182!llvm.dbg.cu = !{!0}183!llvm.module.flags = !{!2}184!llvm.module.flags = !{!11}185 186!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)187!1 = !DIFile(filename: "foo.cl", directory: "/tmp")188!2 = !{i32 2, !"Debug Info Version", i32 3}189!3 = distinct !DISubprogram(name: "test_kernel", scope: !1, file: !1, type: !4, scopeLine: 27, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)190!4 = !DISubroutineType(types: !5)191!5 = !{null}192!6 = distinct !DISubprogram(name: "test_func", scope: !1, file: !1, type: !4, scopeLine: 42, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)193!7 = distinct !DISubprogram(name: "empty_kernel", scope: !1, file: !1, type: !4, scopeLine: 8, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)194!8 = distinct !DISubprogram(name: "empty_func", scope: !1, file: !1, type: !4, scopeLine: 52, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)195!9 = distinct !DISubprogram(name: "test_indirect_call", scope: !1, file: !1, type: !4, scopeLine: 64, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)196!10 = distinct !DISubprogram(name: "test_indirect_w_static_stack", scope: !1, file: !1, type: !4, scopeLine: 74, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)197!11 = !{i32 1, !"amdhsa_code_object_version", i32 500}198