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

Go to the source code of this file.

Data Structures

struct  arax_data_s
 
struct  arax_data_dtr
 

Macros

#define ARAX_BUFF_ALLOC_SIZE(SIZE, ALIGN)
 
#define ARAX_DATA_ALLOC_SIZE(DATA)
 
#define arax_data_stat(DATA)
 
#define arax_data_annotate(DATA, ...)
 

Typedefs

typedef enum arax_data_flags arax_data_flags_e
 
typedef struct arax_data_s arax_data_s
 
typedef int arax_data_sync_fn(arax_data_s *)
 
typedef struct arax_data_dtr arax_data_dtr
 

Enumerations

enum  arax_data_flags { OTHR_REMT = 4 }
 

Functions

arax_data_sarax_data_init (arax_pipe_s *vpipe, size_t size)
 
arax_data_sarax_data_init_aligned (arax_pipe_s *vpipe, size_t size, size_t align)
 
void arax_data_get (arax_data *data, void *user)
 
void arax_data_set_remote (arax_data_s *data, arax_accel *accel, void *remt)
 
void arax_data_set_accel (arax_data_s *data, arax_accel *accel)
 
void arax_data_set (arax_data *data, arax_accel *accel, const void *user)
 
void arax_data_memcpy (arax_accel *accel, arax_data_s *dst, arax_data_s *src, int block)
 
void arax_data_arg_init (arax_data_s *data, arax_accel *accel)
 
void arax_data_input_init (arax_data_s *data, arax_accel *accel)
 
void arax_data_output_init (arax_data_s *data, arax_accel *accel)
 
size_t arax_data_size (arax_data *data)
 
void arax_data_free (arax_data *data)
 
void arax_data_stat (arax_data *data, const char *file, size_t line)
 

Macro Definition Documentation

◆ ARAX_BUFF_ALLOC_SIZE

#define ARAX_BUFF_ALLOC_SIZE ( SIZE,
ALIGN )
Value:
( (SIZE) + (ALIGN) + sizeof(size_t *) )

Calculate allocation size for a buffer of size SIZE and alignment ALIGN.

Definition at line 16 of file arax_data.h.

Referenced by arax_data_init_aligned().

◆ ARAX_DATA_ALLOC_SIZE

#define ARAX_DATA_ALLOC_SIZE ( DATA)
Value:
( arax_data_size(DATA) ), \
(((arax_data_s *) (DATA))->align) \
)
#define ARAX_BUFF_ALLOC_SIZE(SIZE, ALIGN)
Definition arax_data.h:16
size_t arax_data_size(arax_data *data)
Definition arax_data.c:251

Calculate allocation size for arax_data_s DATA.

Definition at line 21 of file arax_data.h.

◆ arax_data_annotate

#define arax_data_annotate ( DATA,
... )

Definition at line 158 of file arax_data.h.

Referenced by arax_task_alloc().

◆ arax_data_stat

#define arax_data_stat ( DATA)
Value:
arax_data_stat(DATA, __FILE__, __LINE__);
#define arax_data_stat(DATA)
Definition arax_data.h:152

Definition at line 152 of file arax_data.h.

Typedef Documentation

◆ arax_data_dtr

typedef struct arax_data_dtr arax_data_dtr

Definition at line 53 of file arax_data.h.

◆ arax_data_flags_e

◆ arax_data_s

typedef struct arax_data_s arax_data_s

Definition at line 32 of file arax_data.h.

◆ arax_data_sync_fn

typedef int arax_data_sync_fn(arax_data_s *)

Definition at line 34 of file arax_data.h.

Enumeration Type Documentation

◆ arax_data_flags

Enumerator
OTHR_REMT 

Definition at line 27 of file arax_data.h.

Function Documentation

◆ arax_data_arg_init()

void arax_data_arg_init ( arax_data_s * data,
arax_accel * accel )

Definition at line 220 of file arax_data.c.

References arax_assert, arax_assert_obj, arax_data_migrate_accel(), and ARAX_TYPE_DATA.

+ Here is the call graph for this function:

◆ arax_data_free()

void arax_data_free ( arax_data * data)

Mark data for deletion.

Definition at line 325 of file arax_data.c.

References arax_assert_obj, arax_object_ref_dec(), ARAX_TYPE_DATA, and arax_data_s::obj.

+ Here is the call graph for this function:

◆ arax_data_get()

void arax_data_get ( arax_data * data,
void * user )

Get the data of data, and copy them to user.

Note
This is a blocking call.
Parameters
dataA valid arax_data_s instance.
userAn allocated memory of at least arax_data_size() bytes.

Definition at line 52 of file arax_data.c.

References arax_data_s::accel, arax_assert, arax_assert_obj, arax_data_size(), arax_proc_get(), arax_proc_put(), arax_task_free(), arax_task_host_data(), arax_task_issue(), arax_task_wait(), ARAX_TYPE_DATA, and task_completed.

Referenced by arax_data_memcpy().

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

◆ arax_data_init()

arax_data_s * arax_data_init ( arax_pipe_s * vpipe,
size_t size )

Initialize a new arax_data_s object.

