![]() |
Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
|
#include "async.h"
Go to the source code of this file.
Functions | |
void | async_meta_init_always (async_meta_s *meta) |
void | async_meta_init_once (async_meta_s *meta, arch_alloc_s *alloc) |
void | async_completion_init (async_meta_s *meta, async_completion_s *completion) |
void | async_completion_complete (async_completion_s *completion) |
void | async_completion_wait (async_completion_s *completion) |
int | async_completion_check (async_completion_s *completion) |
void | async_semaphore_init (async_meta_s *meta, async_semaphore_s *sem) |
int | async_semaphore_value (async_semaphore_s *sem) |
void | async_semaphore_inc (async_semaphore_s *sem) |
void | async_semaphore_dec (async_semaphore_s *sem) |
void | async_condition_init (async_meta_s *meta, async_condition_s *cond) |
void | async_condition_lock (async_condition_s *cond) |
void | async_condition_wait (async_condition_s *cond) |
void | async_condition_notify (async_condition_s *cond) |
void | async_condition_unlock (async_condition_s *cond) |
void | async_meta_exit (async_meta_s *meta) |
int async_completion_check | ( | async_completion_s * | completion | ) |
Check if completion has been marked as completed.
completion | Completion to be checked. |
Definition at line 24 of file spin/async.c.
References async_completion_s::completed.
void async_completion_complete | ( | async_completion_s * | completion | ) |
Mark compl
as completed and notify pending async_completion_wait() callers.
completion | Completion to be marked as completed. |
Definition at line 14 of file spin/async.c.
References async_completion_s::completed, async_completion_s::meta, async_completion_s::vm_id, and wakeupVm().
Referenced by arax_task_mark_done(), async_condition_init(), async_condition_unlock(), and async_condition_wait().
void async_completion_init | ( | async_meta_s * | meta, |
async_completion_s * | completion ) |
Create and register async_completion_s objects created in buff
.
meta | Pointer to async_meta_s that will 'own' this completion. |
completion | Completion to be initialized |
Definition at line 9 of file spin/async.c.
References async_completion_s::attr, async_completion_s::completed, async_completion_s::meta, async_completion_s::mutex, async_completion_s::outstanding, and utils_list_node_init().
Referenced by arax_task_alloc(), and async_condition_init().
void async_completion_wait | ( | async_completion_s * | completion | ) |
Wait for compl
to be completed with async_completion_complete().
completion | Sleep untill it has been completed with async_completion_complete. |
Definition at line 19 of file spin/async.c.
References _add_completion(), async_completion_s::completed, getVmID(), async_completion_s::meta, async_completion_s::mutex, and async_completion_s::vm_id.
Referenced by arax_task_wait_done(), async_condition_lock(), and async_condition_wait().
void async_condition_init | ( | async_meta_s * | meta, |
async_condition_s * | cond ) |
Initialize semaphore.
meta | Pointer to async_meta_s that will 'own' this semaphore. |
cond | Condition to be initialized |
Definition at line 57 of file spin/async.c.
References async_completion_complete(), async_completion_init(), async_semaphore_init(), async_condition_s::mutex, and async_condition_s::semaphore.
Referenced by arax_accel_init(), arax_pipe_init(), and arax_throttle_init().
void async_condition_lock | ( | async_condition_s * | cond | ) |
Lock on condition cond
.
cond | Condition to be read. |
Definition at line 64 of file spin/async.c.
References async_completion_wait(), and async_condition_s::mutex.
Referenced by _arax_init(), arax_accel_add_task(), arax_accel_add_vaccel(), arax_accel_del_vaccel(), arax_accel_get_assigned_vaccels(), arax_accel_wait_for_task(), ARAX_OBJ_DTOR_DECL(), arax_pipe_add_orphan_vaccel(), arax_pipe_get_orphan_vaccel(), arax_pipe_orphan_stop(), arax_pipe_remove_orphan_vaccel(), arax_throttle_size_dec(), and arax_throttle_size_inc().
void async_condition_notify | ( | async_condition_s * | cond | ) |
Notify cond
.
cond
must be locked using async_condition_lock().cond | Condition to be notified. |
Definition at line 76 of file spin/async.c.
References async_semaphore_inc(), and async_condition_s::semaphore.
Referenced by arax_accel_add_task(), arax_accel_add_vaccel(), arax_accel_del_vaccel(), arax_controller_init_done(), arax_pipe_add_orphan_vaccel(), arax_pipe_orphan_stop(), and arax_throttle_size_inc().
void async_condition_unlock | ( | async_condition_s * | cond | ) |
Lock on condition cond
.
cond
must be locked using async_condition_lock().cond | Condition to be read. |
Definition at line 81 of file spin/async.c.
References async_completion_complete(), and async_condition_s::mutex.
Referenced by _arax_init(), arax_accel_add_task(), arax_accel_add_vaccel(), arax_accel_del_vaccel(), arax_accel_get_assigned_vaccels(), arax_accel_wait_for_task(), ARAX_OBJ_DTOR_DECL(), arax_pipe_add_orphan_vaccel(), arax_pipe_get_orphan_vaccel(), arax_pipe_orphan_stop(), arax_pipe_remove_orphan_vaccel(), arax_throttle_size_dec(), and arax_throttle_size_inc().
void async_condition_wait | ( | async_condition_s * | cond | ) |
Wait on cond
.
cond
must be locked using async_condition_lock().cond | Condition to be read. |
Definition at line 69 of file spin/async.c.
References async_completion_complete(), async_completion_wait(), async_semaphore_dec(), async_condition_s::mutex, and async_condition_s::semaphore.
Referenced by _arax_init(), arax_accel_wait_for_task(), arax_pipe_get_orphan_vaccel(), and arax_throttle_size_dec().
void async_meta_exit | ( | async_meta_s * | meta | ) |
De initialize an async_meta_s object.
meta | The async_meta_s object to be uninitialized. |
Definition at line 86 of file spin/async.c.
References async_meta_s::fd, fd, getVmID(), async_meta_s::regs, async_meta_s::thread, and wakeupVm().
Referenced by arax_pipe_exit().
void async_meta_init_always | ( | async_meta_s * | meta | ) |
Initialize a async_meta_s object on every node.
This will be called multiple times, once for every node.
meta | An uninitialized async_meta_s object. |
Definition at line 3 of file spin/async.c.
References async_thread(), reg_fd, async_meta_s::regs, shm_file, async_meta_s::thread, utils_config_alloc_path(), utils_config_free_path(), and utils_config_get_str().
Referenced by _arax_init().
void async_meta_init_once | ( | async_meta_s * | meta, |
arch_alloc_s * | alloc ) |
Initialize a async_meta_s object once.
This will be called only once, on the first node.
meta | An uninitialized async_meta_s object. |
alloc | Allocator instance to be used for internall allocations. |
Definition at line 6 of file spin/async.c.
References async_meta_s::alloc, async_meta_s::lock, async_meta_s::outstanding, utils_config_alloc_path(), utils_config_free_path(), utils_config_get_bool(), utils_list_init(), and utils_spinlock_init.
Referenced by arax_pipe_init().
void async_semaphore_dec | ( | async_semaphore_s * | sem | ) |
Decrease semaphore.
Decrease(ie consume) sem
by one. This function will block if async_semaphore_value() == 0.
sem | Semaphore to be increased. |
Definition at line 44 of file spin/async.c.
References async_meta_s::alloc, arch_alloc_allocate(), arch_alloc_free, async_completion_init(), async_completion_wait(), getVmID(), async_semaphore_s::meta, async_completion_s::outstanding, async_semaphore_s::pending_list, async_semaphore_s::pending_lock, utils_list_add(), utils_spinlock_lock, utils_spinlock_unlock, async_semaphore_s::value, and wakeupVm().
Referenced by async_condition_wait().
void async_semaphore_inc | ( | async_semaphore_s * | sem | ) |
Increase semaphore.
Increase(ie produce) sem
by one. This function will never block.
sem | Semaphore to be increased. |
Definition at line 39 of file spin/async.c.
References _add_completion(), async_completion_complete(), utils_list_s::head, utils_list_s::length, async_semaphore_s::meta, utils_list_node::next, utils_list_node::owner, async_semaphore_s::pending_list, async_semaphore_s::pending_lock, utils_list_del(), utils_spinlock_lock, utils_spinlock_unlock, and async_semaphore_s::value.
Referenced by async_condition_notify().
void async_semaphore_init | ( | async_meta_s * | meta, |
async_semaphore_s * | sem ) |
Initialize semaphore.
meta | Pointer to async_meta_s that will 'own' this semaphore. |
sem | Semaphore to be initialized |
Definition at line 29 of file spin/async.c.
References async_semaphore_s::pending_list, async_semaphore_s::pending_lock, utils_list_init(), utils_spinlock_init, and async_semaphore_s::value.
Referenced by async_condition_init().
int async_semaphore_value | ( | async_semaphore_s * | sem | ) |
Return value of sem
.
sem | Semaphore to be initialized |
Definition at line 34 of file spin/async.c.
References async_semaphore_s::value.