Halide
12.0.1
Halide compiler and libraries
|
Go to the source code of this file.
Classes | |
struct | Halide::Runtime::Internal::work |
struct | Halide::Runtime::Internal::work_queue_t |
struct | halide_semaphore_impl_t |
Namespaces | |
Halide | |
This file defines the class FunctionDAG, which is our representation of a Halide pipeline, and contains methods to using Halide's bounds tools to query properties of it. | |
Halide::Runtime | |
Halide::Runtime::Internal | |
Macros | |
#define | EXTENDED_DEBUG 0 |
#define | log_message(stuff) |
#define | MAX_THREADS 256 |
#define | print_job(job, indent, prefix) |
#define | dump_job_state() |
#define EXTENDED_DEBUG 0 |
Definition at line 1 of file thread_pool_common.h.
#define log_message | ( | stuff | ) |
Definition at line 19 of file thread_pool_common.h.
#define MAX_THREADS 256 |
Definition at line 67 of file thread_pool_common.h.
#define print_job | ( | job, | |
indent, | |||
prefix | |||
) |
Definition at line 191 of file thread_pool_common.h.
#define dump_job_state | ( | ) |
Definition at line 192 of file thread_pool_common.h.
WEAK int halide_default_do_task | ( | void * | user_context, |
halide_task_t | f, | ||
int | idx, | ||
uint8_t * | closure | ||
) |
Definition at line 589 of file thread_pool_common.h.
References user_context.
WEAK int halide_default_do_loop_task | ( | void * | user_context, |
halide_loop_task_t | f, | ||
int | min, | ||
int | extent, | ||
uint8_t * | closure, | ||
void * | task_parent | ||
) |
Definition at line 594 of file thread_pool_common.h.
References Halide::min(), and user_context.
WEAK int halide_default_do_par_for | ( | void * | user_context, |
halide_task_t | f, | ||
int | min, | ||
int | size, | ||
uint8_t * | closure | ||
) |
The default versions of the parallel runtime functions.
Definition at line 600 of file thread_pool_common.h.
References Halide::Runtime::Internal::work::active_workers, halide_parallel_task_t::closure, Halide::Runtime::Internal::enqueue_work_already_locked(), Halide::Runtime::Internal::work::exit_status, halide_parallel_task_t::extent, halide_parallel_task_t::fn, halide_mutex_lock(), halide_mutex_unlock(), Halide::min(), halide_parallel_task_t::min, halide_parallel_task_t::min_threads, Halide::Runtime::Internal::work_queue_t::mutex, halide_parallel_task_t::name, Halide::Runtime::Internal::work::next_semaphore, halide_parallel_task_t::num_semaphores, Halide::Runtime::Internal::work::owner_is_sleeping, Halide::Runtime::Internal::work::parent_job, halide_parallel_task_t::semaphores, halide_parallel_task_t::serial, Halide::Runtime::Internal::work::sibling_count, Halide::Runtime::Internal::work::siblings, Halide::Runtime::Internal::work::task, Halide::Runtime::Internal::work::task_fn, user_context, Halide::Runtime::Internal::work::user_context, Halide::Runtime::Internal::work_queue, and Halide::Runtime::Internal::worker_thread_already_locked().
WEAK int halide_default_do_parallel_tasks | ( | void * | user_context, |
int | num_tasks, | ||
struct halide_parallel_task_t * | tasks, | ||
void * | task_parent | ||
) |
Definition at line 632 of file thread_pool_common.h.
References Halide::Runtime::Internal::work::active_workers, Halide::Runtime::Internal::enqueue_work_already_locked(), Halide::Runtime::Internal::work::exit_status, halide_parallel_task_t::extent, halide_mutex_lock(), halide_mutex_unlock(), Halide::Runtime::Internal::work_queue_t::mutex, Halide::Runtime::Internal::work::next_semaphore, Halide::Runtime::Internal::work::owner_is_sleeping, Halide::Runtime::Internal::work::parent_job, Halide::Runtime::Internal::work::task, Halide::Runtime::Internal::work::task_fn, user_context, Halide::Runtime::Internal::work::user_context, Halide::Runtime::Internal::work_queue, and Halide::Runtime::Internal::worker_thread_already_locked().
WEAK int halide_set_num_threads | ( | int | n | ) |
Set the number of threads used by Halide's thread pool.
Returns the old number.
n < 0 : error condition n == 0 : use a reasonable system default (typically, number of cpus online). n == 1 : use exactly one thread; this will always enforce serial execution n > 1 : use a pool of exactly n threads.
(Note that this is only guaranteed when using the default implementations of halide_do_par_for(); custom implementations may completely ignore values passed to halide_set_num_threads().)
Definition at line 672 of file thread_pool_common.h.
References Halide::Runtime::Internal::clamp_num_threads(), Halide::Runtime::Internal::default_desired_num_threads(), Halide::Runtime::Internal::work_queue_t::desired_threads_working, halide_error(), halide_mutex_lock(), halide_mutex_unlock(), Halide::Runtime::Internal::work_queue_t::mutex, and Halide::Runtime::Internal::work_queue.
WEAK void halide_shutdown_thread_pool | ( | ) |
Definition at line 689 of file thread_pool_common.h.
References halide_cond_broadcast(), halide_join_thread(), halide_mutex_lock(), halide_mutex_unlock(), Halide::Runtime::Internal::work_queue_t::initialized, Halide::Runtime::Internal::work_queue_t::mutex, Halide::Runtime::Internal::work_queue_t::reset(), Halide::Runtime::Internal::work_queue_t::shutdown, Halide::Runtime::Internal::work_queue_t::threads, Halide::Runtime::Internal::work_queue_t::threads_created, Halide::Runtime::Internal::work_queue_t::wake_a_team, Halide::Runtime::Internal::work_queue_t::wake_b_team, Halide::Runtime::Internal::work_queue_t::wake_owners, and Halide::Runtime::Internal::work_queue.
WEAK int halide_default_semaphore_init | ( | halide_semaphore_t * | s, |
int | n | ||
) |
Definition at line 715 of file thread_pool_common.h.
References halide_semaphore_impl_t::value.
WEAK int halide_default_semaphore_release | ( | halide_semaphore_t * | s, |
int | n | ||
) |
Definition at line 721 of file thread_pool_common.h.
References halide_cond_broadcast(), halide_mutex_lock(), halide_mutex_unlock(), Halide::Runtime::Internal::work_queue_t::mutex, halide_semaphore_impl_t::value, Halide::Runtime::Internal::work_queue_t::wake_a_team, Halide::Runtime::Internal::work_queue_t::wake_owners, and Halide::Runtime::Internal::work_queue.
WEAK bool halide_default_semaphore_try_acquire | ( | halide_semaphore_t * | s, |
int | n | ||
) |
Definition at line 735 of file thread_pool_common.h.
References halide_semaphore_impl_t::value.
Referenced by Halide::Runtime::Internal::work::make_runnable().
WEAK halide_do_task_t halide_set_custom_do_task | ( | halide_do_task_t | f | ) |
Definition at line 751 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_task.
WEAK halide_do_loop_task_t halide_set_custom_do_loop_task | ( | halide_do_loop_task_t | f | ) |
Definition at line 757 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_loop_task.
WEAK halide_do_par_for_t halide_set_custom_do_par_for | ( | halide_do_par_for_t | f | ) |
Definition at line 763 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_par_for.
WEAK void halide_set_custom_parallel_runtime | ( | halide_do_par_for_t | do_par_for, |
halide_do_task_t | do_task, | ||
halide_do_loop_task_t | do_loop_task, | ||
halide_do_parallel_tasks_t | do_parallel_tasks, | ||
halide_semaphore_init_t | semaphore_init, | ||
halide_semaphore_try_acquire_t | semaphore_try_acquire, | ||
halide_semaphore_release_t | semaphore_release | ||
) |
Definition at line 769 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_loop_task, Halide::Runtime::Internal::custom_do_par_for, Halide::Runtime::Internal::custom_do_parallel_tasks, Halide::Runtime::Internal::custom_do_task, Halide::Runtime::Internal::custom_semaphore_init, Halide::Runtime::Internal::custom_semaphore_release, and Halide::Runtime::Internal::custom_semaphore_try_acquire.
WEAK int halide_do_task | ( | void * | user_context, |
halide_task_t | f, | ||
int | idx, | ||
uint8_t * | closure | ||
) |
Definition at line 787 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_task, and user_context.
Referenced by Halide::Runtime::Internal::worker_thread_already_locked().
WEAK int halide_do_par_for | ( | void * | user_context, |
halide_task_t | f, | ||
int | min, | ||
int | size, | ||
uint8_t * | closure | ||
) |
Definition at line 792 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_par_for, Halide::min(), and user_context.
WEAK int halide_do_loop_task | ( | void * | user_context, |
halide_loop_task_t | f, | ||
int | min, | ||
int | size, | ||
uint8_t * | closure, | ||
void * | task_parent | ||
) |
Definition at line 797 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_loop_task, Halide::min(), and user_context.
Referenced by Halide::Runtime::Internal::worker_thread_already_locked().
WEAK int halide_do_parallel_tasks | ( | void * | user_context, |
int | num_tasks, | ||
struct halide_parallel_task_t * | tasks, | ||
void * | task_parent | ||
) |
Enqueue some number of the tasks described above and wait for them to complete.
While waiting, the calling threads assists with either the tasks enqueued, or other non-blocking tasks in the task system. Note that task_parent should be NULL for top-level calls and the pass through argument if this call is being made from another task.
Definition at line 802 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_parallel_tasks, and user_context.
WEAK int halide_semaphore_init | ( | struct halide_semaphore_t * | sema, |
int | count | ||
) |
Definition at line 808 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_semaphore_init.
WEAK int halide_semaphore_release | ( | struct halide_semaphore_t * | sema, |
int | count | ||
) |
Definition at line 812 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_semaphore_release.
WEAK bool halide_semaphore_try_acquire | ( | struct halide_semaphore_t * | sema, |
int | count | ||
) |
Definition at line 816 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_semaphore_try_acquire.