Blender Git Loki

Git Commits -> Revision fcbec6e

Revision fcbec6e by Bastien Montagne (master)
November 26, 2019, 13:30 (GMT)
BLI_task: Add pooled threaded index range iterator, Take II.

This code allows to push a set of different operations all based on
iterations over a range of indices, and then process them all at once
over multiple threads.

This commit also adds unit tests for both old un-pooled, and new pooled
task_parallel_range family of functions, as well as some basic
performances tests.

This is mainly interesting for relatively low amount of individual
tasks, as expected.

E.g. performance tests on a 32 threads machine, for a set of 10
different tasks, shows following improvements when using pooled version
instead of ten sequential calls to BLI_task_parallel_range():

| Num Items | Sequential | Pooled | Speed-up |
| --------- | ---------- | ------- | -------- |
| 10K | 365 us | 138 us | 2.5 x |
| 100K | 877 us | 530 us | 1.66 x |
| 1000K | 5521 us | 4625 us | 1.25 x |

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

Note: Compared to previous commit yesterday, this reworks atomic handling in
parallel iter code, and fixes a dummy double-free bug.

Now we should only use the two critical values for synchronization from
atomic calls results, which is the proper way to do things.

Reading a value after an atomic operation does not guarantee you will
get the latest value in all cases (especially on Windows release builds
it seems).

Commit Details:

Full Hash: fcbec6e97e649eee33f06e0202455ee11dcfe46e
Parent Commit: 9ecc302
Lines Changed: +605, -89

4 Modified Paths:

/source/blender/blenlib/BLI_task.h (+16, -3) (Diff)
/source/blender/blenlib/intern/task.c (+381, -84) (Diff)
/tests/gtests/blenlib/BLI_task_performance_test.cc (+88, -2) (Diff)
/tests/gtests/blenlib/BLI_task_test.cc (+120, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021