[Bf-blender-cvs] [1255f572c76] master: Depsgraph: Make eval initialization more friendly for threading

Sergey Sharybin noreply at git.blender.org
Thu Jan 11 15:14:12 CET 2018


Commit: 1255f572c76d989e9acf86d1d6089303406bc72f
Author: Sergey Sharybin
Date:   Thu Jan 11 14:47:12 2018 +0100
Branches: master
https://developer.blender.org/rB1255f572c76d989e9acf86d1d6089303406bc72f

Depsgraph: Make eval initialization more friendly for threading

Helps in cases of not very complex scenes and lots of system threads available.

A bit hard to measure change on it's own, it works best with the upcoming
changes and gives measurable improvements.

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

M	source/blender/depsgraph/intern/eval/deg_eval.cc
M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc

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

diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc
index 76e76b5eb7b..c29a0708cef 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval.cc
@@ -144,13 +144,12 @@ static void calculate_pending_func(
 static void calculate_pending_parents(Depsgraph *graph, unsigned int layers)
 {
 	const int num_operations = graph->operations.size();
-	const bool do_threads = (num_operations > 256);
 	CalculatePengindData data;
 	data.graph = graph;
 	data.layers = layers;
 	ParallelRangeSettings settings;
 	BLI_parallel_range_settings_defaults(&settings);
-	settings.use_threading = do_threads;
+	settings.min_iter_per_thread = 1024;
 	BLI_task_parallel_range(0,
 	                        num_operations,
 	                        &data,
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
index 9e910afea07..daf008ddb7d 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc
@@ -112,7 +112,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph)
 		const int num_operations = graph->operations.size();
 		ParallelRangeSettings settings;
 		BLI_parallel_range_settings_defaults(&settings);
-		settings.use_threading = (num_operations > 256);
+		settings.min_iter_per_thread = 1024;
 		BLI_task_parallel_range(0, num_operations,
 		                        graph,
 		                        flush_init_operation_node_func,
@@ -122,7 +122,7 @@ BLI_INLINE void flush_prepare(Depsgraph *graph)
 		const int num_id_nodes = graph->id_nodes.size();
 		ParallelRangeSettings settings;
 		BLI_parallel_range_settings_defaults(&settings);
-		settings.use_threading = (num_id_nodes > 256);
+		settings.min_iter_per_thread = 1024;
 		BLI_task_parallel_range(0, num_id_nodes,
 		                        graph,
 		                        flush_init_id_node_func,
@@ -311,10 +311,9 @@ void deg_graph_clear_tags(Depsgraph *graph)
 {
 	/* Go over all operation nodes, clearing tags. */
 	const int num_operations = graph->operations.size();
-	const bool do_threads = num_operations > 256;
 	ParallelRangeSettings settings;
 	BLI_parallel_range_settings_defaults(&settings);
-	settings.use_threading = do_threads;
+	settings.min_iter_per_thread = 1024;
 	BLI_task_parallel_range(0, num_operations,
 	                        graph,
 	                        graph_clear_func,



More information about the Bf-blender-cvs mailing list