Skip to content

[Transform][Vector] Support vector methods in the new llvm version #286

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

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/gc/Transforms/LowerToTileVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,7 @@ struct LowerToTileVectorPass
// transpose or braodcast semantic etc.
vector::populateVectorTransferPermutationMapLoweringPatterns(secondPattern);
// Remove unnessary broadcast operation
// TODO: disable this pattern until the following support is ready
// vector::populateSinkVectorBroadcastPatterns(secondPattern);
vector::populateSinkVectorOpsPatterns(secondPattern);
// Second fold (with the help of the `applyPatternsAndFoldGreedily`
// function) can help us to eliminate redundant operation like consecutive
// read and write.
Expand Down
5 changes: 2 additions & 3 deletions test/mlir/test/gc/Transforms/vectorization.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ func.func @add_tensor_test1(%arg0: tensor<4x8x16xf32>, %arg1: tensor<4x8x16xf32>
// CHECK: %[[C0:.*]] = arith.constant 0 : index
// CHECK: %[[READ0:.*]] = vector.transfer_read %{{.*}} {in_bounds = [true, true, true]} : tensor<4x16x16xf32>, vector<4x16x16xf32>
// CHECK: %[[SHAPECAST0:.*]] = vector.shape_cast %[[READ0]] : vector<4x16x16xf32> to vector<4x4x4x4x4xf32>
// CHECK: %[[TRANSPOSE0:.*]] = vector.transpose %[[SHAPECAST0]], [1, 0, 3, 2, 4] : vector<4x4x4x4x4xf32> to vector<4x4x4x4x4xf32>
// CHECK: %[[READ1:.*]] = vector.transfer_read %{{.*}} {in_bounds = [true, true, true]} : tensor<4x16x16xf32>, vector<4x16x16xf32>
// CHECK: %[[SHAPECAST1:.*]] = vector.shape_cast %[[READ1]] : vector<4x16x16xf32> to vector<4x4x4x4x4xf32>
// CHECK: %[[TRANSPOSE1:.*]] = vector.transpose %[[SHAPECAST1]], [1, 0, 3, 2, 4] : vector<4x4x4x4x4xf32> to vector<4x4x4x4x4xf32>
// CHECK: %[[EMPTY:.*]] = tensor.empty() : tensor<4x4x4x4x4xf32>
// CHECK: %[[ADD0:.*]] = arith.addf %[[TRANSPOSE0]], %[[TRANSPOSE1]] : vector<4x4x4x4x4xf32>
// CHECK: %[[ADD0:.*]] = arith.addf %[[SHAPECAST0]], %[[SHAPECAST1]] : vector<4x4x4x4x4xf32>
// CHECK: %[[TRANSPOSE1:.*]] = vector.transpose %[[ADD0]], [1, 0, 3, 2, 4] : vector<4x4x4x4x4xf32> to vector<4x4x4x4x4xf32>
// CHECK: %[[WRITE0:.*]] = vector.transfer_write %{{.*}} {in_bounds = [true, true, true, true, true]} : vector<4x4x4x4x4xf32>, tensor<4x4x4x4x4xf32>
func.func @add_tensor_pack_test2(%arg0: tensor<4x16x16xf32>, %arg1: tensor<4x16x16xf32>) -> tensor<4x4x4x4x4xf32> {
%0 = tensor.empty() : tensor<4x4x4x4x4xf32>
Expand Down