diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-31 20:19:03 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-31 20:19:03 +0400 |
commit | 2d0a586c29e482d646dec0cf62880f577ff77657 (patch) | |
tree | e8ae7b03728ce3215592b7e76567c46facddf91e /intern/cycles/util/util_task.cpp | |
parent | db42a596aafeb7b33bee63c6bc8da205582b5257 (diff) |
Cycles OpenCL: keep the opencl context and program around for quicker rendering
the second time, as for example Intel CPU startup time is 9 seconds.
* Adds an cache for contexts and programs for each platform and device pair,
which also ensure now no two threads try to compile and write the binary cache
file at the same time.
* Change clFinish to clFlush so we don't block until the result is done, instead
it will block at the moment we copy back memory.
* Fix error in Cycles time_sleep implementation, does not affect any active code
though.
* Adds some (disabled) debugging code in the task scheduler.
Patch #35559 by Doug Gale.
Diffstat (limited to 'intern/cycles/util/util_task.cpp')
-rw-r--r-- | intern/cycles/util/util_task.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp index 43f15ba0ce6..abcb05561bd 100644 --- a/intern/cycles/util/util_task.cpp +++ b/intern/cycles/util/util_task.cpp @@ -21,6 +21,15 @@ #include "util_system.h" #include "util_task.h" +//#define THREADING_DEBUG_ENABLED + +#ifdef THREADING_DEBUG_ENABLED +#include <stdio.h> +#define THREADING_DEBUG(...) do { printf(__VA_ARGS__); fflush(stdout); } while(0) +#else +#define THREADING_DEBUG(...) +#endif + CCL_NAMESPACE_BEGIN /* Task Pool */ @@ -95,8 +104,11 @@ void TaskPool::wait_work() if(num == 0) break; - if(!found_entry) + if(!found_entry) { + THREADING_DEBUG("num==%d, Waiting for condition in TaskPool::wait_work !found_entry\n", num); num_cond.wait(num_lock); + THREADING_DEBUG("num==%d, condition wait done in TaskPool::wait_work !found_entry\n", num); + } } } @@ -109,8 +121,11 @@ void TaskPool::cancel() { thread_scoped_lock num_lock(num_mutex); - while(num) + while(num) { + THREADING_DEBUG("num==%d, Waiting for condition in TaskPool::cancel\n", num); num_cond.wait(num_lock); + THREADING_DEBUG("num==%d condition wait done in TaskPool::cancel\n", num); + } } do_cancel = false; @@ -134,8 +149,10 @@ void TaskPool::num_decrease(int done) num -= done; assert(num >= 0); - if(num == 0) + if(num == 0) { + THREADING_DEBUG("num==%d, notifying all in TaskPool::num_decrease\n", num); num_cond.notify_all(); + } num_mutex.unlock(); } @@ -144,6 +161,7 @@ void TaskPool::num_increase() { thread_scoped_lock num_lock(num_mutex); num++; + THREADING_DEBUG("num==%d, notifying all in TaskPool::num_increase\n", num); num_cond.notify_all(); } |