Skip to content

Raising: forward the packed capture struct; distribute geps over selects - #3009

Closed
wsmoses wants to merge 1 commit into
pb/buffer-branchesfrom
pb/packed-scratch
Closed

Raising: forward the packed capture struct; distribute geps over selects#3009
wsmoses wants to merge 1 commit into
pb/buffer-branchesfrom
pb/packed-scratch

Conversation

@wsmoses

@wsmoses wsmoses commented Aug 28, 2026

Copy link
Copy Markdown
Member

Stacks on #3007 (which stacks on #3006).

A not-quite-inlined device lambda packs its captures (DeviceTensors: pointer + sizes) into a stack struct and reads them back through typed views at constant offsets. Forward each load to the unique dominating store of its slot so the pointer-typed members never reach the raising as memory:

  • constant-attribute and constant-valued-SSA gep indexing;
  • wide integer stores covering several slots (two i32 sizes packed into one i64 write, extracted little-endian shift+trunc);
  • runtime-indexed shape reads (sizes[i] walked in a loop, as a memref.load or an affine map like s0 floordiv 4) resolved as a select chain over the constant-offset stores of their element type;
  • stranded dead pointer selects (left by the buffer-branch expansion) skipped — narrowly, since a general dead-user skip admits big register scratch whose forwarding is unsound.

Also distributeGepOverSelect: a side-selected view (select of byte offsets or of the pointers themselves feeding geps) distributes the gep and the memref view over the select so the buffer-branch expansion (#3007) can take over.

This is what makes mfem's bilininteg_vecdiffusion_pa.cpp and the batched LOR kernels raise fully (#2968).

🤖 Generated with Claude Code

https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD

Rebased onto main from the buffer-normalization stack.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
@wsmoses
wsmoses force-pushed the pb/packed-scratch branch from a2403d5 to fa1e592 Compare August 30, 2026 13:02
@wsmoses

wsmoses commented Aug 30, 2026

Copy link
Copy Markdown
Member Author

Recreated targeting main (content rebased): the stack lock prevents changing this PR's base.

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