-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][Vector] Improve vector.mask
verifier
#139823
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1756,6 +1756,20 @@ func.func @vector_mask_empty_passthru_no_return_type(%mask : vector<8xi1>, | |
|
||
// ----- | ||
|
||
func.func @vector_mask_non_empty_external_return(%t: tensor<?xf32>, %idx: index, | ||
%m: vector<16xi1>, %ext: vector<16xf32>) -> vector<16xf32> { | ||
%ft0 = arith.constant 0.0 : f32 | ||
// expected-error@+1 {{'vector.mask' op expects all the results from the MaskableOpInterface to match all the values returned by the terminator}} | ||
%0 = vector.mask %m { | ||
%1 =vector.transfer_read %t[%idx], %ft0 : tensor<?xf32>, vector<16xf32> | ||
vector.yield %ext : vector<16xf32> | ||
} : vector<16xi1> -> vector<16xf32> | ||
|
||
return %0 : vector<16xf32> | ||
} | ||
|
||
// ----- | ||
|
||
func.func @vector_mask_empty_passthru_empty_return_type(%mask : vector<8xi1>, | ||
%passthru : vector<8xi32>) { | ||
// expected-error@+1 {{'vector.mask' expects a result if passthru operand is provided}} | ||
|
@@ -1765,6 +1779,20 @@ func.func @vector_mask_empty_passthru_empty_return_type(%mask : vector<8xi1>, | |
|
||
// ----- | ||
|
||
func.func @vector_mask_non_empty_mixed_return(%t: tensor<?xf32>, %idx: index, | ||
%m: vector<16xi1>, %ext: vector<16xf32>) -> (vector<16xf32>, vector<16xf32>) { | ||
%ft0 = arith.constant 0.0 : f32 | ||
// expected-error@+1 {{'vector.mask' op expects number of results to match maskable operation number of results}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fails today with this error:
Its not clear to me what generates this new error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original code in |
||
%0:2 = vector.mask %m { | ||
%1 =vector.transfer_read %t[%idx], %ft0 : tensor<?xf32>, vector<16xf32> | ||
vector.yield %1, %ext : vector<16xf32>, vector<16xf32> | ||
} : vector<16xi1> -> (vector<16xf32>, vector<16xf32>) | ||
|
||
return %0#0, %0#1 : vector<16xf32>, vector<16xf32> | ||
} | ||
|
||
// ----- | ||
|
||
func.func @vector_scalable_insert_unaligned(%subv: vector<4xi32>, %vec: vector<[16]xi32>) { | ||
// expected-error@+1 {{op failed to verify that position is a multiple of the source length.}} | ||
%0 = vector.scalable.insert %subv, %vec[2] : vector<4xi32> into vector<[16]xi32> | ||
|
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.
After seeing the comment from @newling , I've realised that we are special-casing an empty
vector.mask
. This example will not trigger the error:That's a bit of inconsistency. Perhaps leave a TODO to address this at some point?
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.
yes, my intent with this PR is to make clearer that an empty
vector.mask
is not a common valid case to mask operations and that may eventually go away. Let me clarify that a bit better in the doc. We would need the CSE equivalence issue to be fixed and improve some of the existing vector transformations. Definitely a target we should be moving towards.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.
+1
I would still appreciate a TODO or some comment - mostly for my future self as a reminder about this conversation :)