Repository navigation
Address crash in iree-reduce with complex tensors - #24674
Merged
Merged
Conversation
reduceLinalgOnTensorsDelta replaces a linalg op that produces a tensor with a linalg.fill of a zero constant. It built that constant from Builder::getZeroAttr(elementType), which returns a null attribute for element types it does not support (e.g. complex). Creating an arith.constant from the null attribute aborted iree-reduce with "Failed to infer result type(s)". Skip const-expr replacement for element types that getZeroAttr does not support (non int/index/float), leaving the op untouched instead of crashing. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Paul Stark <[email protected]>
AGindinson
self-requested a review
July 4, 2026 06:59
AGindinson
approved these changes
Jul 6, 2026
AGindinson
left a comment
Contributor
There was a problem hiding this comment.
LGTM, thanks for the fix alongside a clear report!
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.
See issue #24673. Details are repeated here.
iree-reducecrashes inreduceLinalgOnTensorsDeltawhen it tries to replace alinalgop that produces a complex-typed tensor. The strategy builds a zero constant viaBuilder::getZeroAttr(elementType), which returns a null attribute forcomplex(it only supports int/index/float). Creating anarith.constantfrom the null attribute aborts the process.The proposed fix simply does an early-out if the type is not int, float, or index instead of crashing.
Repro:
interesting.shcomplex_repro.mlirRun using:
Crashes with: