Skip to content

Commit

Permalink
[Async] Fix ClearListStmt metadata (taichi-dev#1873)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanming-hu authored Sep 15, 2020
1 parent 2cc50cf commit edb8ed7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
5 changes: 1 addition & 4 deletions misc/visualize_state_flow_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ def bar():


def test_fusion():
ti.init(arch=ti.cpu,
async_mode=True,
async_opt_listgen=False,
async_opt_intermediate_file="fusion")
ti.init(arch=ti.cpu, async_mode=True, async_opt_intermediate_file="fusion")

x = ti.field(ti.i32)
y = ti.field(ti.i32)
Expand Down
13 changes: 3 additions & 10 deletions taichi/program/async_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ TaskMeta *get_task_meta(IRBank *ir_bank, const TaskLaunchRecord &t) {
}
}
}
if (auto clear_list = stmt->cast<ClearListStmt>()) {
meta.output_states.emplace(clear_list->snode, AsyncState::Type::list);
}
return false;
});
if (root_stmt->task_type == OffloadedStmt::listgen) {
Expand All @@ -345,16 +348,6 @@ TaskMeta *get_task_meta(IRBank *ir_bank, const TaskLaunchRecord &t) {
meta.input_states.emplace(root_stmt->snode, AsyncState::Type::list);
}

if (is_clear_list_task(root_stmt)) {
// ClearList completely erases the element list, so its output list state
// does NOT lead to a input state flow on the previous version of the list
// state. However, a dependency edge (instead of flow edge) will still be
// inserted since this is probably a WAR dependency.
// TODO: or might be WAW? Do we even need to distinguish WAW and WAR?

meta.output_states.emplace(get_snode_in_clear_list_task(root_stmt),
AsyncState::Type::list);
}
meta_bank[t.ir_handle] = meta;
return &meta_bank[t.ir_handle];
}
Expand Down

0 comments on commit edb8ed7

Please sign in to comment.