Skip to content

Commit f39bd0a

Browse files
authored
[AMDGPU] Do not print kernel-resource-usage information on non-kernels (#99720)
Summary: This pass is used to get helpful information about the kernel resources without needing to insepct the binary. However, it currently prints on every function. These values will always be zero, so it's just spam on the terminal, at best an indication that a function wasn't internalized / optimized out. This patch makes it only print for kernels to make it more useful in practice.
1 parent c1622ca commit f39bd0a

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,10 @@ void AMDGPUAsmPrinter::emitResourceUsageRemarks(
14871487
if (!Ctx.getDiagHandlerPtr()->isAnalysisRemarkEnabled(Name))
14881488
return;
14891489

1490+
// Currently non-kernel functions have no resources to emit.
1491+
if (!isEntryFunctionCC(MF.getFunction().getCallingConv()))
1492+
return;
1493+
14901494
auto EmitResourceUsageRemark = [&](StringRef RemarkName,
14911495
StringRef RemarkLabel, auto Argument) {
14921496
// Add an indent for every line besides the line with the kernel name. This

llvm/test/CodeGen/AMDGPU/resource-optimization-remarks.ll

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,7 @@ define amdgpu_kernel void @test_kernel() !dbg !3 {
113113
ret void
114114
}
115115

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
116+
; STDERR-NOT: test_func
126117
define void @test_func() !dbg !6 {
127118
call void asm sideeffect "; clobber v17", "~{v17}"()
128119
call void asm sideeffect "; clobber s11", "~{s11}"()
@@ -144,15 +135,7 @@ define amdgpu_kernel void @empty_kernel() !dbg !7 {
144135
ret void
145136
}
146137

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
138+
; STDERR-NOT: empty_func
156139
define void @empty_func() !dbg !8 {
157140
ret void
158141
}

0 commit comments

Comments
 (0)