[Mlir-commits] [mlir] [MLIR] [Vector] ConstantFold MultiDReduction (PR #122450)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon Jan 13 11:09:44 PST 2025
================
@@ -463,10 +462,155 @@ void vector::MultiDimReductionOp::build(OpBuilder &builder,
build(builder, result, kind, source, acc, reductionDims);
}
+/// Computes the result of reducing a constant vector where the accumulator
+/// value, `acc`, is also constant.
+template <typename T>
+static OpFoldResult computeConstantReduction(T src, T acc, int64_t times,
+ CombiningKind kind,
+ ShapedType dstType);
+template <typename T>
+static T power(const T &a, int64_t times);
----------------
banach-space wrote:
[nit] `power` -> `computePowerOf` (or similar).
>From https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly:
>Function names should be verb phrases (as they represent actions), and command-like function should be imperative. The name should be camel case, and start with a lower case letter (e.g. openFile() or isFoo()).
Also, these hooks don't really belong here. "APInt.h" and "APFloat.h" seem like more suitable place. Could you add a TODO to move them? Or, better still, do it within this PR.
https://github.com/llvm/llvm-project/pull/122450
More information about the Mlir-commits
mailing list