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.
This commit is contained in:
Yulong Wang 2024-10-16 13:38:32 -07:00 committed by GitHub
parent c3a94c6c5f
commit b7050c8390
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 13 deletions

View file

@ -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

View file

@ -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++;
}