[Mlir-commits] [mlir] [mlir] Fix MemRefType alignment in ConvertVectorToLLVM (PR #137389)

Andrzej Warzyński llvmlistbot at llvm.org
Tue Apr 29 12:53:53 PDT 2025


banach-space wrote:

Hey @electriclilies — this isn’t my area of expertise, but since no one else has chimed in yet, I’ll try to help (at least by pointing you toward the right people).

Right now, this feels a bit ad-hoc and assumes that everyone wants their MemRef(s) aligned to a vector boundary rather than a scalar one. That’s not ideal and should generally be avoided — but having a flag to control this seems fine. To me, your requirements don’t seem that exotic and should be relatively straightforward to support. Would adding a flag be sufficient for your use case?

> What we'd like is for our data layout description to look more like this:
> 
> f16:{f16_alignment}-f32:{f32_alignment}-n32:{n32_alignment}-v512:{vector_alignment}-v1024:{vector_alignment}-v2048:{vector_alignment}-v4096:{vector_alignment}-v8192

IIUC, this format is supported by LLVM’s data layout:

* https://llvm.org/docs/LangRef.html#data-layout

Is there a specific issue you’re running into with this?

> That would probably require adding a test that has a different or fake data layout description, and I'm not sure how to do that.

A couple of questions:
* How are you currently specifying the data layout?
* If we added a flag to control whether alignment should match the element or vector boundary, could we test the behavior by toggling that flag?

As per specifying the data layout in a test, I will need to ask around myself 😅 

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


More information about the Mlir-commits mailing list