[llvm] [RISCV][TTI] Implement getPartialReductionCost for the vqdotq cases (PR #140974)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri May 23 07:13:22 PDT 2025


================
@@ -294,6 +294,29 @@ RISCVTTIImpl::getPopcntSupport(unsigned TyWidth) const {
              : TTI::PSK_Software;
 }
 
+InstructionCost RISCVTTIImpl::getPartialReductionCost(
+    unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
+    ElementCount VF, TTI::PartialReductionExtendKind OpAExtend,
+    TTI::PartialReductionExtendKind OpBExtend,
+    std::optional<unsigned> BinOp) const {
+
+  // zve32x is broken for partial_reduce_umla, but let's make sure we
+  // don't generate them.
+  if (!ST->hasStdExtZvqdotq() || ST->getELen() < 64 ||
+      Opcode != Instruction::Add || !BinOp || *BinOp != Instruction::Mul ||
+      InputTypeA != InputTypeB || !InputTypeA->isIntegerTy(8) ||
+      OpAExtend != OpBExtend || !AccumType->isIntegerTy(32) ||
----------------
preames wrote:

If you want, I can add the TODO, but I didn't feel it added anything with the existing TODO on that topic already existing in lowering.

https://github.com/llvm/llvm-project/pull/140974


More information about the llvm-commits mailing list