Skip to content

Raising: buffer normalizations for viewed geps and raw accesses - #3006

Open
wsmoses wants to merge 1 commit into
mainfrom
pb/buffer-normalizations
Open

Raising: buffer normalizations for viewed geps and raw accesses#3006
wsmoses wants to merge 1 commit into
mainfrom
pb/buffer-normalizations

Conversation

@wsmoses

@wsmoses wsmoses commented Aug 28, 2026

Copy link
Copy Markdown
Member

mfem kernels that are not fully inlined reach the raising with buffers addressed through pointer plumbing tensor semantics cannot stand for. This ports the foundation of the normalization suite used to bring the MFEM CUDA suite through the raising path (#2968):

  • rebaseViewedGeps: a typed view carved out of a buffer at an offset (gep feeding a pointer2memref) rebases its accesses onto the underlying buffer at base + offset.
  • convertRawGepAccesses: data-dependent indexing (CSR-style loops over runtime offsets) can never become affine and stays as raw gep+load; the access still addresses whole elements, so it becomes a plain memref access through a flat view, which raising turns into a gather.
  • inlineAllocaScopes / linearizeRegionBlocks: alloca scopes only delimit stack lifetime, which is meaningless under value semantics; splice them into the parent so scratch normalizations see the whole function.
  • dropDeadPointerChains: sweep the pointer plumbing the rewrites strand.

Follow-up PRs stack on this: buffer-branch expansion, packed capture-struct forwarding, struct scratch splitting/flattening.

🤖 Generated with Claude Code

https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD

Kernels that are not fully inlined reach the raising with buffers
addressed through pointer plumbing the tensor semantics cannot stand
for. Normalize before raising:

- rebaseViewedGeps: a typed view carved out of a buffer at an offset
  (gep feeding a pointer2memref) rebases its accesses onto the
  underlying buffer at base plus offset.
- convertRawGepAccesses: data-dependent indexing (CSR-style loops over
  runtime offsets) can never become affine and stays as raw gep+load;
  the access still addresses whole elements, so it becomes a plain
  memref access through a flat view, which raising gathers.
- inlineAllocaScopes/linearizeRegionBlocks: alloca scopes only delimit
  stack lifetime, meaningless under value semantics; splice them into
  the parent so scratch normalizations see the whole function.
- dropDeadPointerChains: sweep the pointer plumbing the rewrites strand.

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