From b7050c83909e6a99e0930728658ec2377cf86af9 Mon Sep 17 00:00:00 2001 From: Yulong Wang <7679871+fs-eire@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:38:32 -0700 Subject: [PATCH] remove unused _fence_ events for profiler (#22403) ### 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. --- onnxruntime/core/framework/sequential_executor.cc | 11 ----------- onnxruntime/test/framework/inference_session_test.cc | 4 ++-- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/onnxruntime/core/framework/sequential_executor.cc b/onnxruntime/core/framework/sequential_executor.cc index aa762ca32fdb4..6ea12c7f3336b 100644 --- a/onnxruntime/core/framework/sequential_executor.cc +++ b/onnxruntime/core/framework/sequential_executor.cc @@ -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(); @@ -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 diff --git a/onnxruntime/test/framework/inference_session_test.cc b/onnxruntime/test/framework/inference_session_test.cc index 8b230db351edc..61a8f7e23fe87 100644 --- a/onnxruntime/test/framework/inference_session_test.cc +++ b/onnxruntime/test/framework/inference_session_test.cc @@ -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); } @@ -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++; }