As of today, there isn’t a way to specify the alignment of a memref and preserve that in LLVM. At Standard level, I can think of several options to support alignment:
a) Similar to LLVM, allow loads and stores to carry alignment information.
b) Similar to LLVM, allow function args (that are memrefs) to carry alignment information.
c) Add alignment to MemRefType as part of the type information.
Although c) is still debatable from language design’s perspective (whether alignment should be part of a type), a) and b) are worse choices to me:
- a) doesn’t enable users from specifying alignment for function args;
- As for b), inlining will drop all function arg attributes information on the floor.
- Besides, for b), MLIR values don’t have attributes in the first place.
I’m working on c) at the moment, in the hope that nothing surprising comes up.