[Mesa-dev] [RFC PATCH] clover: Return correct CL_EVENT_REFERENCE_COUNT

Vedran Miletić vedran at miletic.net
Fri Dec 16 17:48:53 UTC 2016


Current implementation of event handling keeps an extra reference to
the hardware event, in addition to the reference returned via the OpenCL
API. This additional reference is internal and should not be counted
when queried via the clGetEventInfo() function.

Fixes Piglit's cl/api/retain_release-event test.

Signed-off-by: Vedran Miletić <vedran at miletic.net>
---
 src/gallium/state_trackers/clover/api/event.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/clover/api/event.cpp b/src/gallium/state_trackers/clover/api/event.cpp
index 5d1a0e5..74bc4d9 100644
--- a/src/gallium/state_trackers/clover/api/event.cpp
+++ b/src/gallium/state_trackers/clover/api/event.cpp
@@ -107,7 +107,9 @@ clGetEventInfo(cl_event d_ev, cl_event_info param,
       break;
 
    case CL_EVENT_REFERENCE_COUNT:
-      buf.as_scalar<cl_uint>() = ev.ref_count();
+      // Current implementation of event handling keeps an extra reference to
+      // the hardware event, which is internal and should not be counted.
+      buf.as_scalar<cl_uint>() = ev.ref_count() - 1;
       break;
 
    default:
-- 
2.7.4



More information about the mesa-dev mailing list