Skip to content

Commit

Permalink
Update dnnl_thread.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
agramesh1 authored Nov 25, 2024
1 parent a78fe63 commit 209214a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/common/dnnl_thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ static inline void parallel(int nthr, const std::function<void(int, int)> &f) {
#elif DNNL_CPU_THREADING_RUNTIME == DNNL_RUNTIME_THREADPOOL
using namespace dnnl::impl::threadpool_utils;
dnnl::threadpool_interop::threadpool_iface *tp = get_active_threadpool();
dnnl::threadpool_interop::threadpool_iface *tp_null = std::nullptr_t;
if (!tp || dnnl_in_parallel()) {
threadpool_utils::deactivate_threadpool();
for (int ithr = 0; ithr < nthr; ithr++) {
Expand All @@ -341,7 +342,7 @@ static inline void parallel(int nthr, const std::function<void(int, int)> &f) {
& dnnl::threadpool_interop::threadpool_iface::ASYNCHRONOUS;
counting_barrier_t b;
if (async) b.init(nthr);
tp->parallel_for(nthr, [&, tp](int ithr, int nthr) {
tp->parallel_for(nthr, [&, tp_null](int ithr, int nthr) {
bool is_master = threadpool_utils::get_active_threadpool() == tp;
if (!is_master) {
threadpool_utils::activate_threadpool(tp);
Expand Down

0 comments on commit 209214a

Please sign in to comment.