[llvm-branch-commits] [mlir] [mlir][linalg] Migrate Detensorize pass to new dialect conversion driver (PR #152912)
Renato Golin via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Aug 10 09:30:57 PDT 2025
================
@@ -551,8 +567,22 @@ struct LinalgDetensorize
populateBranchOpInterfaceTypeConversionPattern(patterns, typeConverter,
shouldConvertBranchOperand);
- if (failed(
- applyFullConversion(getOperation(), target, std::move(patterns))))
+ ConversionConfig config;
+ auto onOperationErased = [&](Operation *op) {
+ opsToDetensor.erase(op);
+ detensorableBranchOps.erase(op);
+ };
+ auto onBlockErased = [&](Block *block) {
+ for (BlockArgument arg : block->getArguments()) {
+ blockArgsToDetensor.erase(arg);
+ }
+ };
+ CallbackListener listener(onOperationErased, onBlockErased);
+
+ config.listener = &listener;
+ config.allowPatternRollback = false;
+ if (failed(applyFullConversion(getOperation(), target, std::move(patterns),
----------------
rengolin wrote:
Since the callback doesn't return anything, it won't change the success/failure result, so this should be fine.
https://github.com/llvm/llvm-project/pull/152912
More information about the llvm-branch-commits
mailing list