[PATCH] D128346: [AMDGPU] Set scratch size to 0 if is_dynamic_callstack is set
Abinav Puthan Purayil via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 23 05:04:34 PDT 2022
abinavpp added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp:698-699
+ Info.HasDynamicallySizedStack || Info.HasRecursion;
+ ProgInfo.ScratchSize =
+ ProgInfo.DynamicCallStack ? 0 : Info.PrivateSegmentSize;
ProgInfo.VCCUsed = Info.UsesVCC;
----------------
arsenm wrote:
> Dynamic call size does not imply 0 for the statically reported size. We still need to report the minimum statically known requirement
Does that mean we should do the following instead?
```
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
index f7f93c75c870..e6a5aa989c9d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -165,8 +151,6 @@ AMDGPUResourceUsageAnalysis::analyzeResourceUsage(
// Assume a big number if there are any unknown sized objects.
Info.HasDynamicallySizedStack = FrameInfo.hasVarSizedObjects();
- if (Info.HasDynamicallySizedStack)
- Info.PrivateSegmentSize += AssumedStackSizeForDynamicSizeObjects;
if (MFI->isStackRealigned())
Info.PrivateSegmentSize += FrameInfo.getMaxAlign().value();
@@ -469,16 +453,12 @@ AMDGPUResourceUsageAnalysis::analyzeResourceUsage(
// directly call the tail called function. If a kernel directly
// calls a tail recursive function, we'll assume maximum stack size
// based on the regular call instruction.
- CalleeFrameSize =
- std::max(CalleeFrameSize,
- static_cast<uint64_t>(AssumedStackSizeForExternalCall));
+ CalleeFrameSize = 0;
}
}
if (IsIndirect || I == CallGraphResourceInfo.end()) {
- CalleeFrameSize =
- std::max(CalleeFrameSize,
- static_cast<uint64_t>(AssumedStackSizeForExternalCall));
+ CalleeFrameSize = 0;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128346/new/
https://reviews.llvm.org/D128346
More information about the llvm-commits
mailing list