Skip to content

Commit

Permalink
[Flow] Add naming heuristic for possible slow memory copies (iree-org…
Browse files Browse the repository at this point in the history
  • Loading branch information
Groverkss authored Oct 10, 2023
1 parent ba3e6a7 commit 5b92b73
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,24 @@ summarizeDispatchWorkgroupsOp(DispatchWorkgroupsOp regionOp) {
// No cost estimation implemented, skip.
});
});
if (!bestOp)
return "";

if (!bestOp) {
std::string bestSummary = "";
// Check if there is a possible slow memory copy as a dispatch. The current
// heuristic is to check if a dispatch.tensor.store stores a tensor that is
// directly loaded from a dispatch.tensor.load.
regionOp.getWorkgroupBody().walk(
[&](IREE::Flow::DispatchTensorStoreOp storeOp) {
Value input = storeOp.getValue();
if (auto loadOp =
input.getDefiningOp<IREE::Flow::DispatchTensorLoadOp>()) {
bestSummary = "slow_memcpy";
return WalkResult::interrupt();
}
return WalkResult::advance();
});
return bestSummary;
}

std::string bestSummary = "";
TypeSwitch<Operation *>(bestOp)
Expand Down

0 comments on commit 5b92b73

Please sign in to comment.