Skip to content

Commit

Permalink
[async] Add option async_opt_fusion_max_iter (#2170)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanming-hu authored Jan 24, 2021
1 parent 1b73055 commit 6779e0d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions taichi/program/async_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,14 @@ void AsyncEngine::flush() {
}
sfg->verify();
if (program->config.async_opt_fusion) {
while (sfg->fuse()) {
debug_sfg("fuse");
modified = true;
auto max_iter = program->config.async_opt_fusion_max_iter;
for (int iter = 0; max_iter == 0 || iter < max_iter; iter++) {
if (sfg->fuse()) {
debug_sfg("fuse");
modified = true;
} else {
break;
}
}
}
sfg->verify();
Expand Down
1 change: 1 addition & 0 deletions taichi/program/compile_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct CompileConfig {
// Async options
int async_opt_passes{3};
bool async_opt_fusion{true};
int async_opt_fusion_max_iter{0}; // 0 means unlimited
bool async_opt_listgen{true};
bool async_opt_activation_demotion{true};
bool async_opt_dse{true};
Expand Down
2 changes: 2 additions & 0 deletions taichi/python/export_lang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ void export_lang(py::module &m) {
.def_readwrite("cc_link_cmd", &CompileConfig::cc_link_cmd)
.def_readwrite("async_opt_passes", &CompileConfig::async_opt_passes)
.def_readwrite("async_opt_fusion", &CompileConfig::async_opt_fusion)
.def_readwrite("async_opt_fusion_max_iter",
&CompileConfig::async_opt_fusion_max_iter)
.def_readwrite("async_opt_listgen", &CompileConfig::async_opt_listgen)
.def_readwrite("async_opt_activation_demotion",
&CompileConfig::async_opt_activation_demotion)
Expand Down

0 comments on commit 6779e0d

Please sign in to comment.