[Mlir-commits] [mlir] [TOSA] Add pass to sanitize gather/scatter indices (PR #221200)

Luke Hutton llvmlistbot at llvm.org
Mon Sep 7 03:47:53 PDT 2026


================
@@ -199,6 +199,24 @@ def TosaDowngrade1p1To1p0Pass
   }];
 }
 
+def TosaGatherScatterHardeningPass
+    : Pass<"tosa-gather-scatter-hardening", "func::FuncOp"> {
+  let summary = "Clamp TOSA gather and scatter indices to valid bounds";
+  let description = [{
+    Bounds the indices used by each gather and scatter with TOSA minimum and
+    maximum operations so that all accesses are in bounds. When the same
+    indices value is used by several gather or scatter operations that require
+    identical bounds, one bounding sequence is shared by all of them. Other
+    users continue to use the original indices.
+
+    The indexed dimension must be statically known and non-empty.
+  }];
+
+  let dependentDialects = [
+    "tosa::TosaDialect"
----------------
lhutton1 wrote:

nit: no need to list tosa dialect here as it must always be loaded 

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


More information about the Mlir-commits mailing list