[Mlir-commits] [mlir] [mlir][vector] add support for linearizing vector.bitcast in VectorLinearize (PR #123110)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jan 15 11:22:18 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff ac2165fe7bb4626c85a9c8938dbe2448220217a5 d067a5ab18604996b9290e98701e3d8ac04efe7b --extensions cpp -- mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
index b450ea91fe..a89d2872e2 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
@@ -482,9 +482,11 @@ struct LinearizeVectorBitCast final
return rewriter.notifyMatchFailure(
loc, "Can't flatten since targetBitWidth <= OpSize");
- rewriter.replaceOpWithNewOp<vector::BitCastOp>(castOp, resType, adaptor.getSource());
+ rewriter.replaceOpWithNewOp<vector::BitCastOp>(castOp, resType,
+ adaptor.getSource());
return mlir::success();
}
+
private:
unsigned targetVectorBitWidth;
};
@@ -515,8 +517,7 @@ void mlir::vector::populateVectorLinearizeTypeConversionsAndLegality(
typeConverter.addTargetMaterialization(materializeCast);
target.markUnknownOpDynamicallyLegal(
[=](Operation *op) -> std::optional<bool> {
- if ((isa<arith::ConstantOp>(op) ||
- isa<vector::BitCastOp>(op) ||
+ if ((isa<arith::ConstantOp>(op) || isa<vector::BitCastOp>(op) ||
op->hasTrait<OpTrait::Vectorizable>())) {
return (isLessThanTargetBitWidth(op, targetBitWidth)
? typeConverter.isLegal(op)
@@ -525,8 +526,9 @@ void mlir::vector::populateVectorLinearizeTypeConversionsAndLegality(
return std::nullopt;
});
- patterns.add<LinearizeConstant, LinearizeVectorizable, LinearizeVectorBitCast>(
- typeConverter, patterns.getContext(), targetBitWidth);
+ patterns
+ .add<LinearizeConstant, LinearizeVectorizable, LinearizeVectorBitCast>(
+ typeConverter, patterns.getContext(), targetBitWidth);
}
void mlir::vector::populateVectorLinearizeShuffleLikeOpsPatterns(
``````````
</details>
https://github.com/llvm/llvm-project/pull/123110
More information about the Mlir-commits
mailing list