Using tracy::GetQueue instead of the sketchy static variable reference. (#19653)
diff --git a/runtime/src/iree/base/tracing/tracy.cc b/runtime/src/iree/base/tracing/tracy.cc index a38f8c4..a51301a 100644 --- a/runtime/src/iree/base/tracing/tracy.cc +++ b/runtime/src/iree/base/tracing/tracy.cc
@@ -17,7 +17,9 @@ // HACK: tracy doesn't let us at this but we need it in order to create new // queue contexts. It's an implementation detail we have to take a dependency on // because tracy does not have an API for what we're doing (yet). -extern tracy::moodycamel::ConcurrentQueue<tracy::QueueItem> tracy::s_queue; +namespace tracy { +moodycamel::ConcurrentQueue<QueueItem>& GetQueue(); +} // namespace tracy #endif // TRACY_ENABLE && IREE_TRACING_EXPERIMENTAL_CONTEXT_API #ifdef __cplusplus @@ -457,8 +459,8 @@ tracy::ProducerWrapper token; uint32_t thread_id = 0; iree_tracing_context_t() - : token_detail(tracy::s_queue), - token({tracy::s_queue.get_explicit_producer(token_detail)}), + : token_detail(tracy::GetQueue()), + token({tracy::GetQueue().get_explicit_producer(token_detail)}), thread_id(iree_tracing_context_t::next_tracing_thread_id++) { token.ptr->threadId = thread_id; }
diff --git a/runtime/src/iree/base/tracing/tracy.h b/runtime/src/iree/base/tracing/tracy.h index bc6d4ab..1aa0268 100644 --- a/runtime/src/iree/base/tracing/tracy.h +++ b/runtime/src/iree/base/tracing/tracy.h
@@ -351,7 +351,9 @@ // an API for what we're doing. We could propose one and try to get it landed // such that we at least did not need to manually write out structs and manage // the concurrent queues. -#define IREE_TRACING_EXPERIMENTAL_CONTEXT_API 1 +#if !defined(IREE_TRACING_EXPERIMENTAL_CONTEXT_API) +#define IREE_TRACING_EXPERIMENTAL_CONTEXT_API 0 +#endif // !IREE_TRACING_EXPERIMENTAL_CONTEXT_API typedef struct iree_tracing_context_t iree_tracing_context_t; @@ -434,7 +436,7 @@ return NULL; } static inline void iree_tracing_context_free(iree_tracing_context_t* context) {} -void iree_tracing_context_calibrate_executor( +static inline void iree_tracing_context_calibrate_executor( iree_tracing_context_t* context, iree_tracing_executor_id_t executor_id, int64_t cpu_delta, uint64_t host_timestamp, uint64_t executor_timestamp) {} static inline void iree_tracing_context_zone_begin(