Blender Git Loki
Git Commits -> Revision 658fd8d
Revision 658fd8d by Jacques Lucke (master) November 26, 2021, 10:06 (GMT) |
Geometry Nodes: refactor multi-threading in field evaluation Previously, there was a fixed grain size for all multi-functions. That was not sufficient because some functions could benefit a lot from smaller grain sizes. This refactors adds a new `MultiFunction::call_auto` method which has the same effect as just calling `MultiFunction::call` but additionally figures out how to execute the specific multi-function efficiently. It determines a good grain size and decides whether the mask indices should be shifted or not. Most multi-function evaluations benefit from this, but medium sized work loads (1000 - 50000 elements) benefit from it the most. Especially when expensive multi-functions (e.g. noise) is involved. This is because for smaller work loads, threading is rarely used and for larger work loads threading worked fine before already. With this patch, multi-functions can specify execution hints, that allow the caller to execute it most efficiently. These execution hints still have to be added to more functions. Some performance measurements of a field evaluation involving noise and math nodes, ordered by the number of elements being evaluated: ``` 1,000,000: 133 ms -> 120 ms 100,000: 30 ms -> 18 ms 10,000: 20 ms -> 2.7 ms 1,000: 4 ms -> 0.5 ms 100: 0.5 ms -> 0.4 ms ``` |
Commit Details:
Full Hash: 658fd8df0bd2427cd77e7fc4bcca8a102f67b626
Parent Commit: 004172d
Lines Changed: +264, -163
1 Added Path:
/source/blender/functions/intern/multi_function_params.cc (+44, -0) (View)
2 Deleted Paths:
/source/blender/functions/FN_multi_function_parallel.hh (+0, -39)
/source/blender/functions/intern/multi_function_parallel.cc (+0, -93)
/source/blender/functions/intern/multi_function_parallel.cc (+0, -93)
10 Modified Paths:
/source/blender/functions/CMakeLists.txt (+1, -2) (Diff)
/source/blender/functions/FN_multi_function.hh (+28, -0) (Diff)
/source/blender/functions/FN_multi_function_params.hh (+14, -15) (Diff)
/source/blender/functions/FN_multi_function_procedure_executor.hh (+3, -0) (Diff)
/source/blender/functions/intern/field.cc (+2, -8) (Diff)
/source/blender/functions/intern/multi_function.cc (+133, -0) (Diff)
/source/blender/functions/intern/multi_function_procedure_executor.cc (+9, -1) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc (+4, -4) (Diff)
/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc (+8, -0) (Diff)
/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc (+18, -1) (Diff)
/source/blender/functions/FN_multi_function.hh (+28, -0) (Diff)
/source/blender/functions/FN_multi_function_params.hh (+14, -15) (Diff)
/source/blender/functions/FN_multi_function_procedure_executor.hh (+3, -0) (Diff)
/source/blender/functions/intern/field.cc (+2, -8) (Diff)
/source/blender/functions/intern/multi_function.cc (+133, -0) (Diff)
/source/blender/functions/intern/multi_function_procedure_executor.cc (+9, -1) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc (+4, -4) (Diff)
/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc (+8, -0) (Diff)
/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc (+18, -1) (Diff)