Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
Loading...
Searching...
No Matches
arax_accel.h File Reference
#include <arax.h>
#include "async.h"
#include "core/arax_vaccel.h"
#include "core/arax_throttle.h"
+ Include dependency graph for arax_accel.h:
+ This graph shows which files directly or indirectly include this file:

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
 

Functions

arax_accel_sarax_accel_init (arax_pipe_s *pipe, const char *name, arax_accel_type_e type, size_t size, size_t capacity)
 
void arax_accel_wait_for_task (arax_accel_s *accel)
 
void arax_accel_add_task (arax_accel_s *accel)
 
size_t arax_accel_pending_tasks (arax_accel_s *accel)
 
const char * arax_accel_get_name (arax_accel_s *accel)
 
arax_accel_state_e arax_accel_get_stat (arax_accel_s *accel, arax_accel_stats_s *stat)
 
void arax_accel_inc_revision (arax_accel_s *accel)
 
size_t arax_accel_get_revision (arax_accel_s *accel)
 
void ARAX_THROTTLE_DEBUG_ACCEL_FUNC arax_accel_size_inc (arax_accel *accel, size_t sz ARAX_THROTTLE_DEBUG_ACCEL_PARAMS)
 
void ARAX_THROTTLE_DEBUG_ACCEL_FUNC arax_accel_size_dec (arax_accel *accel, size_t sz ARAX_THROTTLE_DEBUG_ACCEL_PARAMS)
 
size_t arax_accel_get_available_size (arax_accel *accel)
 
size_t arax_accel_get_total_size (arax_accel *accel)
 
void arax_accel_add_vaccel (arax_accel_s *accel, arax_vaccel_s *vaccel)
 
size_t arax_accel_get_assigned_vaccels (arax_accel_s *accel, arax_vaccel_s ***vaccel)
 
void arax_accel_del_vaccel (arax_accel_s *accel, arax_vaccel_s *vaccel)
 

Macro Definition Documentation

◆ ARAX_THROTTLE_DEBUG_ACCEL_FUNC

#define ARAX_THROTTLE_DEBUG_ACCEL_FUNC ( FUNC)
Value:
FUNC

Definition at line 97 of file arax_accel.h.

◆ ARAX_THROTTLE_DEBUG_ACCEL_PARAMS

#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 Documentation

◆ arax_accel_s

typedef struct arax_accel_s arax_accel_s

Definition at line 4 of file arax_accel.h.

Function Documentation

◆ arax_accel_add_task()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ arax_accel_add_vaccel()

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.

Note
This call should be matched to calls of arax_accel_del_vaccel()
Parameters
accelA physical accelerator
vaccelA 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ arax_accel_del_vaccel()

void arax_accel_del_vaccel ( arax_accel_s * accel,
arax_vaccel_s * vaccel )

Delete (unregister) a virtual accell vaccel from physical accelerator accel.

Note
This call should be matched to calls of arax_accel_add_vaccel()
Parameters
accelA physical accelerator
vaccelA 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ arax_accel_get_assigned_vaccels()

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().

Parameters
vaccelPointer to unallocated array that will contain assigned arax_vaccel_sobjects.
Returns
Size of vaccel array, in number of objects/pointers.

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.

+ Here is the call graph for this function:

◆ arax_accel_get_available_size()

size_t arax_accel_get_available_size ( arax_accel * accel)

Gets available size of GPU

Parameters
accelA physical accelerator
Returns
Avaliable size of 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.

+ Here is the call graph for this function:

◆ arax_accel_get_name()

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().

+ Here is the caller graph for this function:

◆ arax_accel_get_revision()

size_t arax_accel_get_revision ( arax_accel_s * accel)

Get 'revision' of accelerator.

Parameters
accelA physical accelerator
Returns
Revision

Definition at line 102 of file arax_accel.c.

References arax_assert_obj, ARAX_TYPE_PHYS_ACCEL, and arax_accel_s::revision.

◆ arax_accel_get_stat()

arax_accel_state_e arax_accel_get_stat ( arax_accel_s * accel,
arax_accel_stats_s * stat )

Get stats.

Parameters
accelA 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().

+ Here is the caller graph for this function:

◆ arax_accel_get_total_size()

size_t arax_accel_get_total_size ( arax_accel * accel)

Gets available size of GPU

Parameters
accelA physical accelerator
Returns
Total size of 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.

+ Here is the call graph for this function:

◆ arax_accel_inc_revision()

void arax_accel_inc_revision ( arax_accel_s * accel)

Increase 'revision' of accelerator.

Parameters
accelA 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().

+ Here is the caller graph for this function:

◆ arax_accel_init()

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.

Returns
An initialized arax_accel instance on success, or NULL on failure.

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.

+ Here is the call graph for this function:

◆ arax_accel_pending_tasks()

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.

◆ arax_accel_size_dec()

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

Parameters
accelA physical accelerator
szsize 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ arax_accel_size_inc()

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

Parameters
accelA physical accelerator
szSize 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ arax_accel_wait_for_task()

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.

+ Here is the call graph for this function: