fix: canonicalize singleton partition-view axes for GT lowering#463
Open
TaoTao-real wants to merge 3 commits intohw-native-sys:mainfrom
Open
fix: canonicalize singleton partition-view axes for GT lowering#463TaoTao-real wants to merge 3 commits intohw-native-sys:mainfrom
TaoTao-real wants to merge 3 commits intohw-native-sys:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a singleton axis reordering optimization for partition views in PTOToEmitC.cpp, allowing axes with a size of 1 to be moved to the front when safe. It also includes a new test case to verify this behavior. I have no further feedback to provide, as the suggested improvements for using standard library algorithms are optional and the current implementation is clear and correct.
Contributor
Author
|
Update with the refined scope discussed:
Guard coverage added in test/basic/issue453_partition_view_singleton_axis_reorder.pto:
Local validation:
|
Contributor
Author
|
Follow-up update based on review direction (clean layering):
Gating semantics remain the same:
Additional test coverage added:
Validation rerun (all pass):
|
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.
Summary
memref.subview -> GlobalTensorlowering for partition-view outputs.size == 1) ahead of non-singleton axes when building GT shape/stride metadata.Motivation
[1, 16, 1, 16]were semantically legal but emitted as non-canonical 5D forms that can trip backend assertions.Design
SubviewToEmitCPatterninlib/PTO/Transforms/PTOToEmitC.cpp.<= 2.Testing
test/basic/issue453_partition_view_singleton_axis_reorder.pto[1,16,1,16]lowers toShape<1,1,1,16,16>.[2,16,1,16]remains non-reordered (Shape<1,2,16,1,16>).build/tools/ptoas/ptoas --pto-arch=a5 test/basic/issue453_partition_view_singleton_axis_reorder.pto | FileCheck ...build/tools/ptoas/ptoas test/basic/infer_layout_ambiguous_minor2d_user_dn.pto | FileCheck ...build/tools/ptoas/ptoas --pto-arch=a3 test/basic/tstore_forms_emitc.pto | FileCheck ...Risk / Rollback