[Mlir-commits] [mlir] [mlir][tosa] Add pass to assign static input shape to TOSA functions (PR #171156)

Sayan Saha llvmlistbot at llvm.org
Wed Dec 10 04:56:39 PST 2025


================
@@ -198,4 +198,26 @@ def TosaNarrowI64ToI32Pass : Pass<"tosa-narrow-i64-to-i32", "func::FuncOp"> {
   ];
 }
 
+def TosaInputShape : Pass<"tosa-experimental-input-shape", "func::FuncOp"> {
+  let summary = "Override dynamic function arguments to specified static shapes.";
+  let description = [{
+    Pass that overrides the dynamic input shapes of function arguments to
+    specified static shapes. If a specified static shape conflicts with the
+    static dimensions in an original input shape, an error is reported.
+  }];
+
+  let constructor = "tosa::createTosaInputShapePass()";
+  let dependentDialects = [
+    "func::FuncDialect",
+    "tensor::TensorDialect",
+    "tosa::TosaDialect",
----------------
sahas3 wrote:

Based on https://mlir.llvm.org/getting_started/Faq/#registered-loaded-dependent-whats-up-with-dialects-management my understanding is that `dependentDialects` only needs to specify any new dialect that the pass is introducing. If a pass is expected to run on a certain dialect, in this case `tosa`, it's not needed to be specified in `dependentDialects`. This will result in an assertion if the pass is ever run on any IR that doesn't contain any `tosa` op.

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


More information about the Mlir-commits mailing list