![]() |
Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
|
Go to the source code of this file.
Data Structures | |
struct | arax_accel_s |
Macros | |
#define | ARAX_THROTTLE_DEBUG_ACCEL_PARAMS |
#define | ARAX_THROTTLE_DEBUG_ACCEL_FUNC(FUNC) |
Typedefs | |
typedef struct arax_accel_s | arax_accel_s |
#define ARAX_THROTTLE_DEBUG_ACCEL_FUNC | ( | FUNC | ) |
Definition at line 97 of file arax_accel.h.
#define ARAX_THROTTLE_DEBUG_ACCEL_PARAMS |
Definition at line 96 of file arax_accel.h.
Referenced by arax_accel_size_dec(), and arax_accel_size_inc().
typedef struct arax_accel_s arax_accel_s |
Definition at line 4 of file arax_accel.h.
void arax_accel_add_task | ( | arax_accel_s * | accel | ) |
Increase the number of tasks of accel
and notify blocked arax_accel_wait_for_task()
callers.
This function increases the number of pending tasks of this arax_accel_s (arax_accel_s::tasks
).
Definition at line 38 of file arax_accel.c.
References async_condition_lock(), async_condition_notify(), async_condition_unlock(), arax_accel_s::lock, and arax_accel_s::tasks.
Referenced by arax_vaccel_add_task().
void arax_accel_add_vaccel | ( | arax_accel_s * | accel, |
arax_vaccel_s * | vaccel ) |
Add (register) a virtual accell vaccel
to physical accelerator accel
.
If vaccel
is already assigned to accel
, the function is no-op. If vaccel
is not yet assigned to any accel, it will be assigned to accel
. In any other behaviour is undefined.
accel | A physical accelerator |
vaccel | A virtual accelerator to be linked with accel |
Definition at line 108 of file arax_accel.c.
References arax_accel_inc_revision(), arax_assert, arax_assert_obj, arax_pipe_remove_orphan_vaccel(), ARAX_TYPE_PHYS_ACCEL, ARAX_TYPE_VIRT_ACCEL, arax_vaccel_queue_size(), async_condition_lock(), async_condition_notify(), async_condition_unlock(), arax_accel_s::lock, arax_vaccel_s::lock, arax_vaccel_s::obj, arax_vaccel_s::phys, arax_object_repo_s::pipe, arax_object_s::repo, arax_accel_s::tasks, utils_list_add(), utils_spinlock_lock, utils_spinlock_unlock, arax_accel_s::vaccels, and arax_vaccel_s::vaccels.
Referenced by arax_accel_set_physical(), and arax_vaccel_init().
void arax_accel_del_vaccel | ( | arax_accel_s * | accel, |
arax_vaccel_s * | vaccel ) |
Delete (unregister) a virtual accell vaccel
from physical accelerator accel
.
accel | A physical accelerator |
vaccel | A virtual accelerator to be unlinked from accel |
Definition at line 156 of file arax_accel.c.
References arax_accel_inc_revision(), arax_assert, arax_assert_obj, ARAX_TYPE_PHYS_ACCEL, ARAX_TYPE_VIRT_ACCEL, arax_vaccel_queue_size(), async_condition_lock(), async_condition_notify(), async_condition_unlock(), arax_accel_s::lock, arax_vaccel_s::lock, arax_vaccel_s::phys, arax_accel_s::tasks, utils_list_del(), utils_spinlock_lock, utils_spinlock_unlock, arax_accel_s::vaccels, and arax_vaccel_s::vaccels.
Referenced by ARAX_OBJ_DTOR_DECL().
size_t arax_accel_get_assigned_vaccels | ( | arax_accel_s * | accel, |
arax_vaccel_s *** | vaccel ) |
Return all arax_vaccel_s objects 'assigned' to accel
.
The initial value of vaccel
does not matter. The value of vaccel
will be overwriten by a malloc call. After the call, the user is responsible for freeing vaccel
using free()
.
vaccel | Pointer to unallocated array that will contain assigned arax_vaccel_sobjects. |
Definition at line 143 of file arax_accel.c.
References async_condition_lock(), async_condition_unlock(), utils_list_s::length, arax_accel_s::lock, utils_list_to_array(), and arax_accel_s::vaccels.
size_t arax_accel_get_available_size | ( | arax_accel * | accel | ) |
Gets available size of GPU
accel | A physical accelerator |
Definition at line 67 of file arax_accel.c.
References arax_assert_obj, arax_throttle_get_available_size(), ARAX_TYPE_PHYS_ACCEL, and arax_accel_s::throttle.
const char * arax_accel_get_name | ( | arax_accel_s * | accel | ) |
Get name.
Definition at line 83 of file arax_accel.c.
References arax_assert_obj, ARAX_TYPE_PHYS_ACCEL, arax_object_s::name, and arax_accel_s::obj.
Referenced by arax_pipe_find_accel().
size_t arax_accel_get_revision | ( | arax_accel_s * | accel | ) |
Get 'revision' of accelerator.
accel | A physical accelerator |
Definition at line 102 of file arax_accel.c.
References arax_assert_obj, ARAX_TYPE_PHYS_ACCEL, and arax_accel_s::revision.
arax_accel_state_e arax_accel_get_stat | ( | arax_accel_s * | accel, |
arax_accel_stats_s * | stat ) |
Get stats.
accel | A physical accelerator |
Definition at line 89 of file arax_accel.c.
References arax_assert_obj, ARAX_TYPE_PHYS_ACCEL, and arax_accel_s::state.
Referenced by arax_accel_stat(), and arax_vaccel_get_stat().
size_t arax_accel_get_total_size | ( | arax_accel * | accel | ) |
Gets available size of GPU
accel | A physical accelerator |
Definition at line 75 of file arax_accel.c.
References arax_assert_obj, arax_throttle_get_total_size(), ARAX_TYPE_PHYS_ACCEL, and arax_accel_s::throttle.
void arax_accel_inc_revision | ( | arax_accel_s * | accel | ) |
Increase 'revision' of accelerator.
accel | A physical accelerator |
Definition at line 96 of file arax_accel.c.
References arax_assert_obj, ARAX_TYPE_PHYS_ACCEL, and arax_accel_s::revision.
Referenced by arax_accel_add_vaccel(), and arax_accel_del_vaccel().
arax_accel_s * arax_accel_init | ( | arax_pipe_s * | pipe, |
const char * | name, | ||
arax_accel_type_e | type, | ||
size_t | size, | ||
size_t | capacity ) |
Allocate and initialize a arax_accel descriptor with the provided arguments. @pipe A valid arax_pipe_s* instance. @pipe Name of new accelerator. @type Accelerator type/architecture. @size Available accelerator memory in bytes.
Definition at line 5 of file arax_accel.c.
References accel_idle, arax_object_register(), arax_throttle_init(), ARAX_TYPE_PHYS_ACCEL, arax_vaccel_init(), arax_pipe::async, async_condition_init(), arax_accel_s::free_vaq, arax_accel_s::lock, arax_pipe::objs, arax_accel_s::revision, arax_accel_s::state, arax_accel_s::tasks, arax_accel_s::throttle, arax_accel_s::type, utils_list_init(), and arax_accel_s::vaccels.
size_t arax_accel_pending_tasks | ( | arax_accel_s * | accel | ) |
Return pending tasks for accel
.
Definition at line 46 of file arax_accel.c.
References arax_accel_s::tasks.
void ARAX_THROTTLE_DEBUG_ACCEL_FUNC arax_accel_size_dec | ( | arax_accel * | accel, |
size_t sz | ARAX_THROTTLE_DEBUG_ACCEL_PARAMS ) |
Decrements available size of gpu by sz
accel | A physical accelerator |
sz | size of removed data |
Definition at line 59 of file arax_accel.c.
References arax_accel_size_dec(), arax_assert_obj, ARAX_THROTTLE_DEBUG_ACCEL_PARAMS, arax_throttle_size_dec(), ARAX_TYPE_PHYS_ACCEL, and arax_accel_s::throttle.
Referenced by arax_accel_size_dec(), and arax_data_allocate_remote().
void ARAX_THROTTLE_DEBUG_ACCEL_FUNC arax_accel_size_inc | ( | arax_accel * | accel, |
size_t sz | ARAX_THROTTLE_DEBUG_ACCEL_PARAMS ) |
Increments available size of accelerator by sz
accel | A physical accelerator |
sz | Size of added data |
Definition at line 51 of file arax_accel.c.
References arax_accel_size_inc(), arax_assert_obj, ARAX_THROTTLE_DEBUG_ACCEL_PARAMS, arax_throttle_size_inc(), ARAX_TYPE_PHYS_ACCEL, and arax_accel_s::throttle.
Referenced by arax_accel_size_inc().
void arax_accel_wait_for_task | ( | arax_accel_s * | accel | ) |
Block until a task is added to any of the arax_vaccel_s assigned to accel
.
This function reduces the number of pending tasks of this arax_accel_s (arax_accel_s::tasks
).
Definition at line 26 of file arax_accel.c.
References async_condition_lock(), async_condition_unlock(), async_condition_wait(), arax_accel_s::lock, and arax_accel_s::tasks.