Kaydet (Commit) 6e24c789 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Initialize OpenCL device on the main thread when pre-compiling kernels.

Else it would cause extremely hard-to-debug random crashes when interpreting
formulas with OpenCL.

And let's re-enable kernel pre-compilation with this fix.

Change-Id: Ib104bfdc3f56a02c052c837eb4bf3ecc95d562e0
üst 955fd65a
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 0 #define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 1
using namespace formula; using namespace formula;
......
...@@ -69,6 +69,11 @@ void CLBuildKernelThread::push(CLBuildKernelWorkItem item) ...@@ -69,6 +69,11 @@ void CLBuildKernelThread::push(CLBuildKernelWorkItem item)
osl::MutexGuard guard(maQueueMutex); osl::MutexGuard guard(maQueueMutex);
maQueue.push(item); maQueue.push(item);
maQueueCondition.set(); maQueueCondition.set();
// This is only to ensure that the OpenCL parameters are initialized on
// the main thread before spawning a worker thread for kernel
// pre-compilation.
sc::FormulaGroupInterpreter::getStatic();
} }
void CLBuildKernelThread::produce() void CLBuildKernelThread::produce()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment