Skip to content

Commit

Permalink
Using tracy::GetQueue instead of the sketchy static variable reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
benvanik committed Jan 10, 2025
1 parent 106371d commit d383319
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions runtime/src/iree/base/tracing/tracy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -457,8 +459,8 @@ struct iree_tracing_context_t {
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;
}
Expand Down
4 changes: 3 additions & 1 deletion runtime/src/iree/base/tracing/tracy.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ void* iree_tracing_obscure_ptr(void* ptr);
// 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;

Expand Down

0 comments on commit d383319

Please sign in to comment.