Skip to content

Consider alignment for vector stores/loads

For array subscripts with affine indices, we can infer alignment robustly without user intervention using the polyhedral infrastructure. For non-affine indices, we probably want a way to annotate.

Language-wise, those annotations could look like:

  • a@aligned[i,j]
  • aligned(a[i,j])
  • a.aligned[i,j]

I propose that we subclass pymbolic's Subscript node to add a tri-state (true/false/unknown) "aligned" flag, same with Loopy's LinearSubscript. (and rewrite any vanilla Subscript nodes we run into to ours)

To avoid inconsistency, I think the syntax should be the same on the load and store end.

  • This syntax needs to be mentioned in the documentation somewhere.

On the code generation end, I propose we create an ASTBuilder method to do codegen for a vector load and a vector store, with an aligned flag. The value of that flag should be determined centrally somewhere. (i.e. not per-target/per-AST builder)

cc @MarcelKoch