From 453d0c87b555afcce8797b8a63e155aa8f92a020 Mon Sep 17 00:00:00 2001 From: Tianqi Chen Date: Sun, 5 Jan 2020 21:39:33 -0800 Subject: [PATCH] [REFACTOR][IR] Introduce SeqStmt to replace ir::Block (#4627) * [REFACTOR][IR] Introduce SeqStmt to replace Block ir::Block was used to represent a sequence of Stmts in the original low-level IR. The nested ir::Block structure is not really friendly for recursive visits, especially when the statements are unrolled. This PR introduce a SeqStmt that directly stores a sequence of statements in an Array container. The new SeqStmt will be used as a replacement of the original Block structure. * [REFACTOR] Migrate use of Block to SeqStmt. * [REFACTOR] Remove Block * Add more comments per yizhi's comment --- python/vta/ir_pass.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/vta/ir_pass.py b/python/vta/ir_pass.py index 12ef7daac731..dbce9a7b9102 100644 --- a/python/vta/ir_pass.py +++ b/python/vta/ir_pass.py @@ -135,7 +135,7 @@ def _do_fold(stmt): if body == stmt.body: return stmt ends = list(reversed(ends)) - body = tvm.make.stmt_seq(*(begins + [body] + ends)) + body = tvm.stmt.stmt_seq(*(begins + [body] + ends)) return tvm.make.AttrStmt( stmt.node, stmt.attr_key, stmt.value, body) return None @@ -307,7 +307,7 @@ def _do_fold(stmt): success[0] = True sync = tvm.make.Call( "int32", "vta.coproc_sync", [], tvm.expr.Call.Intrinsic, None, 0) - return tvm.make.Block(stmt.body, tvm.make.Evaluate(sync)) + return tvm.stmt.SeqStmt([stmt.body, tvm.make.Evaluate(sync)]) if _match_pragma(stmt, "trim_loop"): op = stmt.body assert isinstance(op, tvm.stmt.For)