Skip to content

Raise through inliner scope wrappers and shape-erasing casts - #2990

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

Raise through inliner scope wrappers and shape-erasing casts#2990
wsmoses wants to merge 1 commit into
mainfrom
pb/raise-scope-normalizations

Conversation

@wsmoses

@wsmoses wsmoses commented Aug 27, 2026

Copy link
Copy Markdown
Member

Two normalizations MFEM's dfem/lininteg/hdiv kernels need after the ParallelLower fixes:

  • Scope wrappers dissolve before raising. The ParallelLower inliners wrap cloned callees in memref.alloca_scope + scf.execute_region pairs, sometimes carrying results and a residual CFG whose other arm is an assert trap (cf.switch/cf.cond_br into a block ending llvm.unreachable). Trap successors are pruned to the one live target, straight-line blocks merge, and single-block scopes splice into the parent — iterated to a fixed point since the wrappers stack.
  • Shape-erasing memref.casts stop blocking raising. A memref<30xf64> -> memref<?xf64> cast of static scratch folds at accesses to the static source (same treatment as memory-space casts), and a cast of an already-raised buffer raises as the identity on the underlying tensor.

🤖 Generated with Claude Code

https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD

The ParallelLower inliners wrap cloned callees in alloca_scope and
execute_region ops, sometimes carrying results and a residual CFG with
a trap arm. Inline them before raising: branches whose other targets
only trap take their one live successor, straight-line blocks merge,
and single-block scopes splice into the parent, iterated to a fixed
point since the wrappers stack.

A shape-erasing memref.cast of a static buffer blocks raising the same
way a memory-space cast does: accesses fold to the static source, and
a cast of an already-raised buffer raises as the identity on the
underlying tensor.

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