[Mlir-commits] [mlir] [mlir][vector][memref] Add `alignment` attribute to memory access ops (PR #144344)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Fri Jun 20 02:35:27 PDT 2025
ftynse wrote:
> We want to preserve high-level information so ptr.ptr would be too late and won't work for spirv which relies on typed pointers and doesn't lower via ptr.ptr.
What high-level information does `memref<?xi8>` have? It's an array of bytes... We need a better interop between pointers and memrefs, in particular taking views of a pointer as a memref in a way that doesn't interfere with aliasing analyses, but I don't see why we should keep abusing memrefs when a pointer is actually needed.
> I don't have any use for it myself, but I think this still may be useful to denote the alignment of the base pointer if you want to rely on some other analysis or llvm to deduce alignment based on gep offsets from the base pointers. I'd think that if you have multiple assume_alignment over the same memref, this should effectively form a conjunction of all the assumptions, e.g.: and(x div 2, x div 4) => x div 4) or and(x div 2, x div 3) ==> x div 6 -- I think this is unsurprising if we only allow pow2 values.
We can certainly take the LCM of two values, that's not the issue here. The issue is that one needs a dataflow analysis to see which assumptions have been stated about which value, e.g., `assume_alignment` may be placed later than a load in a block, but that block may be a body of the loop. And there may be another assumption before and outside that block...
https://github.com/llvm/llvm-project/pull/144344
More information about the Mlir-commits
mailing list