[Mlir-commits] [mlir] [mlir][tosa] Add several level checks (PR #128074)

Luke Hutton llvmlistbot at llvm.org
Thu Feb 27 01:52:01 PST 2025


================
@@ -137,107 +142,188 @@ struct TosaValidation : public tosa::impl::TosaValidationBase<TosaValidation> {
     return true;
   }
 
-  bool levelCheckRank(Operation *op, const Value &v,
-                      const std::string &checkDesc) {
+  bool levelCheckListSize(Operation *op, int32_t v,
+                          const std::string &checkDesc) {
+    if (v > tosaLevel.MAX_TENSOR_LIST_SIZE) {
+      op->emitOpError() << "failed level check for MAX_TENSOR_LIST_SIZE: "
+                        << checkDesc;
+      return false;
+    }
+    return true;
+  }
+
+  bool levelCheckRankAndSizes(Operation *op, const Value &v,
+                              const std::string &operandOrResult,
----------------
lhutton1 wrote:

nit: Would it be better to use `llvm::StringRef` for passing strings? (Same for `levelCheckListSize` above)

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


More information about the Mlir-commits mailing list