[Mlir-commits] [mlir] [mlir][linalg] Decompose winograd operators (PR #96183)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jul 11 06:58:18 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 00fd188f3744ce7511ebc41260f3fcf34a80ae6b dc9cda1d05cf2346d829c863bf567c4caac2931c --extensions cpp,h -- mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp mlir/lib/Dialect/Linalg/Transforms/WinogradConv2D.cpp mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/Linalg/Transforms/WinogradConv2D.cpp b/mlir/lib/Dialect/Linalg/Transforms/WinogradConv2D.cpp
index dd2b251e92..184fc9c6b4 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/WinogradConv2D.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/WinogradConv2D.cpp
@@ -39,142 +39,84 @@ namespace {
///
/// The following tables define these constant transformation matrices for
/// F(2 x 2, 3 x 3), F(4 x 4, 3 x 3), and F(2 x 2, 5 x 5)
-constexpr float G_2x2_3x3[] = {
- -1, 0, 0,
- 1./2, -1./2, 1./2,
- 1./2, 1./2, 1./2,
- 0, 0, 1
-};
+constexpr float G_2x2_3x3[] = {-1, 0, 0, 1. / 2, -1. / 2, 1. / 2,
+ 1. / 2, 1. / 2, 1. / 2, 0, 0, 1};
-constexpr float GT_2x2_3x3[] = {
- -1, 1./2, 1./2, 0,
- 0, -1./2, 1./2, 0,
- 0, 1./2, 1./2, 1
-};
+constexpr float GT_2x2_3x3[] = {-1, 1. / 2, 1. / 2, 0, 0, -1. / 2,
+ 1. / 2, 0, 0, 1. / 2, 1. / 2, 1};
-constexpr float BT_2x2_3x3[] = {
- -1, 0, 1, 0,
- 0, -1, 1, 0,
- 0, 1, 1, 0,
- 0, -1, 0, 1
-};
+constexpr float BT_2x2_3x3[] = {-1, 0, 1, 0, 0, -1, 1, 0,
+ 0, 1, 1, 0, 0, -1, 0, 1};
-constexpr float B_2x2_3x3[] = {
- -1, 0, 0, 0,
- 0, -1, 1, -1,
- 1, 1, 1, 0,
- 0, 0, 0, 1
-};
+constexpr float B_2x2_3x3[] = {-1, 0, 0, 0, 0, -1, 1, -1,
+ 1, 1, 1, 0, 0, 0, 0, 1};
-constexpr float AT_2x2_3x3[] = {
- 1, 1, 1, 0,
- 0, -1, 1, 1
-};
+constexpr float AT_2x2_3x3[] = {1, 1, 1, 0, 0, -1, 1, 1};
-constexpr float A_2x2_3x3[] = {
- 1, 0,
- 1, -1,
- 1, 1,
- 0, 1
-};
+constexpr float A_2x2_3x3[] = {1, 0, 1, -1, 1, 1, 0, 1};
-constexpr float G_4x4_3x3[] = {
- 1, 0, 0,
- -1./3, 1./3, -1./3,
- -1./3, -1./3, -1./3,
- 1./12, -1./6, 1./3,
- 1./12, 1./6, 1./3,
- 0, 0, 1
-};
+constexpr float G_4x4_3x3[] = {1, 0, 0, -1. / 3, 1. / 3,
+ -1. / 3, -1. / 3, -1. / 3, -1. / 3, 1. / 12,
+ -1. / 6, 1. / 3, 1. / 12, 1. / 6, 1. / 3,
+ 0, 0, 1};
-constexpr float GT_4x4_3x3[] = {
- 1, -1./3, -1./3, 1./12, 1./12, 0,
- 0, 1./3, -1./3, -1./6, 1./6, 0,
- 0, -1./3, -1./3, 1./3, 1./3, 1
-};
+constexpr float GT_4x4_3x3[] = {1, -1. / 3, -1. / 3, 1. / 12, 1. / 12, 0,
+ 0, 1. / 3, -1. / 3, -1. / 6, 1. / 6, 0,
+ 0, -1. / 3, -1. / 3, 1. / 3, 1. / 3, 1};
constexpr float BT_4x4_3x3[] = {
- 1./4, 0, -5./16, 0, 1./16, 0,
- 0, 1./4, -1./4, -1./16, 1./16, 0,
- 0, -1./4, -1./4, 1./16, 1./16, 0,
- 0, 1./4, -1./8, -1./4, 1./8, 0,
- 0, -1./4, -1./8, 1./4, 1./8, 0,
- 0, 1./4, 0, -5./16, 0, 1./16
-};
+ 1. / 4, 0, -5. / 16, 0, 1. / 16, 0, 0, 1. / 4,
+ -1. / 4, -1. / 16, 1. / 16, 0, 0, -1. / 4, -1. / 4, 1. / 16,
+ 1. / 16, 0, 0, 1. / 4, -1. / 8, -1. / 4, 1. / 8, 0,
+ 0, -1. / 4, -1. / 8, 1. / 4, 1. / 8, 0, 0, 1. / 4,
+ 0, -5. / 16, 0, 1. / 16};
constexpr float B_4x4_3x3[] = {
- 1./4, 0, 0, 0, 0, 0,
- 0, 1./4, -1./4, 1./4, -1./4, 1./4,
- -5./16, -1./4, -1./4, -1./8, -1./8, 0,
- 0, -1./16, 1./16, -1./4, 1./4, -5./16,
- 1./16, 1./16, 1./16, 1./8, 1./8, 0,
- 0, 0, 0, 0, 0, 1./16
-};
+ 1. / 4, 0, 0, 0, 0, 0, 0, 1. / 4,
+ -1. / 4, 1. / 4, -1. / 4, 1. / 4, -5. / 16, -1. / 4, -1. / 4, -1. / 8,
+ -1. / 8, 0, 0, -1. / 16, 1. / 16, -1. / 4, 1. / 4, -5. / 16,
+ 1. / 16, 1. / 16, 1. / 16, 1. / 8, 1. / 8, 0, 0, 0,
+ 0, 0, 0, 1. / 16};
constexpr float AT_4x4_3x3[] = {
- 1./8, 1./4, 1./4, 1./8, 1./8, 0,
- 0, -1./4, 1./4, -1./4, 1./4, 0,
- 0, 1./4, 1./4, 1./2, 1./2, 0,
- 0, -1./4, 1./4, -1, 1, 1./2
-};
+ 1. / 8, 1. / 4, 1. / 4, 1. / 8, 1. / 8, 0, 0, -1. / 4,
+ 1. / 4, -1. / 4, 1. / 4, 0, 0, 1. / 4, 1. / 4, 1. / 2,
+ 1. / 2, 0, 0, -1. / 4, 1. / 4, -1, 1, 1. / 2};
-constexpr float A_4x4_3x3[] = {
- 1./8, 0, 0, 0,
- 1./4, -1./4, 1./4, -1./4,
- 1./4, 1./4, 1./4, 1./4,
- 1./8, -1./4, 1./2, -1,
- 1./8, 1./4, 1./2, 1,
- 0, 0, 0, 1./2
-};
+constexpr float A_4x4_3x3[] = {1. / 8, 0, 0, 0, 1. / 4, -1. / 4,
+ 1. / 4, -1. / 4, 1. / 4, 1. / 4, 1. / 4, 1. / 4,
+ 1. / 8, -1. / 4, 1. / 2, -1, 1. / 8, 1. / 4,
+ 1. / 2, 1, 0, 0, 0, 1. / 2};
constexpr float G_2x2_5x5[] = {
- 1, 0, 0, 0, 0,
- 1./6, -1./6, 1./6, -1./6, 1./6,
- -1./6, -1./6, -1./6, -1./6, -1./6,
--4./15, 2./15, -1./15, 1./30, -1./60,
- 1./60, 1./30, 1./15, 2./15, 4./15,
- 0, 0, 0, 0, 1
-};
+ 1, 0, 0, 0, 0, 1. / 6, -1. / 6, 1. / 6,
+ -1. / 6, 1. / 6, -1. / 6, -1. / 6, -1. / 6, -1. / 6, -1. / 6, -4. / 15,
+ 2. / 15, -1. / 15, 1. / 30, -1. / 60, 1. / 60, 1. / 30, 1. / 15, 2. / 15,
+ 4. / 15, 0, 0, 0, 0, 1};
-constexpr float GT_2x2_5x5[] = {
- 1, 1./6, -1./6, -4./15, 1./60, 0,
- 0, -1./6, -1./6, 2./15, 1./30, 0,
- 0, 1./6, -1./6, -1./15, 1./15, 0,
- 0, -1./6, -1./6, 1./30, 2./15, 0,
- 0, 1./6, -1./6, -1./60, 4./15, 1
-};
+constexpr float GT_2x2_5x5[] = {1, 1. / 6, -1. / 6, -4. / 15, 1. / 60, 0,
+ 0, -1. / 6, -1. / 6, 2. / 15, 1. / 30, 0,
+ 0, 1. / 6, -1. / 6, -1. / 15, 1. / 15, 0,
+ 0, -1. / 6, -1. / 6, 1. / 30, 2. / 15, 0,
+ 0, 1. / 6, -1. / 6, -1. / 60, 4. / 15, 1};
constexpr float BT_2x2_5x5[] = {
- 1./8, 3./16, -1./4, -3./16, 1./8, 0,
- 0, 1./8, 1./16, -5./16, 1./8, 0,
- 0, -1./8, -5./16, -1./16, 1./8, 0,
- 0, 1./4, -1./8, -1./4, 1./8, 0,
- 0, -1./8, -1./4, 1./8, 1./4, 0,
- 0, 1./8, 3./16, -1./4, -3./16, 1./8
-};
+ 1. / 8, 3. / 16, -1. / 4, -3. / 16, 1. / 8, 0, 0, 1. / 8,
+ 1. / 16, -5. / 16, 1. / 8, 0, 0, -1. / 8, -5. / 16, -1. / 16,
+ 1. / 8, 0, 0, 1. / 4, -1. / 8, -1. / 4, 1. / 8, 0,
+ 0, -1. / 8, -1. / 4, 1. / 8, 1. / 4, 0, 0, 1. / 8,
+ 3. / 16, -1. / 4, -3. / 16, 1. / 8};
constexpr float B_2x2_5x5[] = {
- 1./8, 0, 0, 0, 0, 0,
- 3./16, 1./8, -1./8, 1./4, -1./8, 1./8,
- -1./4, 1./16, -5./16, -1./8, -1./4, 3./16,
- -3./16, -5./16, -1./16, -1./4, 1./8, -1./4,
- 1./8, 1./8, 1./8, 1./8, 1./4, -3./16,
- 0, 0, 0, 0, 0, 1./8
-};
+ 1. / 8, 0, 0, 0, 0, 0, 3. / 16, 1. / 8,
+ -1. / 8, 1. / 4, -1. / 8, 1. / 8, -1. / 4, 1. / 16, -5. / 16, -1. / 8,
+ -1. / 4, 3. / 16, -3. / 16, -5. / 16, -1. / 16, -1. / 4, 1. / 8, -1. / 4,
+ 1. / 8, 1. / 8, 1. / 8, 1. / 8, 1. / 4, -3. / 16, 0, 0,
+ 0, 0, 0, 1. / 8};
-constexpr float AT_2x2_5x5[] = {
- 1./2, 1, 1, 2, 1, 0,
- 0, -1, 1, -1, 2, 1./2
-};
+constexpr float AT_2x2_5x5[] = {1. / 2, 1, 1, 2, 1, 0, 0, -1, 1, -1, 2, 1. / 2};
-constexpr float A_2x2_5x5[] = {
- 1./2, 0,
- 1, -1,
- 1, 1,
- 2, -1,
- 1, 2,
- 0, 1./2
-};
+constexpr float A_2x2_5x5[] = {1. / 2, 0, 1, -1, 1, 1, 2, -1, 1, 2, 0, 1. / 2};
// clang-format on
using TransformMapKeyTy = std::pair<int, int>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/96183
More information about the Mlir-commits
mailing list