Skip to content

Raising: rewrite pointer induction to indexed accesses - #3011

Open
wsmoses wants to merge 2 commits into
pb/buffer-normalizationsfrom
pb/pointer-induction
Open

Raising: rewrite pointer induction to indexed accesses#3011
wsmoses wants to merge 2 commits into
pb/buffer-normalizationsfrom
pb/pointer-induction

Conversation

@wsmoses

@wsmoses wsmoses commented Aug 28, 2026

Copy link
Copy Markdown
Member

Stacks on #3006.

A loop that walks a pointer forward by a constant stride each iteration (mfem's *y++ += ... accumulation loops in hybridization_ext.cpp) carries the pointer as an iter arg no tensor can stand for. The pointer is a pure function of the induction variable, so accesses through it rebase onto the init pointer at orig + k*stride (with the byte stride converted into the view's element units) and the loop rebuilds without the pointer iter args; dead carried pointers drop with it.

Part of #2968.

🤖 Generated with Claude Code

https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD

A loop that walks a pointer forward by a constant stride each iteration
(mfem's y[i] accumulation loops) carries it as an iter arg no tensor
can stand for. The pointer is a pure function of the induction
variable, so accesses through it rebase onto the init pointer at
orig + k*stride and the loop rebuilds without the pointer iter args.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
Extends the rewrite to the shapes rotated do-while lowerings produce:
- a used final pointer materializes as the init advanced by the whole
  trip; statically known trips fold to a constant so downstream users
  stay affine
- the advance stride may be a loop-invariant runtime value (an inner
  loop's materialized whole-trip advance); its computation chain is
  cloned above the loop when it lives inside the body
- a dead-in-body iter arg that re-yields another induction's advance
  (a lagging copy) is dropped; its used result becomes
  select(trip>0, base final, own init), or the base final alone when
  the init is poison
- static strides compose into the affine access map instead of
  degrading the access to an arith-indexed memref.load

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant