Skip to content

Commit 813b307

Browse files
committed
Print the warning only if tracing enabled
1 parent 6450892 commit 813b307

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

sycl/source/detail/scheduler/scheduler.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <detail/stream_impl.hpp>
1515

1616
#include <chrono>
17-
#include <iostream>
17+
#include <cstdio>
1818
#include <memory>
1919
#include <mutex>
2020
#include <set>
@@ -294,12 +294,15 @@ Scheduler::~Scheduler() {
294294
// resources are released only if one of the listed sync points was used for
295295
// the kernel. Otherwise resources for stream will not be released, issue a
296296
// warning in this case.
297-
std::lock_guard<std::mutex> lock(StreamBuffersPoolMutex);
298-
if (!StreamBuffersPool.empty())
299-
std::cerr
300-
<< "\nWARNING: Some commands may have not finished the execution and "
301-
"not all resources were released. Please be sure that all kernels "
302-
"have synchronization points.\n\n";
297+
if (pi::trace(pi::TraceLevel::PI_TRACE_BASIC)) {
298+
std::lock_guard<std::mutex> lock(StreamBuffersPoolMutex);
299+
if (!StreamBuffersPool.empty())
300+
fprintf(
301+
stderr,
302+
"\nWARNING: Some commands may have not finished the execution and "
303+
"not all resources were released. Please be sure that all kernels "
304+
"have synchronization points.\n\n");
305+
}
303306
}
304307

305308
void Scheduler::lockSharedTimedMutex(

0 commit comments

Comments
 (0)