Halide 19.0.0
Halide compiler and libraries
|
Go to the source code of this file.
Classes | |
struct | Halide::Runtime::Internal::halide_cond_with_spinning |
struct | Halide::Runtime::Internal::work |
struct | Halide::Runtime::Internal::work_queue_t |
struct | halide_semaphore_impl_t |
Namespaces | |
namespace | 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. | |
namespace | Halide::Runtime |
namespace | Halide::Runtime::Internal |
Macros | |
#define | EXTENDED_DEBUG 0 |
#define | log_message(stuff) |
#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 24 of file thread_pool_common.h.
Referenced by Halide::Runtime::Internal::enqueue_work_already_locked(), and Halide::Runtime::Internal::worker_thread_already_locked().
#define print_job | ( | job, | |
indent, | |||
prefix ) |
Definition at line 248 of file thread_pool_common.h.
Referenced by Halide::Runtime::Internal::worker_thread_already_locked().
#define dump_job_state | ( | ) |
Definition at line 249 of file thread_pool_common.h.
Referenced by Halide::Runtime::Internal::worker_thread_already_locked().
WEAK int halide_default_do_task | ( | void * | user_context, |
halide_task_t | f, | ||
int | idx, | ||
uint8_t * | closure ) |
Definition at line 630 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 635 of file thread_pool_common.h.
References 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 641 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_error_code_success, halide_mutex_lock(), halide_mutex_unlock(), 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, Halide::Runtime::Internal::work::user_context, 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 673 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_error_code_success, 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, Halide::Runtime::Internal::work::user_context, user_context, Halide::Runtime::Internal::work_queue, and Halide::Runtime::Internal::worker_thread_already_locked().
WEAK int halide_set_num_threads | ( | int | n | ) |
Definition at line 713 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 int halide_get_num_threads | ( | ) |
Get or set the number of threads used by Halide's thread pool.
Set 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 730 of file thread_pool_common.h.
References Halide::Runtime::Internal::work_queue_t::desired_threads_working, 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 | ( | void | ) |
Definition at line 737 of file thread_pool_common.h.
References Halide::Runtime::Internal::halide_cond_with_spinning::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 763 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 769 of file thread_pool_common.h.
References Halide::Runtime::Internal::halide_cond_with_spinning::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 783 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 799 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 805 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 811 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 817 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 835 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 840 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_par_for, 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 845 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_loop_task, 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 850 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 856 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 860 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 864 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_semaphore_try_acquire.