-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[mlir][Vector] Remove 0-d corner case condition. #112937
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 6 commits
5e07a46
e5b8fac
3f9f7b0
ec6b5ab
5f61d16
6db82e0
6a5ac3c
700b0ea
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 |
|---|---|---|
|
|
@@ -7,15 +7,13 @@ func.func @vector_transfer_ops_0d_memref(%mem: memref<f32>, %vec: vector<1x1x1xf | |
| %f0 = arith.constant 0.0 : f32 | ||
|
|
||
| // CHECK-NEXT: %[[S:.*]] = memref.load %[[MEM]][] : memref<f32> | ||
| // CHECK-NEXT: %[[V:.*]] = vector.broadcast %[[S]] : f32 to vector<f32> | ||
|
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. Where is this broadcast generated? Perhaps that's something that could deleted?
Contributor
Author
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. Because vector::ExtractElementOp requires a vector type input, we need to use vector.broadcast to convert scalars into vectors. We directly use vector::ExtractOp, and even for 0-dimensional vectors, there's no longer a need to perform vector.broadcast. :-)
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. This makes sense, but what code-path generated |
||
| %0 = vector.transfer_read %mem[], %f0 : memref<f32>, vector<f32> | ||
|
|
||
| // CHECK-NEXT: %[[SS:.*]] = vector.extractelement %[[V]][] : vector<f32> | ||
| // CHECK-NEXT: memref.store %[[SS]], %[[MEM]][] : memref<f32> | ||
| // CHECK-NEXT: memref.store %[[S]], %[[MEM]][] : memref<f32> | ||
| vector.transfer_write %0, %mem[] : vector<f32>, memref<f32> | ||
|
|
||
| // CHECK-NEXT: %[[VV:.*]] = vector.extract %arg1[0, 0, 0] : f32 from vector<1x1x1xf32> | ||
| // CHECK-NEXT: memref.store %[[VV]], %[[MEM]][] : memref<f32> | ||
| // CHECK-NEXT: %[[V:.*]] = vector.extract %arg1[0, 0, 0] : f32 from vector<1x1x1xf32> | ||
| // CHECK-NEXT: memref.store %[[V]], %[[MEM]][] : memref<f32> | ||
| vector.store %vec, %mem[] : memref<f32>, vector<1x1x1xf32> | ||
|
|
||
| return | ||
|
|
||
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.
The comment above this pattern needs updating.
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.
Okay, I have already updated it.
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.
The comment is still referring to
vector.extractelement, which your patch gets rid of thevector.extractelementpath.