From 21b748ac846eba0466db3eec8a08d51d194bedfd Mon Sep 17 00:00:00 2001 From: Cloud Han Date: Tue, 25 Jan 2022 11:54:35 +0800 Subject: [PATCH] add back non-blocking collect --- TracyOpenCL.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/TracyOpenCL.hpp b/TracyOpenCL.hpp index e4b70ca6..4f029686 100644 --- a/TracyOpenCL.hpp +++ b/TracyOpenCL.hpp @@ -21,6 +21,7 @@ #define TracyCLZoneSetEvent(e) #define TracyCLCollect(c) +#define TracyCLBlockingCollect(c) namespace tracy { @@ -135,7 +136,7 @@ namespace tracy { Profiler::QueueSerialFinish(); } - void Collect() + void Collect(bool blocking) { ZoneScopedC(Color::Red4); @@ -165,6 +166,8 @@ namespace tracy { continue; } if (eventStatus != CL_COMPLETE) { + if (!blocking) + return; TRACY_CL_CHECK_ERROR(clWaitForEvents(1, &eventInfo.event)); } @@ -346,7 +349,8 @@ using TracyCLCtx = tracy::OpenCLCtx*; #define TracyCLNamedZoneSetEvent(varname, event) varname.SetEvent(event) #define TracyCLZoneSetEvent(event) __tracy_gpu_zone.SetEvent(event) -#define TracyCLCollect(ctx) ctx->Collect() +#define TracyCLCollect(ctx) ctx->Collect(/*blocking=*/false) +#define TracyCLBlockingCollect(ctx) ctx->Collect(/*blocking=*/true) #endif