[Mlir-commits] [mlir] [mlir][tosa] Update PadOp examples in the dialect description (PR #131919)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Mar 18 14:21:53 PDT 2025


https://github.com/Jerry-Ge created https://github.com/llvm/llvm-project/pull/131919

* pad_const is now required for tosa.pad op after PR#129336
* updated the examples in the dialect description section to reflect this change.

>From f84321fe28999e41a90079c7cebc56a4002230bd Mon Sep 17 00:00:00 2001
From: Jerry Ge <jerry.ge at arm.com>
Date: Tue, 18 Mar 2025 13:59:50 -0700
Subject: [PATCH] [mlir][tosa] Update PadOp examples in the dialect description

* pad_const is now required for tosa.pad op after PR#129336
* updated the examples in the dialect description section to reflect
  this change.

Signed-off-by: Jerry Ge <jerry.ge at arm.com>
---
 mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index 0c99dd6130c2a..4301ee5a583b7 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -1910,15 +1910,17 @@ def Tosa_PadOp : Tosa_InferShapedTypeOp<"pad"> {
     Example:
 
     ```mlir
-    %0 = tosa.const_shape { value = dense<[1, 2, 3, 4]> : tensor<4xindex> } : () -> !tosa.shape<4>
-    tosa.pad %arg0, %0 : (tensor<1x2xf32>, !tosa.shape<4>)  -> (tensor<4x9xf32>)
+    %pad_const = "tosa.const"() {values = dense<3.14> : tensor<1xf32>} : () -> tensor<1xf32>
+    %padding = tosa.const_shape {values = dense<[1, 2, 3, 4]> : tensor<4xindex> } : () -> !tosa.shape<4>
+    tosa.pad %arg0, %padding, %pad_const: (tensor<1x2xf32>, !tosa.shape<4>, tensor<1xf32>)  -> (tensor<4x9xf32>)
     ```
 
     Example 2:
 
     ```mlir
-    %0 = tosa.const_shape { value = dense<[-1, 2, 3, 4]> : tensor<4xindex> } : () -> !tosa.shape<4>
-    tosa.pad %arg0, %0 : (tensor<1x2xf32>, !tosa.shape<4>)  -> (tensor<?x9xf32>)
+    %pad_const = "tosa.const"() {values = dense<3.14> : tensor<1xf32>} : () -> tensor<1xf32>
+    %padding = tosa.const_shape {values = dense<[-1, 2, 3, 4]> : tensor<4xindex> } : () -> !tosa.shape<4>
+    tosa.pad %arg0, %padding, %pad_const : (tensor<1x2xf32>, !tosa.shape<4>, tensor<1xf32>)  -> (tensor<?x9xf32>)
     ```
   }];
 



More information about the Mlir-commits mailing list