[Mlir-commits] [mlir] [MLIR][Linalg] Fix insert_slice fusion with rank reduction (PR #130961)

Andrzej WarzyƄski llvmlistbot at llvm.org
Wed Mar 26 02:24:09 PDT 2025


================
@@ -272,12 +308,16 @@ mlir::linalg::fuseProducerOfTensor(OpBuilder &b, OpResult producerOpResult,
            consumerOpOperand);
 
   // Replace use.
+  Value def = fusedProducer->getResult(producerOpResult.getResultNumber());
+  Type consumerType = consumerOpOperand.get().getType();
+  // Rank-reduction occured as part of the extract_slice.
----------------
banach-space wrote:

I have just realised ... Why not re-use rank-reducing `tensor.extract_slice` instead? It's a bit counter-intuitive to make that a rank-reducing `tensor.extract_slice` is replaced with a pair of `tensor.extract_slice` + `tensor.collapse_shape`. 

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


More information about the Mlir-commits mailing list