[Mlir-commits] [mlir] [mlir][tosa] Add error if and level checks for COND_IF & WHILE_LOOP (PR #136194)
TatWai Chong
llvmlistbot at llvm.org
Mon Apr 28 11:08:10 PDT 2025
================
@@ -449,6 +449,39 @@ struct TosaValidation : public tosa::impl::TosaValidationBase<TosaValidation> {
return true;
}
+ // Recursively perform a bottom-up search to determine the maximum nesting
+ // depth, starting from a specific operation and continuing up to the function
+ // or module scope. Tosa nesting_depth starts at 0 and increments by one each
+ // time a new nested `region` is encountered.
+ static void getMaxNestedDepth(Operation *op, int32_t &depth) {
+ if (isa<mlir::func::FuncOp>(op) || isa<ModuleOp>(op))
+ return;
+
+ Block *block = op->getBlock();
+ if (!block)
+ return;
+
+ Region *region = block->getParent();
+ if (!region)
+ return;
+
+ depth++;
+ getMaxNestedDepth(region->getParentOp(), depth);
----------------
tatwaichong wrote:
No. Found out they are they are equivalent. :)
https://github.com/llvm/llvm-project/pull/136194
More information about the Mlir-commits
mailing list