Skip to content

Commit

Permalink
add commit group
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed May 25, 2022
1 parent 9c1126d commit fdcc22b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/tir/transforms/inject_software_pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,8 @@ class PipelineRewriter : public StmtExprMutator {

LOG(INFO) << "start: " << start;
LOG(INFO) << "ordered_stmts_.size(): " << ordered_stmts_.size();
auto commit_group = Evaluate(Call(DataType::Void(), tvm::tir::builtin::ptx_commit_group(), {}));

for (const Block& block : ordered_stmts_) {
int stage = pipeline_info_.at(block).stage;
PrimExpr skewed_loop_var = new_loop_var - stage;
Expand Down Expand Up @@ -566,6 +568,13 @@ class PipelineRewriter : public StmtExprMutator {
stmts.push_back(BlockRealize({}, inbound, new_block));
}

if (pos == PipelinePos::Prologue) {
stmts.push_back(commit_group);
}
if (pos == PipelinePos::Body) {
stmts.insert(stmts.begin() + 2, commit_group);
}

Stmt new_loop{nullptr};

if (stmts.empty()) {
Expand Down

0 comments on commit fdcc22b

Please sign in to comment.