From c9fb07ffe57372f982dccd368a649c96effc880b Mon Sep 17 00:00:00 2001 From: Cloud Han Date: Fri, 28 Jan 2022 11:55:42 +0800 Subject: [PATCH] remove blocking collect --- TracyOpenCL.hpp | 13 +++---------- examples/OpenCLVectorAdd/OpenCLVectorAdd.cpp | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/TracyOpenCL.hpp b/TracyOpenCL.hpp index fb60431c..d477158d 100644 --- a/TracyOpenCL.hpp +++ b/TracyOpenCL.hpp @@ -21,7 +21,6 @@ #define TracyCLZoneSetEvent(e) #define TracyCLCollect(c) -#define TracyCLBlockingCollect(c) namespace tracy { @@ -136,7 +135,7 @@ namespace tracy { Profiler::QueueSerialFinish(); } - void Collect(bool blocking) + void Collect() { ZoneScopedC(Color::Red4); @@ -166,12 +165,7 @@ namespace tracy { assert(false && "clGetEventInfo failed, maybe a TracyCLZone is not paired with TracyCLZoneSetEvent"); continue; } - if (eventStatus != CL_COMPLETE) - { - if (!blocking) - return; - TRACY_CL_CHECK_ERROR(clWaitForEvents(1, &eventInfo.event)); - } + if (eventStatus != CL_COMPLETE) return; cl_int eventInfoQuery = (eventInfo.phase == EventPhase::Begin) ? CL_PROFILING_COMMAND_START @@ -359,8 +353,7 @@ using TracyCLCtx = tracy::OpenCLCtx*; #define TracyCLNamedZoneSetEvent(varname, event) varname.SetEvent(event) #define TracyCLZoneSetEvent(event) __tracy_gpu_zone.SetEvent(event) -#define TracyCLCollect(ctx) ctx->Collect(/*blocking=*/false) -#define TracyCLBlockingCollect(ctx) ctx->Collect(/*blocking=*/true) +#define TracyCLCollect(ctx) ctx->Collect() #endif diff --git a/examples/OpenCLVectorAdd/OpenCLVectorAdd.cpp b/examples/OpenCLVectorAdd/OpenCLVectorAdd.cpp index ce5adece..a2560eae 100644 --- a/examples/OpenCLVectorAdd/OpenCLVectorAdd.cpp +++ b/examples/OpenCLVectorAdd/OpenCLVectorAdd.cpp @@ -200,8 +200,8 @@ int main() }) / (durations.size() - 1.0f); std::cout << "VectorAdd runtime avg: " << avg << "us, std: " << sqrt(stddev2) << "us over " << numLaunchs << " runs." << std::endl; - // Use blocking collect will ensure all queued events is finished - TracyCLBlockingCollect(tracyCLCtx); + // User should ensure all events are finished, in this case, collect after the clFinish will do the trick. + TracyCLCollect(tracyCLCtx); { ZoneScopedN("Checking results");