Fold accesses through null-pointer views - #2976
Open
wsmoses wants to merge 2 commits into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nine MFEM TUs (restriction, the lininteg family, bilinearform_ext, hybridization_ext, ...) fail to raise under
xla-gpubecause a kernel captures a null pointer for an optional buffer (markers, boundary arrays) whose uses sit behind a runtime flag. The null is viewed throughpointer2memrefat 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