Skip to content

Commit

Permalink
[REFACTOR][IR] Introduce SeqStmt to replace ir::Block (apache#4627)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
tqchen authored Jan 6, 2020
1 parent 80f518a commit 453d0c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/vta/ir_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 453d0c8

Please sign in to comment.