[Mlir-commits] [mlir] [mlir][EmitC] Expand the MemRefToEmitC pass - Lowering `extract_strided_metadata` (PR #152208)

Gil Rapaport llvmlistbot at llvm.org
Sat Aug 9 03:39:20 PDT 2025


aniragil wrote:

I'm not entirely sure EmitC is ready for this op yet:

The dialect currently supports only identity-stride layouts that map into multi-dimensional C arrays, so strides equal sizes and offset is always zero.
Sizes can be made accessible by lowering the [`memref.dim`](https://mlir.llvm.org/docs/Dialects/MemRef/#memrefdim-memrefdimop) op.
For the aligned pointer (currently the only pointer EmitC supports) there's the [`memref.extract_aligned_pointer_as_index`](https://mlir.llvm.org/docs/Dialects/MemRef/#memrefextract_aligned_pointer_as_index-memrefextractalignedpointerasindexop) op that could be relevant.

The `extract_strided_metadata` op is for more general memrefs, which map to two pointers (base and aligned), an offset, sizes and strides, which the LLVM dialect represents using an LLVM struct. I definitely hope EmitC would one day support such memrefs, e.g. in favor of `memref.subview`, but we're not really there yet.

WDYT @mgehre, @marbre, , @simon-camp?

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


More information about the Mlir-commits mailing list