-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[mlir][vector] Fix crash in ReorderCastOpsOnBroadcast with non-vector result #170985
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
base: main
Are you sure you want to change the base?
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -850,3 +850,20 @@ func.func @negative_store_no_single_use(%arg0: memref<?xf32>, %arg1: index, %arg | |||||
| vector.store %0, %arg0[%arg1] : memref<?xf32>, vector<1xf32> | ||||||
| return %0 : vector<1xf32> | ||||||
| } | ||||||
|
|
||||||
| // ----- | ||||||
|
|
||||||
| // CHECK-LABEL: func.func @broadcast_cast_non_vector_result | ||||||
| // CHECK-SAME: (%[[ARG:.*]]: i64) | ||||||
| // CHECK: %[[BCAST:.*]] = vector.broadcast %[[ARG]] : i64 to vector<26x7xi64> | ||||||
| // CHECK: %[[CAST:.*]] = builtin.unrealized_conversion_cast %[[BCAST]] : vector<26x7xi64> to !llvm.array<26 x vector<7xi64>> | ||||||
| // CHECK: return %[[CAST]] : !llvm.array<26 x vector<7xi64>> | ||||||
| /// This test ensures that the `ReorderCastOpsOnBroadcast` pattern does not | ||||||
| /// attempt to reorder a cast operation that produces a non-vector result type. | ||||||
| /// Previously, this would crash because the pattern assumed the result was a | ||||||
| /// vector type when creating the new inner broadcast. | ||||||
|
Comment on lines
+863
to
+864
Contributor
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. [nit] "Previously" is a very relative term ("previously to what?"). I would just drop this sentence, it doesn't add any new info. |
||||||
| func.func @broadcast_cast_non_vector_result(%arg0: i64) -> !llvm.array<26 x vector<7xi64>> { | ||||||
|
Contributor
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. Please follow our naming convention (as per https://mlir.llvm.org/getting_started/TestingGuide/#test-naming-convention)
Suggested change
|
||||||
| %0 = vector.broadcast %arg0 : i64 to vector<26x7xi64> | ||||||
| %1 = builtin.unrealized_conversion_cast %0 : vector<26x7xi64> to !llvm.array<26 x vector<7xi64>> | ||||||
| return %1 : !llvm.array<26 x vector<7xi64>> | ||||||
| } | ||||||
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.
Tests for this pattern are located below this block comment:
llvm-project/mlir/test/Dialect/Vector/vector-sink.mlir
Line 339 in bc9f96a
Please move it accordingly. Thanks!