Parameters
vpipeValid arax_pipe_s instance.
sizeSize of data in bytes.

Definition at line 16 of file arax_data.c.

References arax_data_init_aligned(), and vpipe.

Referenced by ARAX_BUFFER().

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

◆ arax_data_init_aligned()

arax_data_s * arax_data_init_aligned ( arax_pipe_s * vpipe,
size_t size,
size_t align )

Initialize a new arax_data_s object, with an aligned buffer.

Parameters
vpipeValid arax_pipe_s instance.
sizeSize of data in bytes.
alignalignment of buffer in bytes, power of two.

Definition at line 21 of file arax_data.c.

References arax_data_s::align, arax_assert, ARAX_BUFF_ALLOC_SIZE, arax_object_register(), ARAX_TYPE_DATA, arax_data_s::buffer, arax_data_s::flags, arax_data_s::phys, arax_data_s::size, and vpipe.

Referenced by arax_data_init().

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

◆ arax_data_input_init()

void arax_data_input_init ( arax_data_s * data,
arax_accel * accel )

Definition at line 229 of file arax_data.c.

References arax_assert, arax_assert_obj, arax_data_migrate_accel(), arax_object_ref_inc(), ARAX_TYPE_DATA, and arax_data_s::obj.

Referenced by arax_task_alloc().

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

◆ arax_data_memcpy()

void arax_data_memcpy ( arax_accel * accel,
arax_data_s * dst,
arax_data_s * src,
int block )

Copy data of src to dst.

@Note src and dst must have the same size. @Note If src and dst are the same, function is no-op.

Parameters
accelAccelerator/fifo to use.
dstDestination buffer.
srcSource buffer.
blockIf true function returns only when copy has completed.

Definition at line 95 of file arax_data.c.

References arax_assert, arax_assert_obj, arax_data_deref(), arax_data_get(), arax_data_set(), arax_data_size(), ARAX_TYPE_DATA, and arax_data_s::flags.

+ Here is the call graph for this function:

◆ arax_data_output_init()

void arax_data_output_init ( arax_data_s * data,
arax_accel * accel )

Definition at line 240 of file arax_data.c.

References arax_assert, arax_assert_obj, arax_data_migrate_accel(), arax_object_ref_inc(), ARAX_TYPE_DATA, and arax_data_s::obj.

Referenced by arax_task_alloc().

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

◆ arax_data_set()

void arax_data_set ( arax_data * data,
arax_accel * accel,
const void * user )

Copy data from user to 'c data.

Note
This is a NON blocking call.
Parameters
dataA valid arax_data_s instance.
accelAccelerator/fifo to use.
userAn allocated memory of at least arax_data_size() bytes.

Definition at line 75 of file arax_data.c.

References arax_data_s::accel, arax_assert, arax_assert_obj, arax_data_size(), arax_object_ref_inc(), arax_proc_get(), arax_proc_put(), arax_task_issue(), and ARAX_TYPE_DATA.

Referenced by arax_data_memcpy().

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

◆ arax_data_set_accel()

void arax_data_set_accel ( arax_data_s * data,
arax_accel * accel )

Set accelerator to data and increment reference counters.

Parameters
dataA valid arax_data_s instance.
accelAccelerator/fifo to use.

Definition at line 195 of file arax_data.c.

References arax_data_s::accel, arax_assert_obj, arax_object_ref_inc(), ARAX_TYPE_DATA, and ARAX_TYPE_VIRT_ACCEL.

+ Here is the call graph for this function:

◆ arax_data_set_remote()

void arax_data_set_remote ( arax_data_s * data,
arax_accel * accel,
void * remt )

Set data remote (accelerator) buffer to point to remt, owned by accel.

Note
This call only be called for arax_data that have no alocated remote buffers (i.e. arax_data_has_remote() returns 0)
Parameters
dataArax data.

Definition at line 206 of file arax_data.c.

References arax_data_s::accel, arax_assert, arax_assert_obj, arax_object_ref_inc(), ARAX_TYPE_DATA, ARAX_TYPE_VIRT_ACCEL, CPU, arax_data_s::flags, OTHR_REMT, and arax_data_s::remote.

+ Here is the call graph for this function:

◆ arax_data_size()

size_t arax_data_size ( arax_data * data)

Return size of provided arax_data object.

Parameters
dataValid arax_data pointer.
Returns
Return size of data of provided arax_data object.

Definition at line 251 of file arax_data.c.

References arax_assert_obj, ARAX_TYPE_DATA, and arax_data_s::size.

Referenced by arax_data_allocate_remote(), arax_data_get(), arax_data_memcpy(), arax_data_ref_offset(), arax_data_set(), arax_data_stat(), and ARAX_OBJ_DTOR_DECL().

+ Here is the caller graph for this function:

◆ arax_data_stat()

void arax_data_stat ( arax_data * data,
const char * file,
size_t line )

Print debug info for 'c data.

Definition at line 346 of file arax_data.c.

References arax_assert_obj, arax_data_deref(), arax_data_size(), ARAX_TYPE_DATA, arax_data_s::flags, and OTHR_REMT.

+ Here is the call graph for this function: