[Bf-blender-cvs] [8bde154c71] cycles_split_kernel: Revert "Cycles: Faster version of driver workaround for OpenCL"

Mai Lavelle noreply at git.blender.org
Wed Feb 22 11:20:43 CET 2017


Commit: 8bde154c71f2e8282148584a67ca72ea3e4d2f6d
Author: Mai Lavelle
Date:   Wed Feb 22 04:24:59 2017 -0500
Branches: cycles_split_kernel
https://developer.blender.org/rB8bde154c71f2e8282148584a67ca72ea3e4d2f6d

Revert "Cycles: Faster version of driver workaround for OpenCL"

Was getting infrequent hangs, unfortunately we have to take the performance
hit of clFinish for now.

This reverts commit 122743e7f23f8df908bcd10322d39f951ebc83e2.

===================================================================

M	intern/cycles/device/opencl/opencl.h

===================================================================

diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h
index 3f3fa50195..14e1db7a7a 100644
--- a/intern/cycles/device/opencl/opencl.h
+++ b/intern/cycles/device/opencl/opencl.h
@@ -28,28 +28,24 @@ CCL_NAMESPACE_BEGIN
 
 /* Define CYCLES_DISABLE_DRIVER_WORKAROUNDS to disable workaounds for testing */
 #ifndef CYCLES_DISABLE_DRIVER_WORKAROUNDS
-/* Work around AMD driver hangs by setting an event callback which seems to make commands
- * finish completely for some reason. This is faster than doing clFinish after every call.
- */
-static cl_event driver_workaround_event;
-static void driver_workaround_event_callback_handler(cl_event event, cl_int, void*) {
-	clReleaseEvent(event);
-}
-
+/* Work around AMD driver hangs by ensuring each command is finished before doing anything else. */
 #  undef clEnqueueNDRangeKernel
 #  define clEnqueueNDRangeKernel(a, b, c, d, e, f, g, h, i) \
-	CLEW_GET_FUN(__clewEnqueueNDRangeKernel)(a, b, c, d, e, f, g, h, &driver_workaround_event); \
-	clSetEventCallback(driver_workaround_event, CL_SUBMITTED, driver_workaround_event_callback_handler, NULL);
+	clFinish(a); \
+	CLEW_GET_FUN(__clewEnqueueNDRangeKernel)(a, b, c, d, e, f, g, h, i); \
+	clFinish(a);
 
 #  undef clEnqueueWriteBuffer
 #  define clEnqueueWriteBuffer(a, b, c, d, e, f, g, h, i) \
-	CLEW_GET_FUN(__clewEnqueueWriteBuffer)(a, b, c, d, e, f, g, h, &driver_workaround_event); \
-	clSetEventCallback(driver_workaround_event, CL_SUBMITTED, driver_workaround_event_callback_handler, NULL);
+	clFinish(a); \
+	CLEW_GET_FUN(__clewEnqueueWriteBuffer)(a, b, c, d, e, f, g, h, i); \
+	clFinish(a);
 
 #  undef clEnqueueReadBuffer
 #  define clEnqueueReadBuffer(a, b, c, d, e, f, g, h, i) \
-	CLEW_GET_FUN(__clewEnqueueReadBuffer)(a, b, c, d, e, f, g, h, &driver_workaround_event); \
-	clSetEventCallback(driver_workaround_event, CL_SUBMITTED, driver_workaround_event_callback_handler, NULL);
+	clFinish(a); \
+	CLEW_GET_FUN(__clewEnqueueReadBuffer)(a, b, c, d, e, f, g, h, i); \
+	clFinish(a);
 #endif  /* CYCLES_DISABLE_DRIVER_WORKAROUNDS */
 
 #define CL_MEM_PTR(p) ((cl_mem)(uintptr_t)(p))




More information about the Bf-blender-cvs mailing list