[Mlir-commits] [mlir] [MLIR][Linalg] More Linalg named ops (PR #90236)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Apr 26 10:16:01 PDT 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 74a5e7784b32aba5670ff427b158d1e6e38012f1 aba65e39b0b0fa84ef34023a1b2a9d934762c1a7 -- mlir/include/mlir/IR/Builders.h mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp mlir/lib/IR/Builders.cpp
``````````

</details>

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

``````````diff
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 6ee5864656..f648165727 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -395,10 +395,10 @@ public:
       return builder.create<math::FloorOp>(arg.getLoc(), arg);
     case UnaryFn::negf:
       return builder.create<arith::NegFOp>(arg.getLoc(), arg);
-    case UnaryFn::reciprocal:
-    {
+    case UnaryFn::reciprocal: {
       Attribute oneAttr = builder.getNumberAttr(1.0, arg.getType());
-      auto one = builder.create<arith::ConstantOp>(arg.getLoc(), ::cast<TypedAttr>(oneAttr));
+      auto one = builder.create<arith::ConstantOp>(arg.getLoc(),
+                                                   ::cast<TypedAttr>(oneAttr));
       return builder.create<arith::DivFOp>(arg.getLoc(), one, arg);
     }
     case UnaryFn::round:
@@ -407,10 +407,10 @@ public:
       return builder.create<math::SqrtOp>(arg.getLoc(), arg);
     case UnaryFn::rsqrt:
       return builder.create<math::RsqrtOp>(arg.getLoc(), arg);
-    case UnaryFn::square:
-    {
+    case UnaryFn::square: {
       Attribute twoAttr = builder.getNumberAttr(2.0, arg.getType());
-      auto two = builder.create<arith::ConstantOp>(arg.getLoc(), ::cast<TypedAttr>(twoAttr));
+      auto two = builder.create<arith::ConstantOp>(arg.getLoc(),
+                                                   ::cast<TypedAttr>(twoAttr));
       return builder.create<math::PowFOp>(arg.getLoc(), arg, two);
     }
     case UnaryFn::tanh:
diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp
index ae8348c845..8c31da284c 100644
--- a/mlir/lib/IR/Builders.cpp
+++ b/mlir/lib/IR/Builders.cpp
@@ -328,13 +328,9 @@ ArrayAttr Builder::getAffineMapArrayAttr(ArrayRef<AffineMap> values) {
   return getArrayAttr(attrs);
 }
 
-TypedAttr Builder::getZeroAttr(Type type) {
-  return getNumberAttr(0.0, type);
-}
+TypedAttr Builder::getZeroAttr(Type type) { return getNumberAttr(0.0, type); }
 
-TypedAttr Builder::getOneAttr(Type type) {
-  return getNumberAttr(1.0, type);
-}
+TypedAttr Builder::getOneAttr(Type type) { return getNumberAttr(1.0, type); }
 
 TypedAttr Builder::getNumberAttr(double value, Type type) {
   if (llvm::isa<FloatType>(type))
@@ -342,8 +338,8 @@ TypedAttr Builder::getNumberAttr(double value, Type type) {
   if (llvm::isa<IndexType>(type))
     return getIndexAttr(static_cast<int64_t>(value));
   if (llvm::dyn_cast<IntegerType>(type))
-    return getIntegerAttr(type,
-                          APInt(llvm::cast<IntegerType>(type).getWidth(), static_cast<int64_t>(value)));
+    return getIntegerAttr(type, APInt(llvm::cast<IntegerType>(type).getWidth(),
+                                      static_cast<int64_t>(value)));
   if (llvm::isa<RankedTensorType, VectorType>(type)) {
     auto vtType = llvm::cast<ShapedType>(type);
     auto element = getNumberAttr(value, vtType.getElementType());

``````````

</details>


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


More information about the Mlir-commits mailing list