Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
GNA Interface

Data Structures

struct  gna_config
 
struct  gna_model_header
 
struct  gna_model_info
 
struct  gna_inference_req
 
struct  gna_inference_stats
 
struct  gna_inference_resp
 

Enumerations

enum  gna_result {
  GNA_RESULT_INFERENCE_COMPLETE , GNA_RESULT_SATURATION_OCCURRED , GNA_RESULT_OUTPUT_BUFFER_FULL_ERROR , GNA_RESULT_PARAM_OUT_OF_RANGE_ERROR ,
  GNA_RESULT_GENERIC_ERROR
}
 

Functions

static int gna_configure (const struct device *dev, struct gna_config *cfg)
 Configure the GNA device. More...
 
static int gna_register_model (const struct device *dev, struct gna_model_info *model, void **model_handle)
 Register a neural network model. More...
 
static int gna_deregister_model (const struct device *dev, void *model)
 De-register a previously registered neural network model. More...
 
static int gna_infer (const struct device *dev, struct gna_inference_req *req, gna_callback callback)
 Perform inference on a model with input vectors. More...
 

Detailed Description

This file contains the driver APIs for Intel's Gaussian Mixture Model and Neural Network Accelerator (GNA)

Enumeration Type Documentation

◆ gna_result

enum gna_result

#include <include/drivers/gna.h>

Result of an inference operation

Enumerator
GNA_RESULT_INFERENCE_COMPLETE 
GNA_RESULT_SATURATION_OCCURRED 
GNA_RESULT_OUTPUT_BUFFER_FULL_ERROR 
GNA_RESULT_PARAM_OUT_OF_RANGE_ERROR 
GNA_RESULT_GENERIC_ERROR 

Function Documentation

◆ gna_configure()

static int gna_configure ( const struct device dev,
struct gna_config cfg 
)
inlinestatic

#include <include/drivers/gna.h>

Configure the GNA device.

Configure the GNA device. The GNA device must be configured before registering a model or performing inference

Parameters
devPointer to the device structure for the driver instance.
cfgDevice configuration information
Return values
0If the configuration is successful
Anegative error code in case of a failure.

◆ gna_deregister_model()

static int gna_deregister_model ( const struct device dev,
void model 
)
inlinestatic

#include <include/drivers/gna.h>

De-register a previously registered neural network model.

De-register a previously registered neural network model from the GNA device De-registration may be done to free up memory for registering another model Once de-registered, the model can no longer be used to perform inference

Parameters
devPointer to the device structure for the driver instance.
modelModel handle output by gna_register_model API
Return values
0If de-registration of the model is successful.
Anegative error code in case of a failure.

◆ gna_infer()

static int gna_infer ( const struct device dev,
struct gna_inference_req req,
gna_callback  callback 
)
inlinestatic

#include <include/drivers/gna.h>

Perform inference on a model with input vectors.

Make an inference request on a previously registered model with an of input data vector A callback is provided for notification of inference completion

Parameters
devPointer to the device structure for the driver instance.
reqInformation required to perform inference on a neural network
callbackA callback function to notify inference completion
Return values
0If the request is accepted
Anegative error code in case of a failure.

◆ gna_register_model()

static int gna_register_model ( const struct device dev,
struct gna_model_info model,
void **  model_handle 
)
inlinestatic

#include <include/drivers/gna.h>

Register a neural network model.

Register a neural network model with the GNA device A model needs to be registered before it can be used to perform inference

Parameters
devPointer to the device structure for the driver instance.
modelInformation about the neural network model
model_handleHandle to the registered model if registration succeeds
Return values
0If registration of the model is successful.
Anegative error code in case of a failure.