From 6c6c6caef07f18727bdb502cd80102d16cefd070 Mon Sep 17 00:00:00 2001 From: John Lynch Date: Wed, 20 Jan 2021 19:14:31 -0600 Subject: [PATCH 1/2] In OpenCLCtxScope::SetEvent, the necessary clRetainEvent call was inside an assert, thus never called if NDEBUG was defined. This change asserts only on the return value of the function, as in other parts of the code. --- TracyOpenCL.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TracyOpenCL.hpp b/TracyOpenCL.hpp index 8f344c91..94aa1162 100644 --- a/TracyOpenCL.hpp +++ b/TracyOpenCL.hpp @@ -261,7 +261,8 @@ namespace tracy { tracy_force_inline void SetEvent(cl_event event) { m_event = event; - assert(clRetainEvent(m_event) == CL_SUCCESS); + cl_int err = clRetainEvent(m_event); + assert(err == CL_SUCCESS); m_ctx->GetQuery(m_beginQueryId).event = m_event; } From 9df369ecc478e50d0e1dba54b244504eace47ad5 Mon Sep 17 00:00:00 2001 From: John Lynch Date: Thu, 21 Jan 2021 12:27:26 -0600 Subject: [PATCH 2/2] Move call to clRetainEvent outside of assert within OpenCLCtx::collect, ensuring it is still called when NDEBUG is defined. --- TracyOpenCL.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TracyOpenCL.hpp b/TracyOpenCL.hpp index 94aa1162..6190f802 100644 --- a/TracyOpenCL.hpp +++ b/TracyOpenCL.hpp @@ -125,7 +125,8 @@ namespace tracy { if (eventInfo.phase == EventPhase::End) { // Done with the event, so release it - assert(clReleaseEvent(event) == CL_SUCCESS); + err = clReleaseEvent(event); + assert(err == CL_SUCCESS); } m_tail = (m_tail + 1) % QueryCount;