Halide 19.0.0
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 | |
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 197 of file thread_pool_common.h.
Referenced by Halide::Runtime::Internal::worker_thread_already_locked().
#define dump_job_state | ( | ) |
Definition at line 198 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 596 of file thread_pool_common.h.
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 601 of file thread_pool_common.h.
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 607 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, 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 639 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, 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 679 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 | ( | void | ) |
Definition at line 696 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 722 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 728 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 742 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 758 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 764 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 770 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 776 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 794 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_task.
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 799 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_par_for.
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 804 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_loop_task.
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 809 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_do_parallel_tasks.
WEAK int halide_semaphore_init | ( | struct halide_semaphore_t * | sema, |
int | count ) |
Definition at line 815 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 819 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 823 of file thread_pool_common.h.
References Halide::Runtime::Internal::custom_semaphore_try_acquire.