[Verifier] Enforce TStore dst shape and src valid_shape consistency#466
Open
TaoTao-real wants to merge 1 commit intohw-native-sys:mainfrom
Open
[Verifier] Enforce TStore dst shape and src valid_shape consistency#466TaoTao-real wants to merge 1 commit intohw-native-sys:mainfrom
TaoTao-real wants to merge 1 commit intohw-native-sys:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces explicit shape verification for the TStoreOp in the PTO dialect, ensuring that the destination tensor partition shape matches the source tile's valid shape for all statically-known dimensions. A new test case was added to validate this check. Feedback suggests making the test's error message verification more specific to ensure the reported dimension sizes are correct.
| } | ||
| } | ||
|
|
||
| // CHECK: error: 'pto.tstore' op expects dst shape[0] to match src valid_shape[0] |
There was a problem hiding this comment.
The FileCheck directive is a bit too general. It would be better to check for the specific values in the error message to make the test more robust. This ensures that the verifier is not only firing but also reporting the correct expected and actual dimension sizes.
// CHECK: error: 'pto.tstore' op expects dst shape[0] to match src valid_shape[0] (32), but got 64
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
pto.tstoreto enforce destination partition shape matches source tilevalid_shapeon statically-known dimensions.Motivation
TStoreOpverifier gap): invalid IR with mismatched destination shape and tile valid region should be rejected early.Design
TStoreOp::verify()common path inlib/PTO/IR/PTO.cpp.dst shape[i]vssrc valid_shape[i].Testing
ninja -C build ptoasbuild/tools/ptoas/ptoas test/basic/tstore_verify_shape_valid_mismatch_invalid.pto -o /tmp/tstore_invalid.cpp(expect fail with verifier error)build/tools/ptoas/ptoas test/basic/tquant_e2e.pto -o /tmp/tquant_e2e.cpp(expect pass)build/tools/ptoas/ptoas test/basic/tcvt_e2e.pto -o /tmp/tcvt_e2e.cpp(expect pass)Risk / Rollback
tstoreIR will now fail verifier earlier.