Skip to content

Commit

Permalink
remove unused _fence_ events for profiler (microsoft#22403)
Browse files Browse the repository at this point in the history
### Description

The current code to log profiler event "_fence_before" and
"_fence_after" seems to be useless. The measured duration of the 2
events are 0.

Removed them.
  • Loading branch information
fs-eire authored Oct 16, 2024
1 parent c3a94c6 commit b7050c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
11 changes: 0 additions & 11 deletions onnxruntime/core/framework/sequential_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,6 @@ class KernelScope {
if (session_state_.Profiler().IsEnabled()) {
auto& node = kernel.Node();
node_name_ = node.Name().empty() ? MakeString(node.OpType(), "_", node.Index()) : node.Name();
auto& profiler = session_state_.Profiler();
auto sync_time_begin = profiler.Start();
profiler.EndTimeAndRecordEvent(profiling::NODE_EVENT,
node_name_ + "_fence_before",
sync_time_begin,
{{"op_name", kernel_.KernelDef().OpName()}});
concurrency::ThreadPool::StartProfiling(session_state_.GetThreadPool());
VLOGS(session_state_.Logger(), 1) << "Computing kernel: " << node_name_;
kernel_begin_time_ = session_state_.Profiler().Start();
Expand Down Expand Up @@ -381,11 +375,6 @@ class KernelScope {
{"thread_scheduling_stats",
concurrency::ThreadPool::StopProfiling(session_state_.GetThreadPool())},
});
auto sync_time_begin = profiler.Start();
profiler.EndTimeAndRecordEvent(profiling::NODE_EVENT,
node_name_ + "_fence_after",
sync_time_begin,
{{"op_name", kernel_.KernelDef().OpName()}});
}

#ifdef ONNXRUNTIME_ENABLE_INSTRUMENT
Expand Down
4 changes: 2 additions & 2 deletions onnxruntime/test/framework/inference_session_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ TEST(InferenceSessionTests, CheckRunProfilerWithStartProfile) {
while (std::getline(profile, line)) {
if (count == 0) {
ASSERT_TRUE(line.find("[") != string::npos);
} else if (count <= 5) {
} else if (count <= 3) {
for (auto& s : tags) {
ASSERT_TRUE(line.find(s) != string::npos);
}
Expand All @@ -774,7 +774,7 @@ TEST(InferenceSessionTests, CheckRunProfilerWithStartProfile) {
}

if (count == 1) {
ASSERT_TRUE(line.find("mul_1_fence_before") != string::npos);
ASSERT_TRUE(line.find("mul_1_kernel_time") != string::npos);
}
count++;
}
Expand Down

0 comments on commit b7050c8

Please sign in to comment.