[Mlir-commits] [mlir] [mlir][Tosa]: Add folder to ReciprocalOp of splat constant inputs (PR #78137)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jan 15 01:56:33 PST 2024
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 c07a1fe7b448a7af72b931440be02bd9d2551138 488ef7211c45be86746c4b38594ed0328f9e0549 -- mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp mlir/lib/Dialect/Tosa/IR/TosaOps.cpp mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp mlir/lib/Dialect/Tosa/Utils/ConversionUtils.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
index fb3cd378f2..45c6c36a12 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
@@ -1050,7 +1050,8 @@ OpFoldResult tosa::ReciprocalOp::fold(FoldAdaptor adaptor) {
auto shapeType = llvm::cast<ShapedType>(getType());
if (auto floatType = llvm::dyn_cast<FloatType>(inputAttr.getElementType())) {
auto floatVal = inputAttr.getSplatValue<APFloat>();
- return DenseElementsAttr::get(shapeType, computeFloatElemOne(floatVal, floatType));
+ return DenseElementsAttr::get(shapeType,
+ computeFloatElemOne(floatVal, floatType));
}
return {};
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index a2af9ef0c0..2389150421 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -1779,7 +1779,8 @@ std::optional<SmallVector<int64_t, 4>> ApplyScaleOp::getShapeForUnroll() {
return std::nullopt;
}
-APFloat tosa::ReciprocalOp::computeFloatElemOne(const APFloat &floatVal, FloatType floatTy) {
+APFloat tosa::ReciprocalOp::computeFloatElemOne(const APFloat &floatVal,
+ FloatType floatTy) {
auto recipAttr = FloatAttr::get(floatTy, 1.0);
APFloat recip = recipAttr.getValue();
recip.divide(floatVal, llvm::APFloat::rmNearestTiesToEven);
``````````
</details>
https://github.com/llvm/llvm-project/pull/78137
More information about the Mlir-commits
mailing list