Skip to content

Commit

Permalink
Timing ops are now fences (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
magnatelee authored Jun 7, 2024
1 parent da717dd commit 5dd0765
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions src/timing/timing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,16 @@ std::int64_t Time::value() const { return impl_->value(); }

Time measure_microseconds()
{
auto runtime = Legion::Runtime::get_runtime();
auto context = Legion::Runtime::get_context();

// Capture the completion of all outstanding ops and pass it as a precondition to the timing op
auto precondition = runtime->issue_execution_fence(context);
auto future = runtime->get_current_time_in_microseconds(context, precondition);

return Time{std::make_shared<Time::Impl>(std::move(future))};
return Time{
std::make_shared<Time::Impl>(Legion::Runtime::get_runtime()->get_current_time_in_microseconds(
Legion::Runtime::get_context()))};
}

Time measure_nanoseconds()
{
auto runtime = Legion::Runtime::get_runtime();
auto context = Legion::Runtime::get_context();

// Capture the completion of all outstanding ops and pass it as a precondition to the timing op
auto precondition = runtime->issue_execution_fence(context);
auto future = runtime->get_current_time_in_nanoseconds(context, precondition);

return Time{std::make_shared<Time::Impl>(std::move(future))};
return Time{
std::make_shared<Time::Impl>(Legion::Runtime::get_runtime()->get_current_time_in_nanoseconds(
Legion::Runtime::get_context()))};
}

} // namespace legate::timing

0 comments on commit 5dd0765

Please sign in to comment.