diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-04-30 08:59:23 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-04-30 09:09:21 +0300 |
commit | d8a3f3595af0fb3ca5937e41c2728fd750d986ef (patch) | |
tree | 03886cfd2ea7ad200a50317d2362f0fc94070f0c /tests/gtests | |
parent | a18ad3c3b6198964ab7134302afda1afc89da5f4 (diff) |
Task: Use TBB as Task Scheduler
This patch enables TBB as the default task scheduler. TBB stands for Threading Building Blocks and is developed by Intel. The library contains several threading patters. This patch maps blenders BLI_task_* function to their counterpart. After this patch we can add more patterns. A promising one is TBB:graph that can be used for depsgraph, draw manager and compositor.
Performance changes depends on the actual hardware. It was tested on different hardwares from laptops to workstations and we didn't detected any downgrade of the performance.
* Linux Xeon E5-2699 v4 got FPS boost from 12 to 17 using Spring's 04_010_A.anim.blend.
* AMD Ryzen Threadripper 2990WX 32-Core Animation playback goes from 9.5-10.5 FPS to 13.0-14.0 FPS on Agent 327 , 10_03_B.anim.blend.
Reviewed By: brecht, sergey
Differential Revision: https://developer.blender.org/D7475
Diffstat (limited to 'tests/gtests')
-rw-r--r-- | tests/gtests/blenlib/BLI_linklist_lockfree_test.cc | 7 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_task_test.cc | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/tests/gtests/blenlib/BLI_linklist_lockfree_test.cc b/tests/gtests/blenlib/BLI_linklist_lockfree_test.cc index d1176527cb5..023d02e5075 100644 --- a/tests/gtests/blenlib/BLI_linklist_lockfree_test.cc +++ b/tests/gtests/blenlib/BLI_linklist_lockfree_test.cc @@ -63,7 +63,7 @@ struct IndexedNode { int index; }; -void concurrent_insert(TaskPool *__restrict pool, void *taskdata, int /*threadid*/) +void concurrent_insert(TaskPool *__restrict pool, void *taskdata) { LockfreeLinkList *list = (LockfreeLinkList *)BLI_task_pool_user_data(pool); CHECK_NOTNULL(list); @@ -76,14 +76,12 @@ void concurrent_insert(TaskPool *__restrict pool, void *taskdata, int /*threadid TEST(LockfreeLinkList, InsertMultipleConcurrent) { - static const int num_threads = 512; static const int num_nodes = 655360; /* Initialize list. */ LockfreeLinkList list; BLI_linklist_lockfree_init(&list); /* Initialize task scheduler and pool. */ - TaskScheduler *scheduler = BLI_task_scheduler_create(num_threads); - TaskPool *pool = BLI_task_pool_create_suspended(scheduler, &list, TASK_PRIORITY_HIGH); + TaskPool *pool = BLI_task_pool_create_suspended(&list, TASK_PRIORITY_HIGH); /* Push tasks to the pool. */ for (int i = 0; i < num_nodes; ++i) { BLI_task_pool_push(pool, concurrent_insert, POINTER_FROM_INT(i), false, NULL); @@ -112,5 +110,4 @@ TEST(LockfreeLinkList, InsertMultipleConcurrent) /* Cleanup data. */ BLI_linklist_lockfree_free(&list, MEM_freeN); BLI_task_pool_free(pool); - BLI_task_scheduler_free(scheduler); } diff --git a/tests/gtests/blenlib/BLI_task_test.cc b/tests/gtests/blenlib/BLI_task_test.cc index fe0f481d469..ed300b3f238 100644 --- a/tests/gtests/blenlib/BLI_task_test.cc +++ b/tests/gtests/blenlib/BLI_task_test.cc @@ -54,7 +54,7 @@ TEST(task, RangeIter) BLI_task_parallel_range(0, NUM_ITEMS, data, task_range_iter_func, &settings); - /* Those checks should ensure us all items of the listbase were processed once, and only once - + /* Those checks should ensure us all items of the listbase were processed once, and only once * as expected. */ int expected_sum = 0; |