diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-06-05 17:39:57 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-06-06 22:02:05 +0300 |
commit | 85c2e2d10e8498987f03537665c00a2baa9f87e6 (patch) | |
tree | 4e67c86084285fd958b9fea075dad5598f606417 /intern/cycles/bvh | |
parent | be3a8ccbfd50e6c5cbd0b53f19e14cec84f47799 (diff) |
Cycles: use TBB for task pools and task schedulertemp-cycles-tbb
No significant performance improvement is expected, but it means we have a
single thread pool throughout Blender. And it should make adding more
parallellization in the future easier.
After previous refactoring commits this is basically a drop-in replacement.
One difference is that the task pool had a mechanism for scheduling tasks to
the front of the queue to minimize memory usage. TBB has a smarter algorithm
to balance depth-first and breadth-first scheduling of tasks and we assume that
removes the need to manually provide hints to the scheduler.
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r-- | intern/cycles/bvh/bvh_build.cpp | 20 | ||||
-rw-r--r-- | intern/cycles/bvh/bvh_sort.cpp | 2 |
2 files changed, 9 insertions, 13 deletions
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index d8a70e2a254..9d6d7fb7c13 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -625,8 +625,8 @@ BVHNode *BVHBuild::build_node(const BVHObjectBinning &range, int level) /* Threaded build */ inner = new InnerNode(bounds); - task_pool.push([=] { thread_build_node(inner, 0, left, level + 1); }, true); - task_pool.push([=] { thread_build_node(inner, 1, right, level + 1); }, true); + task_pool.push([=] { thread_build_node(inner, 0, left, level + 1); }); + task_pool.push([=] { thread_build_node(inner, 1, right, level + 1); }); } if (do_unalinged_split) { @@ -741,16 +741,12 @@ BVHNode *BVHBuild::build_node(const BVHRange &range, /* Create tasks for left and right nodes, using copy for most arguments and * move for reference to avoid memory copies. */ - task_pool.push( - [=, refs = std::move(left_references)]() mutable { - thread_build_spatial_split_node(inner, 0, left, refs, level + 1); - }, - true); - task_pool.push( - [=, refs = std::move(right_references)]() mutable { - thread_build_spatial_split_node(inner, 1, right, refs, level + 1); - }, - true); + task_pool.push([=, refs = std::move(left_references)]() mutable { + thread_build_spatial_split_node(inner, 0, left, refs, level + 1); + }); + task_pool.push([=, refs = std::move(right_references)]() mutable { + thread_build_spatial_split_node(inner, 1, right, refs, level + 1); + }); } if (do_unalinged_split) { diff --git a/intern/cycles/bvh/bvh_sort.cpp b/intern/cycles/bvh/bvh_sort.cpp index 5bdded354bc..b01785b547a 100644 --- a/intern/cycles/bvh/bvh_sort.cpp +++ b/intern/cycles/bvh/bvh_sort.cpp @@ -147,7 +147,7 @@ static void bvh_reference_sort_threaded(TaskPool *task_pool, if (left < end) { if (start < right) { task_pool->push( - function_bind(bvh_reference_sort_threaded, task_pool, data, left, end, compare), true); + function_bind(bvh_reference_sort_threaded, task_pool, data, left, end, compare)); } else { start = left; |