11 #ifndef COM_AXIS_LAROD_H 12 #define COM_AXIS_LAROD_H 19 #include "larod-version.h" 25 #ifdef LAROD_API_VERSION_1 26 #warning "API version 1 is deprecated and will be removed soon. " \ 27 "Please update to a newer API version." 30 #if defined(LAROD_API_VERSION_1) && defined(LAROD_API_VERSION_2) 31 #error API version ambiguous, specify at most one version \ 32 (#define LAROD_API_VERSION_*) before including larod.h 38 #define LAROD_TENSOR_MAX_LEN 12 43 #define LAROD_INVALID_MODEL_ID UINT64_MAX 48 #define LAROD_INVALID_FD (INT_MIN) 71 #define LAROD_FD_PROP_READWRITE (UINT32_C(1) << 0) 73 #define LAROD_FD_PROP_MAP (UINT32_C(1) << 1) 75 #define LAROD_FD_PROP_DMABUF (UINT32_C(1) << 2) 87 #define LAROD_FD_TYPE_DMA (LAROD_FD_PROP_DMABUF | LAROD_FD_PROP_MAP) 89 #define LAROD_FD_TYPE_DISK (LAROD_FD_PROP_READWRITE | LAROD_FD_PROP_MAP) 109 #if defined(LAROD_API_VERSION_1) || defined(LAROD_API_VERSION_2) || \ 110 defined(LAROD_DOXYGEN) 177 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 480 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 502 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 629 #if defined(LAROD_API_VERSION_1) || defined(LAROD_API_VERSION_2) 644 const char* larodGetChipName(
const larodChip chip);
647 #if defined(LAROD_API_VERSION_1) || defined(LAROD_API_VERSION_2) || \ 648 defined(LAROD_DOXYGEN) 695 #if defined(LAROD_API_VERSION_1) 699 #define larodLoadModel larodLoadModel_API_VERSION_1 700 #elif defined(LAROD_API_VERSION_2) 707 #define larodLoadModel larodLoadModel_API_VERSION_2 738 const char* name,
const larodMap* params,
743 #if defined(LAROD_API_VERSION_1) 744 bool larodLoadModelAsync_API_VERSION_1(
larodConnection* conn,
const int fd,
749 #define larodLoadModelAsync larodLoadModelAsync_API_VERSION_1 750 #elif defined(LAROD_API_VERSION_2) 751 bool larodLoadModelAsync_API_VERSION_2(
larodConnection* conn,
const int fd,
754 const char* name,
const larodMap* params,
757 #define larodLoadModelAsync larodLoadModelAsync_API_VERSION_2 792 const char* name,
const larodMap* params,
902 #if defined(LAROD_API_VERSION_2) || defined(LAROD_DOXYGEN) 1158 const uint32_t fdPropFlags,
1159 size_t* numTensors,
larodMap* params,
1208 const uint32_t fdPropFlags,
1209 size_t* numTensors,
larodMap* params,
1241 #if defined(LAROD_API_VERSION_1) || defined(LAROD_API_VERSION_2) 1242 void larodDestroyTensors_API_VERSION_1(
larodTensor*** tensors,
1244 #define larodDestroyTensors larodDestroyTensors_API_VERSION_1 1368 const larodTensorDataType dataType,
1743 const int64_t value1,
const int64_t value2,
1856 size_t numOutputs,
larodMap* params,
1902 const size_t numTensors,
larodError** error);
1919 const size_t numTensors,
larodError** error);
2049 #ifdef LAROD_DOXYGEN 2081 #ifdef LAROD_DOXYGEN 2114 const char* name,
const larodMap* params,
2118 #ifdef LAROD_DOXYGEN 2148 #ifdef LAROD_DOXYGEN 2179 const char* name,
const larodMap* params,
2184 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2222 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2237 #define larodDestroyInferenceRequest larodDestroyJobRequest 2240 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2262 #define larodSetInferenceRequestModel larodSetJobRequestModel 2265 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2287 const size_t numTensors,
2289 #define larodSetInferenceRequestInputs larodSetJobRequestInputs 2292 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2314 const size_t numTensors,
2316 #define larodSetInferenceRequestOutputs larodSetJobRequestOutputs 2319 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2359 const uint8_t priority,
2361 #define larodSetInferenceRequestPriority larodSetJobRequestPriority 2364 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2398 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2444 #if defined(LAROD_API_VERSION_2) || defined(LAROD_DOXYGEN) 2449 #define larodRunJobAsync larodRunJobAsync_API_VERSION_2 2452 #if defined(LAROD_API_VERSION_2) || defined(LAROD_DOXYGEN) 2456 #define larodRunJob larodRunJob_API_VERSION_2 2459 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2478 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2497 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2519 #if defined(LAROD_API_VERSION_1) || defined(LAROD_DOXYGEN) 2538 #if defined(LAROD_DOXYGEN) 2563 #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:235
bool larodSetJobRequestInputs(larodJobRequest *jobReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set input tensor array in a request.
Dummy chip for debugging.
Definition: larod.h:124
Tensor mismatch.
Definition: larod.h:204
Max errno value (dummy value).
Definition: larod.h:212
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.
Error while allocating.
Definition: larod.h:208
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.
bool larodGetChipType(larodConnection *conn, larodChip *chipType, larodError **error)
Get current chip type in use for the session in larod.
size_t * larodGetModelOutputByteSizes(const larodModel *model, size_t *numOutputs, larodError **error)
Get output tensor byte sizes for a model.
Insufficient permissions.
Definition: larod.h:190
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:236
16-bit unsigned integer.
Definition: larod.h:231
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.
bool larodSetInferenceRequestModel(larodInferenceRequest *infReq, const larodModel *model, larodError **error)
Set model in an inference request.
size_t len
Length of pitches array.
Definition: larod.h:384
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 larodRunInference(larodConnection *conn, const larodInferenceRequest *infReq, larodError **error)
Run inference on a loaded model.
16-bit floating point.
Definition: larod.h:237
larodTensor ** larodCreateTensors(size_t numTensors, larodError **error)
Create a list of empty larodTensor handles.
Invalid chip.
Definition: larod.h:122
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:234
larodErrorCode code
Error code.
Definition: larod.h:307
size_t len
Length of dims array.
Definition: larod.h:330
bool larodSetJobRequestPriority(larodJobRequest *jobReq, const uint8_t priority, larodError **error)
Set an priority of a job request.
Invalid access specifier.
Definition: larod.h:200
8-bit unsigned integer.
Definition: larod.h:229
bool larodSetChip(larodConnection *conn, const larodChip chip, larodError **error)
Set current chip using larodChip in use for the session in larod.
bool larodListChips(larodConnection *conn, larodChip **chips, size_t *numChips, larodError **error)
List available chips.
bool larodMapGetInt(larodMap *map, const char *key, int64_t *value, larodError **error)
Get an integer type value tied to given key.
bool larodSetChipId(larodConnection *conn, const uint64_t chipId, larodError **error)
Set current chip using ID in use for the session in larod.
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:206
16-bit signed integer.
Definition: larod.h:232
void(* larodLoadModelCallback)(larodModel *model, void *userData, larodError *error)
Callback used in larodLoadModelAsync().
Definition: larod.h:420
larodTensorLayout
Enum type for specifying tensor layout.
Definition: larod.h:278
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.
Axis Compute Engine.
Definition: larod.h:137
Power not available.
Definition: larod.h:210
General error for loading model.
Definition: larod.h:184
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.
void(* larodRunInferenceCallback)(void *userData, larodError *error)
Callback used in larodRunInferenceAsync().
Definition: larod.h:499
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:38
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:296
General error for job.
Definition: larod.h:176
Invalid access.
Definition: larod.h:155
const char * larodGetTensorName(const larodTensor *tensor, larodError **error)
Get name of tensor.
Image processing using OpenCL.
Definition: larod.h:143
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:198
struct larodDevice larodDevice
A type for representing a device.
Definition: larod.h:107
bool larodSetInferenceRequestPriority(larodInferenceRequest *infReq, const uint8_t priority, larodError **error)
Set an priority of an inference request.
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:328
Ambarella CVFlow (NN).
Definition: larod.h:130
struct larodModel larodModel
A type representing a model.
Definition: larod.h:396
larodTensorDataType
Enum type for specifying tensor data type.
Definition: larod.h:225
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:172
const char * msg
Error message.
Definition: larod.h:308
32-bit floating point.
Definition: larod.h:238
larodTensorLayout larodGetTensorLayout(const larodTensor *tensor, larodError **error)
Get layout of a tensor.
struct larodJobRequest larodInferenceRequest
Type describing a job request.
Definition: larod.h:512
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:306
larodAccess
Enum type for specifying access.
Definition: larod.h:154
bool larodSetJobRequestOutputs(larodJobRequest *jobReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set output tensor array in a job request.
larodChip
Enum type with supported chips.
Definition: larod.h:120
void larodDestroyInferenceRequest(larodInferenceRequest **infReq)
Destroy an inference request handle.
ARTPEC-8 DLPU with TensorFlow Lite.
Definition: larod.h:141
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:239
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.
bool larodRunInferenceAsync(larodConnection *conn, const larodInferenceRequest *infReq, larodRunInferenceCallback callback, void *userData, larodError **error)
Run inference on a loaded model asynchronously.
struct larodTensor larodTensor
A type representing a tensor.
Definition: larod.h:467
const larodDevice * larodGetModelDevice(const larodModel *model, larodError **error)
Get device for a model.
bool larodGetChipId(larodConnection *conn, uint64_t *chipId, larodError **error)
Get current chip ID in use for the session in larod.
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:478
No layout is specified.
Definition: larod.h:280
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:186
Invalid layout.
Definition: larod.h:279
32-bit unsigned integer.
Definition: larod.h:233
larodInferenceRequest * larodCreateInferenceRequest(const larodModel *model, larodTensor **inputTensors, size_t numInputs, larodTensor **outputTensors, size_t numOutputs, larodError **error)
Create and initialize an inference request handle.
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.
bool larodSetInferenceRequestInputs(larodInferenceRequest *infReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set input tensor array in an inference request.
Error while deleting model.
Definition: larod.h:202
Failed killing session.
Definition: larod.h:196
bool larodSetInferenceRequestOutputs(larodInferenceRequest *infReq, larodTensor **tensors, const size_t numTensors, larodError **error)
Set output tensor array in an inference request.
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:443
bool larodGetTensorByteSize(const larodTensor *tensor, size_t *byteSize, larodError **error)
Get byte size of tensor.
Invalid data type.
Definition: larod.h:226
struct larodConnection larodConnection
Connection handle type for the larod service.
Definition: larod.h:451
Max enum (dummy value).
Definition: larod.h:240
bool larodSetTensorFd(larodTensor *tensor, const int fd, larodError **error)
Set file descriptor of a tensor.
1-bit boolean.
Definition: larod.h:228
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:174
Model was not found.
Definition: larod.h:188
bool larodRunJob(larodConnection *conn, const larodJobRequest *jobReq, larodError **error)
Run a job on a loaded model.
CPU with TensorFlow Lite.
Definition: larod.h:126
Google TPU.
Definition: larod.h:128
larodModel ** larodGetModels(larodConnection *conn, size_t *numModels, larodError **error)
Get all loaded models.
CPU with libyuv.
Definition: larod.h:139
Could not create session.
Definition: larod.h:194
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.
larodChip larodGetModelChip(const larodModel *model, larodError **error)
Get chip for a model.
8-bit signed integer.
Definition: larod.h:230
Ambarella CVFlow (proc).
Definition: larod.h:135
Invalid connection.
Definition: larod.h:192
A type containing information about a tensor's pitches.
Definition: larod.h:382
No data type is specified.
Definition: larod.h:227
struct larodJobRequest larodJobRequest
Type describing a job request.
Definition: larod.h:458
const larodTensorPitches * larodGetTensorPitches(const larodTensor *tensor, larodError **error)
Get pitches of a tensor.