[RFC] Reducing Runtime Pointer Comparisons for Stencil Codes via Stencil Group Merging in LoopAccessAnalysis

Added a link to the patch.

Aren’t they strides with respect to the mid and outer loops? I.e.:

  • Inner loop (over i): stride = 1 element (consecutive)
  • Mid loop (over j): stride = cdj (= grid width)
  • Outer loop (over k): stride = cdk (= grid width × grid height)

That was my understanding of the term stride.

This is somewhat a decision I had to make. We check for positive strides to get tighter ranges. If accesses are at {-1cdj, +1cdj, +2cdj}, the coefficient range is [-1, 2], giving bounds [base - cdj, base + 2cdj]. For potentially negative strides the formula would be
different, with wider ranges like [base - 2abs(cdj), base + 2abs(cdj) + …]. That’s actually worth discussing - which approach is better. I feel like negative strides in these expressions are something that won’t happen very often, if ever.