[Mlir-commits] [mlir] [mlir][tosa] Convert group tosa::Conv2DOp to linalg conv (PR #108192)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Sep 11 04:40:40 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r 1e3a24d2e4eb63c17b962161ae6588d1b2c178f8...2cf503fd4b0cbd6ec7312c7d3a612def34ff06a2 mlir/python/mlir/dialects/linalg/opdsl/ops/core_named_ops.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- core_named_ops.py	2024-09-11 11:33:35.000000 +0000
+++ core_named_ops.py	2024-09-11 11:40:10.814904 +0000
@@ -949,10 +949,11 @@
     domain(D.n, D.g, D.fg, D.oh, D.ow, D.c, D.kh, D.kw)
     O[D.n, D.g, D.fg, D.oh, D.ow] += TypeFn.cast_signed(
         U, I[D.n, D.g, D.c, D.oh * S.SH + D.kh * S.DH, D.ow * S.SW + D.kw * S.DW]
     ) * TypeFn.cast_signed(U, K[D.g, D.fg, D.c, D.kh, D.kw])
 
+
 @linalg_structured_op
 def conv_2d_nhwgc_gfhwc(
     I=TensorDef(
         T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.G, S.C
     ),
@@ -973,10 +974,11 @@
     implements(ConvolutionOpInterface)
     domain(D.n, D.oh, D.ow, D.g, D.fg, D.kh, D.kw, D.c)
     O[D.n, D.oh, D.ow, D.g, D.fg] += TypeFn.cast_signed(
         U, I[D.n, D.oh * S.SH + D.kh * S.DH, D.ow * S.SW + D.kw * S.DW, D.g, D.c]
     ) * TypeFn.cast_signed(U, K[D.g, D.fg, D.kh, D.kw, D.c])
+
 
 @linalg_structured_op
 def conv_2d_nhwgc_gfhwc_q(
     I=TensorDef(
         T1, S.N, S.OH * S.SH + S.KH * S.DH, S.OW * S.SW + S.KW * S.DW, S.G, S.C
@@ -998,14 +1000,19 @@
     them to the same data type as the accumulator/output. This includes the zero
     point offsets common to quantized operations.
     """
     implements(ConvolutionOpInterface)
     domain(D.n, D.oh, D.ow, D.g, D.fg, D.kh, D.kw, D.c)
-    O[D.n, D.oh, D.ow, D.g, D.fg] += (TypeFn.cast_signed(
-        U, I[D.n, D.oh * S.SH + D.kh * S.DH, D.ow * S.SW + D.kw * S.DW, D.g, D.c]
-        ) - TypeFn.cast_signed(U, IZp) 
-    ) * (TypeFn.cast_signed(U, K[D.g, D.fg, D.kh, D.kw, D.c]) - TypeFn.cast_signed(U, KZp))
+    O[D.n, D.oh, D.ow, D.g, D.fg] += (
+        TypeFn.cast_signed(
+            U, I[D.n, D.oh * S.SH + D.kh * S.DH, D.ow * S.SW + D.kw * S.DW, D.g, D.c]
+        )
+        - TypeFn.cast_signed(U, IZp)
+    ) * (
+        TypeFn.cast_signed(U, K[D.g, D.fg, D.kh, D.kw, D.c])
+        - TypeFn.cast_signed(U, KZp)
+    )
 
 
 @linalg_structured_op
 def conv_2d_ngchw_gfchw_q(
     I=TensorDef(

``````````

</details>


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


More information about the Mlir-commits mailing list