[all-commits] [llvm/llvm-project] 4572ec: [AMDGPU] Have rewrite candidate defer to cost mode...
Dhruva Chakrabarti via All-commits
all-commits at lists.llvm.org
Thu Sep 17 12:59:49 PDT 2026
Branch: refs/heads/users/dhruvachak/fix_tied_rewrite
Home: https://github.com/llvm/llvm-project
Commit: 4572ece1005f1279dcc12e3d0e3856de0305e4f0
https://github.com/llvm/llvm-project/commit/4572ece1005f1279dcc12e3d0e3856de0305e4f0
Author: Dhruva Chakrabarti <Dhruva.Chakrabarti at amd.com>
Date: 2026-09-17 (Thu, 17 Sep 2026)
Changed paths:
M llvm/lib/Target/AMDGPU/GCNSchedStrategy.cpp
A llvm/test/CodeGen/AMDGPU/sched_mfma_rewrite_tied.mir
Log Message:
-----------
[AMDGPU] Have rewrite candidate defer to cost model for tied operands
RewriteMFMAFormStage::isRewriteCandidate rejects any MFMA whose result
has a non-MFMA, non-copy user, because such a user forces an unavoidable
AGPR->VGPR bridge copy. While that is reasonable for the untied form, it
is too coarse for the tied form.
In the tied form the destination and src2 are the same register, so a
single vreg spans the entire accumulator chain:
%acc = V_MFMA_F32_32X32X8F16_mac_vgprcd_e64 %a, %b, %acc
%acc = V_MFMA_F32_32X32X8F16_mac_vgprcd_e64 %a, %b, %acc
...
%acc = V_MFMA_F32_32X32X8F16_mac_vgprcd_e64 %a, %b, %acc
%cvt:vgpr_32 = V_CVT_PK_BF16_F32_e64 %acc.sub0
%acc's use list contains the V_CVT, so isRewriteCandidate returns false
for all the MFMAs, though the result of only the last one reaches the
consumer. For a similar dataflow in untied form, only the last one is
rejected.
The fix is to let the tied form bypass the filter and defer to the cost
model which already has the profitability logic to address this case.
AI-Assisted
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list