[Mlir-commits] [mlir] [mlir][tosa] Always generated pad_const and remove input_zp attr for PadOp (PR #129336)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Feb 28 15:21:33 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 a36a67c79afaa1fdd0dbe0440ec852fd4eb3a532 91f7b7b695093878be9237d86ea6a4e8dcc39550 --extensions cpp,h -- mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp mlir/lib/Dialect/Tosa/IR/TosaOps.cpp mlir/lib/Dialect/Tosa/Transforms/TosaDecomposeTransposeConv.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h
index f0797f97fd..7b46d005c2 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.h
@@ -170,7 +170,7 @@ std::optional<Value> createZeroPointTensor(OpBuilder &builder, Location loc,
 
 // Create a pad-const const tensor with value of `val` of required data-type
 std::optional<Value> createPadConstTensor(OpBuilder &builder, Location loc,
-  Value src, int32_t val = 0);
+                                          Value src, int32_t val = 0);
 
 } // namespace tosa
 } // namespace mlir
diff --git a/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp b/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp
index 6a65904272..6a39b61497 100644
--- a/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp
+++ b/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp
@@ -355,7 +355,7 @@ public:
     // Setup the default constantAttr.
 
     Value padConstant = rewriter.createOrFold<tensor::ExtractOp>(
-      loc, padOp.getPadConst(), ValueRange({}));
+        loc, padOp.getPadConst(), ValueRange({}));
 
     if (!padConstant) {
       return rewriter.notifyMatchFailure(
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaDecomposeTransposeConv.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaDecomposeTransposeConv.cpp
index b629c3e7df..c099239a64 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaDecomposeTransposeConv.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaDecomposeTransposeConv.cpp
@@ -154,7 +154,7 @@ public:
         createPadConstTensor(builder, op->getLoc(), input, inputZpVal).value();
     Value const weightPadConst =
         createPadConstTensor(builder, op->getLoc(), input, weightZpVal).value();
-    
+
     weight = CreateOpAndInferShape<tosa::PadOp>(
         rewriter, loc, UnrankedTensorType::get(weightETy), weight,
         weightPaddingVal, weightPadConst);
@@ -169,7 +169,6 @@ public:
         stride[0],      weightWidth / stride[1],
         stride[1],      inputChannels};
 
-
     weight = CreateOpAndInferShape<tosa::ReshapeOp>(
         builder, UnrankedTensorType::get(weightETy), weight,
         getTosaConstShape(rewriter, loc, weightReshapeDims0));

``````````

</details>


https://github.com/llvm/llvm-project/pull/129336


More information about the Mlir-commits mailing list