Reject data-dependent output shapes in infer_output_spec#1722
Merged
Conversation
When a helion kernel's output contains an unbacked SymInt (indicating a data-dependent shape), raise DataDependentOutputShapeNotSupported in _remap_or_resolve instead of silently concretizing via size_hint. This is a defensive check: currently, type propagation catches known data-dependent ops (nonzero, boolean indexing) before infer_output_spec runs, making this path unreachable in practice. It is left untested for this reason, but serves as a safety net for future ops that may produce unbacked SymInts without a corresponding type propagation check. Also adds test coverage for infer_output_spec symbol remapping with single and multi-output kernels. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Yanan Cao <gmagogsfm@gmail.com>
yf225
approved these changes
Mar 16, 2026
yf225
added a commit
that referenced
this pull request
Mar 17, 2026
The previous code from PR #1722 treated ALL unbacked symbols as data-dependent, but compound expressions like `flag * 2` (= 2*u0) have unbacked symbols that come from known kernel parameters. Fix: check whether unbacked symbols are a subset of sym_remap keys. If yes, substitute concrete values and evaluate. If any symbol is unknown, raise DataDependentOutputShapeNotSupported. Un-skip 3 tests that were broken by the overly broad check: test_kernel_returns_none_in_tuple, test_kernel_returns_none_first_in_tuple, test_kernel_returns_tuple_of_scalars.
yf225
added a commit
that referenced
this pull request
Mar 19, 2026
The previous code from PR #1722 treated ALL unbacked symbols as data-dependent, but compound expressions like `flag * 2` (= 2*u0) have unbacked symbols that come from known kernel parameters. Fix: check whether unbacked symbols are a subset of sym_remap keys. If yes, substitute concrete values and evaluate. If any symbol is unknown, raise DataDependentOutputShapeNotSupported. Un-skip 3 tests that were broken by the overly broad check: test_kernel_returns_none_in_tuple, test_kernel_returns_none_first_in_tuple, test_kernel_returns_tuple_of_scalars.
yf225
added a commit
that referenced
this pull request
Mar 19, 2026
The previous code from PR #1722 treated ALL unbacked symbols as data-dependent, but compound expressions like `flag * 2` (= 2*u0) have unbacked symbols that come from known kernel parameters. Fix: check whether unbacked symbols are a subset of sym_remap keys. If yes, substitute concrete values and evaluate. If any symbol is unknown, raise DataDependentOutputShapeNotSupported. Un-skip 3 tests that were broken by the overly broad check: test_kernel_returns_none_in_tuple, test_kernel_returns_none_first_in_tuple, test_kernel_returns_tuple_of_scalars.
yf225
added a commit
that referenced
this pull request
Mar 20, 2026
The previous code from PR #1722 treated ALL unbacked symbols as data-dependent, but compound expressions like `flag * 2` (= 2*u0) have unbacked symbols that come from known kernel parameters. Fix: check whether unbacked symbols are a subset of sym_remap keys. If yes, substitute concrete values and evaluate. If any symbol is unknown, raise DataDependentOutputShapeNotSupported. Un-skip 3 tests that were broken by the overly broad check: test_kernel_returns_none_in_tuple, test_kernel_returns_none_first_in_tuple, test_kernel_returns_tuple_of_scalars.
hinriksnaer
pushed a commit
to hinriksnaer/helion
that referenced
this pull request
Mar 20, 2026
Signed-off-by: Yanan Cao <gmagogsfm@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
yf225
added a commit
that referenced
this pull request
Mar 23, 2026
The previous code from PR #1722 treated ALL unbacked symbols as data-dependent, but compound expressions like `flag * 2` (= 2*u0) have unbacked symbols that come from known kernel parameters. Fix: check whether unbacked symbols are a subset of sym_remap keys. If yes, substitute concrete values and evaluate. If any symbol is unknown, raise DataDependentOutputShapeNotSupported. Un-skip 3 tests that were broken by the overly broad check: test_kernel_returns_none_in_tuple, test_kernel_returns_none_first_in_tuple, test_kernel_returns_tuple_of_scalars.
yf225
added a commit
that referenced
this pull request
Mar 23, 2026
The previous code from PR #1722 treated ALL unbacked symbols as data-dependent, but compound expressions like `flag * 2` (= 2*u0) have unbacked symbols that come from known kernel parameters. Fix: check whether unbacked symbols are a subset of sym_remap keys. If yes, substitute concrete values and evaluate. If any symbol is unknown, raise DataDependentOutputShapeNotSupported. Un-skip 3 tests that were broken by the overly broad check: test_kernel_returns_none_in_tuple, test_kernel_returns_none_first_in_tuple, test_kernel_returns_tuple_of_scalars.
umechand-amd
pushed a commit
to umechand-amd/helion
that referenced
this pull request
Mar 23, 2026
Signed-off-by: Yanan Cao <gmagogsfm@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
When a helion kernel's output contains an unbacked SymInt (indicating a data-dependent shape) that is produced inside Helion Kernel (via
.item()calls), raiseDataDependentOutputShapeNotSupported.This is a defensive check: currently, type propagation catches known data-dependent ops (nonzero, boolean indexing) before infer_output_spec runs, making this path unreachable in practice. It is left untested for this reason, but serves as a safety net for future ops that may produce unbacked SymInts without a corresponding type propagation check.