[Bf-blender-cvs] [0ac41dea7e2] master: BLI_bvhtree_overlap does not work multithreaded

mano-wii noreply at git.blender.org
Sat Jan 4 12:37:18 CET 2020


Commit: 0ac41dea7e21fb5c9388f8b72b8c6b6dfb005046
Author: mano-wii
Date:   Sat Jan 4 08:36:47 2020 -0300
Branches: master
https://developer.blender.org/rB0ac41dea7e21fb5c9388f8b72b8c6b6dfb005046

BLI_bvhtree_overlap does not work multithreaded

`BLI_task_parallel_range` counts the number of tasks depending on the
number of items.

In the case of `BLI_bvhtree_overlap` the number of items is always
between 2 and 16, which makes it always run in single thread.

So, set the maximum number of items per thread to 1.

In my tests the cloth collision system (which calls that function)
went from 0.80fps to 0.88fps.

Differential Revision: https://developer.blender.org/D6523

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

M	source/blender/blenlib/intern/BLI_kdopbvh.c

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

diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index d5bedaadb8b..5a34626e335 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -1344,6 +1344,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap_ex(
   if (use_threading) {
     TaskParallelSettings settings;
     BLI_parallel_range_settings_defaults(&settings);
+    settings.min_iter_per_thread = 1;
     BLI_task_parallel_range(0,
                             root_node_len,
                             data,



More information about the Bf-blender-cvs mailing list