31 #if __TBB_PREVIEW_CRITICAL_TASKS && __TBB_CPF_BUILD 36 #include "../rml/include/rml_tbb.h" 45 class task_group_context;
46 class allocate_root_with_context_proxy;
63 #if __TBB_TASK_PRIORITY 64 volatile intptr_t my_top_priority;
77 #if __TBB_PREVIEW_CRITICAL_TASKS && __TBB_CPF_BUILD 83 #if __TBB_PREVIEW_CRITICAL_TASKS 105 #if __TBB_ARENA_OBSERVER 106 observer_list my_observers;
110 #if __TBB_TASK_PRIORITY 111 intptr_t my_bottom_priority;
117 uintptr_t my_reload_epoch;
120 task* my_orphaned_tasks;
140 #if !__TBB_FP_CONTEXT 145 #if __TBB_TASK_GROUP_CONTEXT 158 #if __TBB_ENQUEUE_ENFORCED_CONCURRENCY 159 enum concurrency_mode {
167 concurrency_mode my_concurrency_mode;
194 arena (
market&,
unsigned max_num_workers,
unsigned num_reserved_slots );
200 return max(2u, num_slots);
209 __TBB_ASSERT( 0<
id,
"affinity id must be positive integer" );
255 template<
unsigned ref_param>
259 void dump_arena_statistics ();
263 #if __TBB_TASK_PRIORITY 266 inline bool may_have_tasks (
generic_scheduler*,
bool& tasks_present,
bool& dequeuing_possible );
272 #if __TBB_COUNT_TASK_NODES 273 intptr_t workers_task_node_count();
280 #if __TBB_ENQUEUE_ENFORCED_CONCURRENCY 281 bool recall_by_mandatory_request()
const {
283 return my_market->my_mandatory_num_requested && my_concurrency_mode==cm_normal;
287 bool must_have_concurrency()
const {
289 ( my_concurrency_mode==cm_enforced_local || my_concurrency_mode==cm_enforced_global );
294 template <
bool as_worker>
303 template<
unsigned ref_param>
362 #if __TBB_STATISTICS_EARLY_DUMP 368 #if __TBB_ENQUEUE_ENFORCED_CONCURRENCY 395 #if __TBB_ENQUEUE_ENFORCED_CONCURRENCY 397 if( my_concurrency_mode!=cm_enforced_global ) {
398 if(
my_market->mandatory_concurrency_enable(
this ) ) {
406 my_concurrency_mode = cm_enforced_local;
416 else if( work_type ==
wakeup ) {
443 #if __TBB_ENQUEUE_ENFORCED_CONCURRENCY 445 if( my_concurrency_mode!=cm_normal ) {
446 switch( my_concurrency_mode ) {
447 case cm_enforced_local:
455 my_concurrency_mode = cm_normal;
457 case cm_enforced_global:
458 my_market->mandatory_concurrency_disable(
this );
The container for "fairness-oriented" aka "enqueued" tasks.
void free_arena()
Completes arena shutdown, destructs and deallocates it.
static int unsigned num_arena_slots(unsigned num_slots)
static int allocation_size(unsigned num_slots)
static const unsigned ref_worker
unsigned my_num_workers_allotted
The number of workers that have been marked out by the resource manager to service the arena.
unsigned short affinity_id
An id as used for specifying affinity.
market * my_market
The market that owns this arena.
unsigned my_num_reserved_slots
The number of reserved slots (can be occupied only by masters).
static generic_scheduler * local_scheduler()
Obtain the thread-local instance of the TBB scheduler.
argument_integer_type modulo_power_of_two(argument_integer_type arg, divisor_integer_type divisor)
A function to compute arg modulo divisor where divisor is a power of 2.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
void adjust_demand(arena &, int delta)
Request that arena's need in workers should be adjusted.
size_t occupy_free_slot(generic_scheduler &s)
Tries to occupy a slot in the arena. On success, returns the slot index; if no slot is available,...
static const size_t out_of_arena
cpu_ctl_env my_cpu_ctl_env
FPU control settings of arena's master thread captured at the moment of arena instantiation.
static const pool_state_t SNAPSHOT_FULL
At least one task has been offered for stealing since the last snapshot started.
void on_thread_leaving()
Notification that worker or master leaves its arena.
Used to form groups of tasks.
A fast random number generator.
The structure of an arena, except the array of slots.
void enqueue_task(task &, intptr_t, FastRandom &)
enqueue a task into starvation-resistance queue
Base class for user-defined tasks.
Work stealing task scheduler.
static const unsigned ref_external
Reference increment values for externals and workers.
unsigned my_num_slots
The number of slots in the arena.
arena(market &, unsigned max_num_workers, unsigned num_reserved_slots)
Constructor.
void atomic_fence()
Sequentially consistent full memory fence.
padded< arena_base > base_type
size_t occupy_free_slot_in_range(generic_scheduler &s, size_t lower, size_t upper)
Tries to occupy a slot in the specified range.
tbb::atomic< uintptr_t > my_pool_state
Current task pool state and estimate of available tasks amount.
T max(const T &val1, const T &val2)
Utility template function returning greater of the two values.
atomic< unsigned > my_references
Reference counter for the arena.
bool is_out_of_work()
Check if there is job anywhere in arena.
unsigned my_max_num_workers
The number of workers requested by the master thread owning the arena.
static const pool_state_t SNAPSHOT_EMPTY
No tasks to steal since last snapshot was taken.
static const intptr_t num_priority_levels
int my_num_workers_requested
The number of workers that are currently requested from the resource manager.
#define GATHER_STATISTIC(x)
static arena & allocate_arena(market &, unsigned num_slots, unsigned num_reserved_slots)
Allocate an instance of arena.
bool has_enqueued_tasks()
Check for the presence of enqueued tasks at all priority levels.
void restore_priority_if_need()
If enqueued tasks found, restore arena priority and task presence status.
atomic< unsigned > my_limit
The maximal number of currently busy slots.
uintptr_t my_aba_epoch
ABA prevention marker.
static const unsigned ref_external_bits
The number of least significant bits for external references.
void const char const char int ITT_FORMAT __itt_group_sync s
mail_outbox & mailbox(affinity_id id)
Get reference to mailbox corresponding to given affinity_id.
concurrent_monitor my_exit_monitors
Waiting object for master threads that cannot join the arena.
value_type compare_and_swap(value_type value, value_type comparand)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long ITT_FORMAT lu const __itt_domain __itt_id __itt_string_handle __itt_metadata_type size_t void ITT_FORMAT p const __itt_domain __itt_id __itt_string_handle const wchar_t size_t ITT_FORMAT lu const __itt_domain __itt_id __itt_relation __itt_id ITT_FORMAT p const wchar_t int ITT_FORMAT __itt_group_mark d int
task_stream< num_priority_levels > my_task_stream
Task pool for the tasks scheduled via task::enqueue() method.
void try_destroy_arena(arena *, uintptr_t aba_epoch)
Removes the arena from the market's list.
static bool is_busy_or_empty(pool_state_t s)
No tasks to steal or snapshot is being taken.
Class representing where mail is put.
unsigned num_workers_active()
The number of workers active in the arena.
void advertise_new_work()
If necessary, raise a flag that there is new job in arena.
unsigned my_num_workers_soft_limit
Current application-imposed limit on the number of workers (see set_active_num_workers())
void process(generic_scheduler &)
Registers the worker with the arena and enters TBB scheduler dispatch loop.
new_work_type
Types of work advertised by advertise_new_work()
Pads type T to fill out to a multiple of cache line size.