[PATCH] D117253: [AMDGPU] Select VGPR versions of MFMA if possible

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 17 17:08:52 PST 2022


arsenm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp:103
+
+    if (ST.hasGFX90AInsts() && !HasCalls &&
+        ST.getMaxNumVGPRs(F) <= AMDGPU::VGPR_32RegClass.getNumRegs() &&
----------------
rampitec wrote:
> arsenm wrote:
> > rampitec wrote:
> > > arsenm wrote:
> > > > Relying on the calls check here is unreliable. Since you only really need to query this before selection, can't we just see when an asm statement containing AGPRs is hit?
> > > This function already relyies on this. Then it is not sufficient to check for asm, as a called function may use agprs.
> > I know it does, and it's not good. Unlike the current use case for checking for calls, you don't need to know this up-front for the ABI so you don't have to stick this here
> I could add a check for calls where I am checking asm. The scan is there anyway. Is that better?
> 
> There must be no calls for this to be legal. 
Yes. Technically the legalizer is free to introduce new calls, but we happen to never do that.

Since this is only used in a pattern predicate, and we will have visited asm and call sites by that time, you can check both of those things in the predicate and cache it


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

https://reviews.llvm.org/D117253



More information about the llvm-commits mailing list