Skip to content

Fold accesses through null-pointer views - #2976

Open
wsmoses wants to merge 2 commits into
mainfrom
pb/null-access-fold
Open

Fold accesses through null-pointer views#2976
wsmoses wants to merge 2 commits into
mainfrom
pb/null-access-fold

Conversation

@wsmoses

@wsmoses wsmoses commented Aug 26, 2026

Copy link
Copy Markdown
Member

Nine MFEM TUs (restriction, the lininteg family, bilinearform_ext, hybridization_ext, ...) fail to raise under xla-gpu because a kernel captures a null pointer for an optional buffer (markers, boundary arrays) whose uses sit behind a runtime flag. The null is viewed through pointer2memref at several element types, so the wrapper-operand path can neither type it nor legalize it.

Since an access through null can only execute as undefined behavior, the accesses are dynamically dead: fold loads through a null-rooted view to a zero of the element type and drop stores. The views and the captured null then fold away entirely — in the lit test the guarded body reduces to storing the folded zero.

🤖 Generated with Claude Code

https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD

An optional buffer a kernel receives as null sits behind a runtime flag,
so its accesses can only execute as undefined behavior: fold loads to a
zero of the element type and drop stores. The views and the captured
null then die, instead of blocking the kernel on an operand that mixed
view types make untypable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016zErYp7upmqr4NHfhod9UD
getZeroAttr has no answer for pointer types, so folding a ptr-typed
load produced an arith.constant with no value attribute that crashed
downstream canonicalization.

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