API Reference Manual 1.51.0
Loading...
Searching...
No Matches
api/spec/ml_types.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2021-2025 Nokia
3 * Copyright (c) 2021 Marvell
4 */
5
12#ifndef ODP_API_SPEC_ML_TYPES_H_
13#define ODP_API_SPEC_ML_TYPES_H_
14#include <odp/visibility_begin.h>
15
16#include <odp/api/event_types.h>
17#include <odp/api/queue_types.h>
18#include <odp/api/std_types.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
76#define ODP_ML_ENGINE_ANY 0
77
79#define ODP_ML_MAX_DIMS 8
80
82#define ODP_ML_DIM_DYNAMIC 0
83
85#define ODP_ML_COMPL_MODE_SYNC 0x1u
86
93#define ODP_ML_COMPL_MODE_POLL 0x2u
94
101#define ODP_ML_COMPL_MODE_EVENT 0x4u
102
104typedef uint32_t odp_ml_compl_mode_t;
105
140
153 uint32_t num;
154
161 uint32_t uarea_size;
162
164 struct {
168 void (*init_fn)(void *uarea, uint32_t size, void *args, uint32_t index);
169
172 void *args;
173
175
183 uint32_t cache_size;
184
186
334
393
442
463
535
559
566
585
604
606typedef struct odp_ml_model_info_t {
609
617
626
628 uint32_t engine_id;
629
631 uint32_t index;
632
634 uint32_t num_inputs;
635
637 uint32_t num_outputs;
638
640 union {
642 struct {
652 uint32_t input_quant_info : 1;
653
663 uint32_t output_quant_info : 1;
664
665 };
666
672 uint32_t all;
673
675
677
692
795
797typedef struct odp_ml_run_result_t {
803 uint64_t error_code;
804
806 void *user_ptr;
807
809
823
883
885typedef struct odp_ml_data_seg_t {
887 void *addr;
888
890 uint64_t size;
891
893
938
963
972
977#ifdef __cplusplus
978}
979#endif
980
981#include <odp/visibility_end.h>
982#endif
ODP event API type definitions.
ODP queue.
Standard C language types and definitions for ODP.
#define ODP_ML_MAX_DIMS
Maximum number of dimensions in input / output data shape.
odp_ml_shape_type_t
Model input / output data shape type.
uint32_t odp_ml_compl_mode_t
ML completion mode.
#define ODP_ML_MODEL_IO_NAME_LEN
Maximum length of model input/output name, including the null character.
odp_ml_data_type_t
Model input / output data type enumeration.
#define ODP_ML_MODEL_NAME_LEN
Maximum length of model name, including the null character.
#define ODP_ML_SHAPE_NAME_LEN
Maximum length of data dimension name, including the null character.
#define ODP_ML_EXTRA_STAT_NAME_LEN
Maximum length of extra statistics counter name, including the null character.
@ ODP_ML_SHAPE_STATIC
Static shape of data.
@ ODP_ML_SHAPE_NONE
Type of shape is not defined.
@ ODP_ML_SHAPE_BATCH
Dynamic batch size.
@ ODP_ML_DATA_TYPE_UINT32
32-bit unsigned integer
@ ODP_ML_DATA_TYPE_FP32
32-bit floating point number
@ ODP_ML_DATA_TYPE_FP16
16-bit floating point number
@ ODP_ML_DATA_TYPE_UINT8
8-bit unsigned integer
@ ODP_ML_DATA_TYPE_UINT64
64-bit unsigned integer
@ ODP_ML_DATA_TYPE_UINT24
24-bit unsigned integer
@ ODP_ML_DATA_TYPE_UINT16
16-bit unsigned integer
@ ODP_ML_DATA_TYPE_INT32
32-bit integer
@ ODP_ML_DATA_TYPE_BFP16
16-bit brain floating point (bfloat16) number
@ ODP_ML_DATA_TYPE_FP64
64-bit floating point number
@ ODP_ML_DATA_TYPE_INT64
64-bit integer
@ ODP_ML_DATA_TYPE_INT24
24-bit integer
@ ODP_ML_DATA_TYPE_NONE
Data type is not defined.
@ ODP_ML_DATA_TYPE_INT16
16-bit integer
@ ODP_ML_DATA_TYPE_INT8
8-bit integer
bool odp_bool_t
Boolean type.
Machine learning capabilities.
odp_ml_compl_mode_t compl_mode_mask
Supported completion modes for model load / unload operations.
odp_bool_t compl_queue_sched
Support of model load / unload completion into scheduled queues.
uint32_t min_output_align
Minimum output data alignment in bytes.
odp_bool_t packed_output_data
Output data packing.
uint64_t max_model_size
Maximum model size in bytes.
uint32_t min_input_align
Minimum input data alignment in bytes.
odp_bool_t compl_queue_plain
Support of model load / unload completion into plain queues.
uint32_t max_segs_per_input
Maximum number of data segments per model input.
odp_bool_t packed_input_data
Input data packing.
struct odp_ml_capability_t::@90 run
Model run capabilities.
uint32_t max_compl_id
Maximum completion identifier value.
uint32_t max_segs_per_output
Maximum number of data segments per model output.
struct odp_ml_capability_t::@89 load
Model load / unload capabilities.
odp_ml_compl_pool_capability_t pool
ML completion event pool capabilities.
uint32_t max_models
Maximum number of models.
uint32_t max_models_loaded
Maximum number of models that can be loaded simultaneously.
uint32_t max_inputs
Maximum number of model inputs.
uint32_t max_outputs
Maximum number of model outputs.
ML completion parameters.
odp_event_t event
Completion event.
void * user_ptr
User defined context pointer.
odp_ml_compl_mode_t mode
Completion mode.
uint32_t compl_id
Completion identifier.
odp_queue_t queue
Completion queue.
ML completion event pool capabilities.
uint32_t max_pools
Maximum number of ML completion event pools.
uint32_t max_num
Maximum number of ML completion events in a pool.
uint32_t max_cache_size
Maximum size of local thread cache.
odp_bool_t uarea_persistence
User area persistence.
uint32_t max_uarea_size
Maximum user area size in bytes.
uint32_t min_cache_size
Minimum size of local thread cache.
ML completion event pool parameters.
void(* init_fn)(void *uarea, uint32_t size, void *args, uint32_t index)
See uarea_init.init_fn of odp_pool_param_t for details (odp_pool_param_t.init_fn).
uint32_t uarea_size
User area size in bytes.
uint32_t cache_size
Maximum number of events cached locally per thread.
struct odp_ml_compl_pool_param_t::@88 uarea_init
Parameters for user area initialization.
uint32_t num
Number of ML completion events in the pool.
void * args
See uarea_init.args of odp_pool_param_t for details (odp_pool_param_t.args).
Machine learning configuration parameters.
uint32_t engine_id
Engine ID to be configured.
uint64_t max_model_size
Maximum model binary size in bytes.
odp_ml_compl_mode_t load_mode_mask
Load / unload completion modes.
uint32_t max_models_loaded
Maximum number of models loaded.
uint32_t max_models_created
Maximum number of models.
odp_ml_compl_mode_t run_mode_mask
Run completion modes.
Model input / output data format.
odp_ml_data_type_t data_type
Model input / output data type.
odp_ml_shape_info_t shape
Model input / output data shape.
uint32_t data_type_size
Size of data type in bytes.
Model input / output data segment.
void * addr
Segment start address.
uint64_t size
Segment size in bytes.
Model input / output data for a model inference run.
uint32_t num_output_seg
Number of output data segments.
uint32_t num_input_seg
Number of input data segments.
odp_ml_data_seg_t * output_seg
Model output data segments.
odp_ml_data_seg_t * input_seg
Model input data segments.
ML extra statistics counter information.
char name[ODP_ML_EXTRA_STAT_NAME_LEN]
Name of the statistics counter.
Model input information.
uint32_t data_type_size
Size of model input data type in bytes.
odp_ml_quant_info_t quant_info
Model input quantization information.
odp_ml_data_type_t data_type
Model input data type.
char name[ODP_ML_MODEL_IO_NAME_LEN]
Model input name.
odp_ml_shape_info_t shape
Model input data shape.
Result of model load / unload operation.
uint64_t error_code
Model load / unload error code.
void * user_ptr
User context pointer value from odp_ml_compl_param_t.
Model information.
uint64_t model_version
Model version number.
uint64_t interface_version
Model interface version number.
uint32_t num_outputs
Number of model outputs.
union odp_ml_model_info_t::@91 aux
Auxiliary information regarding the model and its inputs / outputs.
uint32_t all
All bits of the bit field structure.
uint32_t input_quant_info
Input quantization information provision.
uint32_t output_quant_info
Output quantization information provision.
uint32_t engine_id
Engine ID to which the model is assigned.
char name[ODP_ML_MODEL_NAME_LEN]
Model name.
uint32_t index
Model index assigned by the implementation.
uint32_t num_inputs
Number of model inputs.
Machine learning model parameters.
const odp_ml_model_extra_param_t * extra_param
ODP implementation specific extra parameters.
uint64_t size
Size of the model binary in bytes.
odp_bool_t extra_stat_enable
Enable / disable extra statistics counters.
uint32_t engine_id
Engine ID.
const odp_ml_data_format_t * output_format
Model output data format array.
uint32_t num_outputs
Number of model outputs.
uint32_t max_compl_id
Maximum completion identifier value.
const odp_ml_data_format_t * input_format
Model input data format array.
struct odp_ml_model_param_t::@94 extra_info
Extra model information.
void * model
Model binary.
uint32_t num_inputs
Number of model inputs.
Model output information.
odp_ml_data_type_t data_type
Model output data type.
odp_ml_shape_info_t shape
Model output data shape.
odp_ml_quant_info_t quant_info
Model output quantization information.
uint32_t data_type_size
Size of model output data type in bytes.
char name[ODP_ML_MODEL_IO_NAME_LEN]
Model output name.
Quantization information.
odp_ml_quant_param_t common
Quantization parameters common to all data values of an input / output.
Quantization parameters.
float scale_fp32
Quantization scale.
odp_ml_data_type_t type
Type of quantization scale value.
int32_t zerop_i32
Quantization zero point.
Parameters for model run.
odp_ml_run_result_t * result
Model run results.
uint32_t batch_size
Batch size.
Results of model run operation.
void * user_ptr
User context pointer value from odp_ml_compl_param_t.
uint64_t error_code
Model run error code.
Model input / output data shape information.
char dim_name[ODP_ML_MAX_DIMS][ODP_ML_SHAPE_NAME_LEN]
Dimension name.
uint32_t dim_min[ODP_ML_MAX_DIMS]
Minimum dimension sizes.
odp_ml_shape_type_t type
Shape type.
uint32_t dim_max[ODP_ML_MAX_DIMS]
Maximum dimension sizes.
uint32_t num_dim
Number of dimensions.
uint32_t dim[ODP_ML_MAX_DIMS]
Dimension sizes.