[Mlir-commits] [mlir] feat(linalg): add a way to pass controlFn to `foldIntoPackUnpackPatterns` (PR #143685)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Jun 24 07:21:21 PDT 2025
================
@@ -1894,10 +1894,18 @@ void populateDecomposeWinogradOpsPatterns(RewritePatternSet &patterns);
/// convert to a `linalg.dot`.
void populateContractionOpRankReducingPatterns(RewritePatternSet &patterns);
+/// Function type which is used to control folding operations like `tensor.pad`
+/// and `tensor.extract_slice` into linalg.pack/unpack ops.
+using ControlFoldIntoPackUnpackFn = std::function<bool(OpOperand *opOperand)>;
+inline bool defaultControlFoldIntoPackUnpackFn(OpOperand *opOperand) {
+ return true;
+};
----------------
Max191 wrote:
nit: I think you can just pass `nullptr` as the default function argument, and then just check that the control function exists before running it. Then you don't need this default function.
https://github.com/llvm/llvm-project/pull/143685
More information about the Mlir-commits
mailing list