11 #ifndef COM_AXIS_LAROD_H 12 #define COM_AXIS_LAROD_H 19 #include "larod-version.h" 28 #define LAROD_TENSOR_MAX_LEN 12 33 #define LAROD_INVALID_MODEL_ID UINT64_MAX 38 #define LAROD_INVALID_FD (INT_MIN) 61 #define LAROD_FD_PROP_READWRITE (UINT32_C(1) << 0) 63 #define LAROD_FD_PROP_MAP (UINT32_C(1) << 1) 65 #define LAROD_FD_PROP_DMABUF (UINT32_C(1) << 2) 77 #define LAROD_FD_TYPE_DMA (LAROD_FD_PROP_DMABUF | LAROD_FD_PROP_MAP) 79 #define LAROD_FD_TYPE_DISK (LAROD_FD_PROP_READWRITE | LAROD_FD_PROP_MAP) 112 LAROD_ACCESS_USER_PROTECTED = 3
590 const char* name,
const larodMap* params,
626 const char* name,
const larodMap* params,
971 const uint32_t fdPropFlags,
972 size_t* numTensors,
larodMap* params,
1021 const uint32_t fdPropFlags,
1022 size_t* numTensors,
larodMap* params,
1124 const size_t width,
const size_t height,
1125 const size_t num_channels,
larodError** error);
1181 const larodTensorLayout layout,
const size_t pitch,
1182 const size_t height,
const size_t num_channels,
1216 const larodTensorDataType dataType,
1604 const int64_t value1,
const int64_t value2,
1717 size_t numOutputs,
larodMap* params,
1763 const size_t numTensors,
larodError** error);
1780 const size_t numTensors,
larodError** error);
1938 #endif // COM_AXIS_LAROD_H const larodTensorDims * larodGetTensorDims(const larodTensor *tensor, larodError **error)
Get dimensions of a tensor.
64-bit unsigned integer.
Definition: larod.h:183
bool larodSetJobRequestInputs(larodJobRequest *jobReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set input tensor array in a request.
Tensor mismatch.
Definition: larod.h:152
Max errno value (dummy value).
Definition: larod.h:160
int larodGetTensorFd(const larodTensor *tensor, larodError **error)
Get file descriptor of a tensor.
size_t larodGetModelNumInputs(const larodModel *model, larodError **error)
Get number of input tensors for a model.
Public for all sessions owned by the same creating user.
Definition: larod.h:110
Error while allocating.
Definition: larod.h:156
const larodDevice * larodGetDevice(const larodConnection *conn, const char *name, const uint32_t instance, larodError **error)
Get an available device.
void larodDestroyMap(larodMap **map)
Destroy a larodMap.
size_t * larodGetModelOutputByteSizes(const larodModel *model, size_t *numOutputs, larodError **error)
Get output tensor byte sizes for a model.
Insufficient permissions.
Definition: larod.h:138
bool larodSetTensorFdSize(larodTensor *tensor, const size_t size, larodError **error)
Set file descriptor maximum capacity (bytes) for a tensor.
64-bit signed integer.
Definition: larod.h:184
16-bit unsigned integer.
Definition: larod.h:179
const char * larodMapGetStr(larodMap *map, const char *key, larodError **error)
Get string type value tied to given key.
size_t larodGetModelSize(const larodModel *model, larodError **error)
Get model size.
larodMap * larodCreateMap(larodError **error)
Create new larodMap.
size_t len
Length of pitches array.
Definition: larod.h:331
bool larodDeleteModel(larodConnection *conn, larodModel *model, larodError **error)
Delete a loaded model.
larodTensorDataType larodGetTensorDataType(const larodTensor *tensor, larodError **error)
Get data type of a tensor.
larodTensor ** larodCreateModelOutputs(const larodModel *model, size_t *numTensors, larodError **error)
Create output tensors from a model.
bool larodBuildTensorPitches(larodTensor *tensor, const larodTensorLayout layout, const size_t pitch, const size_t height, const size_t num_channels, larodError **error)
Set picthes for a tensor.
16-bit floating point.
Definition: larod.h:185
larodTensor ** larodCreateTensors(size_t numTensors, larodError **error)
Create a list of empty larodTensor handles.
bool larodSetTensorDims(larodTensor *tensor, const larodTensorDims *dims, larodError **error)
Set the dimensions of a tensor.
uint64_t larodGetModelId(const larodModel *model, larodError **error)
Get model ID.
32-bit signed integer.
Definition: larod.h:182
larodErrorCode code
Error code.
Definition: larod.h:254
size_t len
Length of dims array.
Definition: larod.h:277
bool larodSetJobRequestPriority(larodJobRequest *jobReq, const uint8_t priority, larodError **error)
Set an priority of a job request.
Invalid access specifier.
Definition: larod.h:148
8-bit unsigned integer.
Definition: larod.h:177
bool larodMapGetInt(larodMap *map, const char *key, int64_t *value, larodError **error)
Get an integer type value tied to given key.
bool larodMapSetIntArr4(larodMap *map, const char *key, const int64_t value0, const int64_t value1, const int64_t value2, const int64_t value3, larodError **error)
Add an integer array of four elements to a larodMap object.
bool larodDisconnect(larodConnection **conn, larodError **error)
Disconnect from larod.
Version mismatch.
Definition: larod.h:154
16-bit signed integer.
Definition: larod.h:180
void(* larodLoadModelCallback)(larodModel *model, void *userData, larodError *error)
Callback used in larodLoadModelAsync().
Definition: larod.h:368
larodTensorLayout
Enum type for specifying tensor layout.
Definition: larod.h:225
bool larodSetTensorFdOffset(larodTensor *tensor, const int64_t offset, larodError **error)
Set file offset for a tensor.
bool larodLoadModelAsync(larodConnection *conn, const int inFd, const larodDevice *dev, const larodAccess access, const char *name, const larodMap *params, larodLoadModelCallback callback, void *userData, larodError **error)
Load a new model asynchronously.
Power not available.
Definition: larod.h:158
General error for loading model.
Definition: larod.h:132
bool larodSetTensorDataType(larodTensor *tensor, const larodTensorDataType dataType, larodError **error)
Set data type of a tensor.
larodTensor ** larodAllocModelOutputs(larodConnection *conn, const larodModel *model, const uint32_t fdPropFlags, size_t *numTensors, larodMap *params, larodError **error)
Create and allocate output tensors from a model.
bool larodGetTensorFdSize(const larodTensor *tensor, size_t *size, larodError **error)
Get file descriptor maximum capacity (bytes) for a tensor.
#define LAROD_TENSOR_MAX_LEN
Maximum number of dimensions of a larodTensor.
Definition: larod.h:28
bool larodMapSetIntArr2(larodMap *map, const char *key, const int64_t value0, const int64_t value1, larodError **error)
Add an integer array of two elements to a larodMap object.
bool larodSetTensorLayout(larodTensor *tensor, const larodTensorLayout layout, larodError **error)
Set layout of a tensor.
Max enum (dummy value).
Definition: larod.h:243
General error for job.
Definition: larod.h:130
Invalid access.
Definition: larod.h:107
const char * larodGetTensorName(const larodTensor *tensor, larodError **error)
Get name of tensor.
int larodConvertVmemFdToDmabuf(const int fd, const int64_t offset, larodError **error)
Convert vmem file descriptor to a dmabuf file descriptor.
const int64_t * larodMapGetIntArr4(larodMap *map, const char *key, larodError **error)
Get an integer array of four elements tied to given key.
Invalid chip ID.
Definition: larod.h:146
struct larodDevice larodDevice
A type for representing a device.
Definition: larod.h:97
larodTensor ** larodCreateModelInputs(const larodModel *model, size_t *numTensors, larodError **error)
Create input tensors from a model.
larodTensor ** larodAllocModelInputs(larodConnection *conn, const larodModel *model, const uint32_t fdPropFlags, size_t *numTensors, larodMap *params, larodError **error)
Create and allocate input tensors from a model.
larodJobRequest * larodCreateJobRequest(const larodModel *model, larodTensor **inputTensors, size_t numInputs, larodTensor **outputTensors, size_t numOutputs, larodMap *params, larodError **error)
Create and initialize a job request handle.
A type containing information about a tensor's dimensions.
Definition: larod.h:275
bool larodBuildTensorDims(larodTensor *tensor, const larodTensorLayout layout, const size_t width, const size_t height, const size_t num_channels, larodError **error)
Set the dimensions of a tensor.
struct larodModel larodModel
A type representing a model.
Definition: larod.h:343
larodTensorDataType
Enum type for specifying tensor data type.
Definition: larod.h:173
bool larodSetJobRequestParams(larodJobRequest *jobReq, const larodMap *params, larodError **error)
Set additional parameters to a job request.
larodErrorCode
Enum type for error codes.
Definition: larod.h:126
const char * msg
Error message.
Definition: larod.h:255
32-bit floating point.
Definition: larod.h:186
larodTensorLayout larodGetTensorLayout(const larodTensor *tensor, larodError **error)
Get layout of a tensor.
bool larodSetTensorFdProps(larodTensor *tensor, const uint32_t fdPropFlags, larodError **error)
Set the properties for a file descriptor of a tensor.
Type containing error information.
Definition: larod.h:253
larodAccess
Enum type for specifying access.
Definition: larod.h:106
bool larodSetJobRequestOutputs(larodJobRequest *jobReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set output tensor array in a job request.
bool larodGetTensorFdProps(const larodTensor *tensor, uint32_t *fdPropFlags, larodError **error)
Get the properties of a file descriptor of a tensor.
64-bit floating point.
Definition: larod.h:187
const int64_t * larodMapGetIntArr2(larodMap *map, const char *key, larodError **error)
Get an integer array of two elements tied to given key.
bool larodRunJobAsync(larodConnection *conn, const larodJobRequest *jobReq, larodRunJobCallback callback, void *userData, larodError **error)
Run a job on a loaded model asynchronously.
larodAccess larodGetModelAccess(const larodModel *model, larodError **error)
Get model access mode.
bool larodSetJobRequestModel(larodJobRequest *jobReq, const larodModel *model, larodError **error)
Set model in a request.
bool larodTrackTensor(larodConnection *conn, larodTensor *tensor, larodError **error)
Start tracking a tensor in the service.
struct larodTensor larodTensor
A type representing a tensor.
Definition: larod.h:416
const larodDevice * larodGetModelDevice(const larodModel *model, larodError **error)
Get device for a model.
void larodClearError(larodError **error)
Deallocate an error handle.
bool larodMapSetInt(larodMap *map, const char *key, const int64_t value, larodError **error)
Add an integer to a larodMap object.
const char * larodGetDeviceName(const larodDevice *dev, larodError **error)
Get the name of a device.
larodModel * larodGetModel(larodConnection *conn, const uint64_t modelId, larodError **error)
Get handle to a model by model ID.
struct larodMap larodMap
A type containing key-value pairs.
Definition: larod.h:427
No layout is specified.
Definition: larod.h:227
bool larodMapSetStr(larodMap *map, const char *key, const char *value, larodError **error)
Add a string to a larodMap object.
const char * larodGetModelName(const larodModel *model, larodError **error)
Get model name.
Error regarding file descriptors.
Definition: larod.h:134
Invalid layout.
Definition: larod.h:226
32-bit unsigned integer.
Definition: larod.h:181
bool larodDestroyTensors(larodConnection *conn, larodTensor ***tensors, size_t numTensors, larodError **error)
Destroy a list of larodTensor.
void larodDestroyModel(larodModel **model)
Free an allocated larodModel handle.
Error while deleting model.
Definition: larod.h:150
Failed killing session.
Definition: larod.h:144
bool larodExportModel(larodConnection *conn, const int modelFd, const int outputFd, const larodDevice *dev, const larodMap *params, larodError **error)
Export a model to the device's native format.
size_t larodGetModelNumOutputs(const larodModel *model, larodError **error)
Get number of output tensors for a model.
void larodDestroyModels(larodModel ***models, size_t numModels)
Destroy a list of model objects.
larodModel * larodLoadModel(larodConnection *conn, const int fd, const larodDevice *dev, const larodAccess access, const char *name, const larodMap *params, larodError **error)
Load a new model.
bool larodConnect(larodConnection **conn, larodError **error)
Connect to larod.
void(* larodRunJobCallback)(void *userData, larodError *error)
Callback used in larodRunJobAsync().
Definition: larod.h:392
bool larodGetTensorByteSize(const larodTensor *tensor, size_t *byteSize, larodError **error)
Get byte size of tensor.
Invalid data type.
Definition: larod.h:174
struct larodConnection larodConnection
Connection handle type for the larod service.
Definition: larod.h:400
Max enum (dummy value).
Definition: larod.h:188
bool larodSetTensorFd(larodTensor *tensor, const int fd, larodError **error)
Set file descriptor of a tensor.
1-bit boolean.
Definition: larod.h:176
bool larodGetDeviceInstance(const larodDevice *dev, uint32_t *instance, larodError **error)
Get the instance number of a device.
int64_t larodGetTensorFdOffset(const larodTensor *tensor, larodError **error)
Get file offset for a tensor.
bool larodGetNumSessions(larodConnection *conn, uint64_t *numSessions, larodError **error)
Get number of currently active sessions in larod.
bool larodSetTensorPitches(larodTensor *tensor, const larodTensorPitches *pitches, larodError **error)
Set pitches of a tensor.
No errors.
Definition: larod.h:128
Model was not found.
Definition: larod.h:136
bool larodRunJob(larodConnection *conn, const larodJobRequest *jobReq, larodError **error)
Run a job on a loaded model.
larodModel ** larodGetModels(larodConnection *conn, size_t *numModels, larodError **error)
Get all loaded models.
Could not create session.
Definition: larod.h:142
void larodDestroyJobRequest(larodJobRequest **jobReq)
Destroy a request handle.
size_t * larodGetModelInputByteSizes(const larodModel *model, size_t *numInputs, larodError **error)
Get input tensor byte sizes for a model.
const larodDevice ** larodListDevices(larodConnection *conn, size_t *numDevices, larodError **error)
List available devices.
8-bit signed integer.
Definition: larod.h:178
Invalid connection.
Definition: larod.h:140
A type containing information about a tensor's pitches.
Definition: larod.h:329
No data type is specified.
Definition: larod.h:175
struct larodJobRequest larodJobRequest
Type describing a job request.
Definition: larod.h:407
const larodTensorPitches * larodGetTensorPitches(const larodTensor *tensor, larodError **error)
Get pitches of a tensor.