diff options
author | Cloud Han <cloudhan@outlook.com> | 2022-01-25 07:35:09 +0300 |
---|---|---|
committer | Cloud Han <cloudhan@outlook.com> | 2022-01-25 07:59:35 +0300 |
commit | f6769ecb910f05fd1e6088a13a207afa0f8cfe28 (patch) | |
tree | bc9acf50d60f4494c1d9ccdb6d9e5ddeacc54e6f /TracyOpenCL.hpp | |
parent | 9b60c4970e90f3d5de8f19c5e60e13d20c070be8 (diff) |
better error discoverability if queue is not created with CL_QUEUE_PROFILING_ENABLE
Diffstat (limited to 'TracyOpenCL.hpp')
-rw-r--r-- | TracyOpenCL.hpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/TracyOpenCL.hpp b/TracyOpenCL.hpp index 4f029686..fb60431c 100644 --- a/TracyOpenCL.hpp +++ b/TracyOpenCL.hpp @@ -154,18 +154,20 @@ namespace tracy { EventInfo eventInfo = GetQuery(m_tail); cl_int eventStatus; cl_int err = clGetEventInfo(eventInfo.event, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(cl_int), &eventStatus, nullptr); - if (err != CL_SUCCESS) { + if (err != CL_SUCCESS) + { std::ostringstream oss; oss << "clGetEventInfo falied with error code " << err << ", on event " << eventInfo.event << ", skipping..."; auto msg = oss.str(); TracyMessage(msg.data(), msg.size()); if (eventInfo.event == nullptr) { - TracyMessageL("A TracyCLZone must be paird with a TracyCLZoneSetEvent, check you code!"); + TracyMessageL("A TracyCLZone must be paird with a TracyCLZoneSetEvent, check your code!"); } assert(false && "clGetEventInfo failed, maybe a TracyCLZone is not paired with TracyCLZoneSetEvent"); continue; } - if (eventStatus != CL_COMPLETE) { + if (eventStatus != CL_COMPLETE) + { if (!blocking) return; TRACY_CL_CHECK_ERROR(clWaitForEvents(1, &eventInfo.event)); @@ -176,7 +178,15 @@ namespace tracy { : CL_PROFILING_COMMAND_END; cl_ulong eventTimeStamp = 0; - TRACY_CL_CHECK_ERROR(clGetEventProfilingInfo(eventInfo.event, eventInfoQuery, sizeof(cl_ulong), &eventTimeStamp, nullptr)); + err = clGetEventProfilingInfo(eventInfo.event, eventInfoQuery, sizeof(cl_ulong), &eventTimeStamp, nullptr); + if (err == CL_PROFILING_INFO_NOT_AVAILABLE) + { + TracyMessageL("command queue is not created with CL_QUEUE_PROFILING_ENABLE flag, check your code!"); + assert(false && "command queue is not created with CL_QUEUE_PROFILING_ENABLE flag"); + } + else + TRACY_CL_CHECK_ERROR(err); + TRACY_CL_ASSERT(eventTimeStamp != 0); auto item = Profiler::QueueSerial(); |