[PATCH] D140242: [AMDGPU] Modify adjustInliningThreshold to also consider the cost of passing function arguments through the stack

Siu Chi Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 13:38:50 PST 2022


scchan added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp:1204
+  adjustThreshold += std::max(0, SGPRsInUse - 26) * ArgStackInlinePenalty;
+  adjustThreshold += std::max(0, VGPRsInUse - 32) * ArgStackInlinePenalty;
+  return adjustThreshold;
----------------
arsenm wrote:
> scchan wrote:
> > I guess it's subtracting the number of clobbered registers -  instead of a hardcoded value, could that be replaced by something more meaningful like a const variable or a getter?
> > 
> > Also shouldn't VGPRs have a higher penalty relative to SGPRs since they'd occupy more stack space?
> We only sort of handle SGPR arguments today, and not for compute. We also do not currently implement the optimization of packing SGPRs into a VGPR for the argument spill
I wasn't paying attention to the comments for ArgStackInlinePenalty.  The cost model is only based on the number of instructions and it doesn't take storage into account.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140242/new/

https://reviews.llvm.org/D140242



More information about the llvm-commits mailing list