[Mlir-commits] [mlir] [mlir][memref]: Add expand/collapse rewrite pattern to MemRef::CopyOp (PR #67808)

Nicolas Vasilache llvmlistbot at llvm.org
Tue Oct 3 06:49:10 PDT 2023


nicolasvasilache wrote:

@AviadCo thanks for your description.

I would recommend trying to use/refactor the logic of `linalg::collapseGenericOpIterationDims`  in `mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp` if possible.

Atm this works on tensors but could be refactored to work with memref if needed.
I don't know whether transformations on tensors are reasonable for you (vs on memref).
If you need to stay in memref land for your transforms, then refactoring makes sense.

If possible, I'd recommend going for transforms on tensors and using bufferization.bufferize_to_alloc_tensor in mlir/test/Dialect/Linalg/transform-op-bufferize-to-allocation.mlir, which takes a memory space and connects properly to bufferization. There is also mlir/test/Dialect/Linalg/pad-to-specific-memory-space.mlir for other related tests.


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


More information about the Mlir-commits mailing list