20# include <tbb/blocked_range.h>
21# include <tbb/task_arena.h>
22# include <tbb/task_scheduler_observer.h>
23# if TBB_INTERFACE_VERSION_MAJOR >= 10
24# include <tbb/global_control.h>
25# define WITH_TBB_GLOBAL_CONTROL
34#ifdef WITH_TBB_GLOBAL_CONTROL
35static tbb::global_control *task_scheduler_global_control =
nullptr;
46class FlushDenormalsObserver :
public tbb::task_scheduler_observer {
48 FlushDenormalsObserver()
53 ~FlushDenormalsObserver()
override
58 void on_scheduler_entry(
bool )
override
64static void ensure_flush_denormals_observer()
66 static FlushDenormalsObserver observer;
72 if (use_flush_denormals_to_zero) {
77 ensure_flush_denormals_observer();
81#ifdef WITH_TBB_GLOBAL_CONTROL
84 if (threads_override_num > 0) {
87 task_scheduler_global_control = MEM_new<tbb::global_control>(
88 __func__, tbb::global_control::max_allowed_parallelism, threads_override_num);
105#ifdef WITH_TBB_GLOBAL_CONTROL
106 MEM_delete(task_scheduler_global_control);
119 tbb::this_task_arena::isolate([&] { func(userdata); });
#define SIMD_SET_FLUSH_TO_ZERO
Read Blender memory allocation and freeing.
int BLI_task_scheduler_num_threads()
void BLI_task_scheduler_exit()
static int task_scheduler_num_threads
int BLI_system_thread_count()
void BLI_task_isolate(void(*func)(void *userdata), void *userdata)
int BLI_system_num_threads_override_get()
void BLI_task_scheduler_init(bool use_flush_denormals_to_zero=true)