[Mlir-commits] [mlir] [MLIR][LINALG] Add more specialize patterns (PR #91153)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun May 5 16:28:29 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 2aaec48d883b2550f053dc5c07b2400d725e77b5 468bdd0a08fa3afb03eb388ba938d5fac9f9f591 -- mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp
``````````

</details>

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

``````````diff
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
index e6611e496a..34093a2215 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
@@ -76,14 +76,14 @@ bool linalg::isaCopyOpInterface(LinalgOp linalgOp) {
 bool linalg::isaFillOpInterface(GenericOp genericOp) {
   // Structural.
   if (genericOp.getNumParallelLoops() != genericOp.getNumLoops())
-     return false;
+    return false;
 
   if (genericOp.getNumDpsInputs() != 1 || genericOp.getNumDpsInits() != 1)
     return false;
 
   // Input should be referenced and init should not.
   if (!genericOp.payloadUsesValueFromOperand(genericOp.getDpsInputOperand(0)) ||
-       genericOp.payloadUsesValueFromOperand(genericOp.getDpsInitOperand(0)))
+      genericOp.payloadUsesValueFromOperand(genericOp.getDpsInitOperand(0)))
     return false;
 
   OpOperand *value = genericOp.getDpsInputOperand(0);
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp
index d378228728..69e5fa791d 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp
@@ -12,9 +12,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/Linalg/IR/Linalg.h"
-#include "mlir/Dialect/Math/IR/Math.h"
 #include "mlir/Dialect/Linalg/IR/LinalgInterfaces.h"
 #include "mlir/Dialect/Linalg/Transforms/Transforms.h"
+#include "mlir/Dialect/Math/IR/Math.h"
 #include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "linalg-specialization"
@@ -26,10 +26,9 @@
       ValueRange{genericOp.getDpsInits()[0]}))
 
 #define REPLACE_UNARY_OP(NEWOP)                                                \
-  (rewriter.replaceOpWithNewOp<NEWOP>(                                         \
-      genericOp,                                                               \
-      ValueRange{genericOp.getDpsInputs()[0]},                                 \
-      ValueRange{genericOp.getDpsInits()[0]}))
+  (rewriter.replaceOpWithNewOp<NEWOP>(genericOp,                               \
+                                      ValueRange{genericOp.getDpsInputs()[0]}, \
+                                      ValueRange{genericOp.getDpsInits()[0]}))
 
 using namespace mlir;
 using namespace mlir::linalg;

``````````

</details>


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


More information about the Mlir-commits mailing list