-
Notifications
You must be signed in to change notification settings - Fork 334
[Enhancement] Support Layout/Fragment Reshape #1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
01b44c2
Update layout handling and introduce reshape functionality
LeiWang1999 e266482
lint fix
LeiWang1999 7a69bde
Revert tvm submodule pointer to 1815c3e0b6ec4ead36370bbd1562025d85290…
1819d0c
Update tvm submodule to commit f0bbd3bf741413c35c389ba5dedd5be206000ad1
LeiWang1999 2a76b53
Update tvm submodule to commit f0bbd3bf741413c35c389ba5dedd5be206000ad1
LeiWang1999 53243be
remove useless prove
LeiWang1999 29fd82c
remove comment
LeiWang1999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule tvm
updated
from 1815c3 to 093b2c
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Improved fallback logic prevents crashes but may be overly conservative.
The updated
OutputShape()fallback (lines 104-122) improves robustness when the analyzer cannot form anIntervalSet:Improvements:
const_int_boundto derive safe extents when possible (lines 107-112)input_size_[i]or1as last resort (lines 115-120)CHECK(is_one(ist.min()))assertion for the normal path (line 123)Concern: The fallback to
input_size_[i]or1(lines 116-119) is conservative but may produce incorrect shapes for complex layouts. Consider whether a runtime error or more sophisticated analysis would be preferable to silently using potentially incorrect dimensions.Verify that the fallback behavior is acceptable for all layout types, especially when
forward_index_[i]involves bitwise operations or other constructs the analyzer cannot handle.🏁 Script executed:
Length of output: 2812
🏁 Script executed:
Length of output: 539
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 4699
🏁 Script executed:
Length of output: 2304
🏁 Script executed:
Length of output: 632
🏁 Script executed:
Length of output: 402
🏁 Script executed:
Length of output: 1455
🏁 Script executed:
Length of output: 3885
🏁 Script executed:
Length of output: 848
🏁 Script executed:
Length of output: 1497
Fix the OutputShape() fallback to ensure it always returns const integers, or validate input_size_ at construction time.
The fallback logic (lines 104-122) has a critical bug: it returns
input_size_[i](line 117), which may contain non-constPrimExprsinceinput_size_is populated from sources likebuffer->shape(seelayout_reducer.cc:216-217). This violates the implicit contract thatOutputShape()returns const dimensions.Specifically,
layout_inference.cc:839will crash with anICHECKfailure:Fix: Either (1) validate that
input_size_elements are const at construction time, (2) ensure the fallback path only returns proven const dimensions (e.g., alwaysInteger(1)instead ofinput_size_[i]), or (3) add a precondition guard preventing this fallback wheninput_size_contains symbolic expressions.