5 #ifndef RTE_MLDEV_INTERNAL_H 6 #define RTE_MLDEV_INTERNAL_H 25 #include <dev_driver.h> 31 #define ML_DEV_DETACHED (0) 32 #define ML_DEV_ATTACHED (1) 53 typedef uint16_t (*mldev_enqueue_t)(
struct rte_ml_dev *dev, uint16_t qp_id,
struct rte_ml_op **ops,
73 typedef uint16_t (*mldev_dequeue_t)(
struct rte_ml_dev *dev, uint16_t qp_id,
struct rte_ml_op **ops,
92 typedef int (*mldev_op_error_get_t)(
struct rte_ml_dev *dev,
struct rte_ml_op *op,
130 typedef int (*mldev_configure_t)(
struct rte_ml_dev *dev,
const struct rte_ml_dev_config *config);
145 typedef int (*mldev_close_t)(
struct rte_ml_dev *dev);
159 typedef int (*mldev_start_t)(
struct rte_ml_dev *dev);
173 typedef int (*mldev_stop_t)(
struct rte_ml_dev *dev);
193 typedef int (*mldev_queue_pair_setup_t)(
struct rte_ml_dev *dev, uint16_t queue_pair_id,
211 typedef int (*mldev_queue_pair_release_t)(
struct rte_ml_dev *dev, uint16_t queue_pair_id);
227 typedef int (*mldev_stats_get_t)(
struct rte_ml_dev *dev,
struct rte_ml_dev_stats *stats);
237 typedef void (*mldev_stats_reset_t)(
struct rte_ml_dev *dev);
256 typedef int (*mldev_xstats_names_get_t)(
struct rte_ml_dev *dev,
277 typedef int (*mldev_xstats_by_name_get_t)(
struct rte_ml_dev *dev,
const char *name,
278 uint16_t *stat_id, uint64_t *value);
298 typedef int (*mldev_xstats_get_t)(
struct rte_ml_dev *dev,
const uint16_t *stat_ids,
299 uint64_t *values, uint16_t nb_ids);
317 typedef int (*mldev_xstats_reset_t)(
struct rte_ml_dev *dev,
const uint16_t *stat_ids,
335 typedef int (*mldev_dump_t)(
struct rte_ml_dev *dev, FILE *fd);
349 typedef int (*mldev_selftest_t)(
struct rte_ml_dev *dev);
367 typedef int (*mldev_model_load_t)(
struct rte_ml_dev *dev,
struct rte_ml_model_params *params,
384 typedef int (*mldev_model_unload_t)(
struct rte_ml_dev *dev, uint16_t model_id);
400 typedef int (*mldev_model_start_t)(
struct rte_ml_dev *dev, uint16_t model_id);
416 typedef int (*mldev_model_stop_t)(
struct rte_ml_dev *dev, uint16_t model_id);
434 typedef int (*mldev_model_info_get_t)(
struct rte_ml_dev *dev, uint16_t model_id,
453 typedef int (*mldev_model_params_update_t)(
struct rte_ml_dev *dev, uint16_t model_id,
void *buffer);
475 typedef int (*mldev_io_input_size_get_t)(
struct rte_ml_dev *dev, uint16_t model_id,
476 uint32_t nb_batches, uint64_t *input_qsize,
477 uint64_t *input_dsize);
499 typedef int (*mldev_io_output_size_get_t)(
struct rte_ml_dev *dev, uint16_t model_id,
500 uint32_t nb_batches, uint64_t *output_qsize,
501 uint64_t *output_dsize);
523 typedef int (*mldev_io_quantize_t)(
struct rte_ml_dev *dev, uint16_t model_id, uint16_t nb_batches,
524 void *dbuffer,
void *qbuffer);
546 typedef int (*mldev_io_dequantize_t)(
struct rte_ml_dev *dev, uint16_t model_id, uint16_t nb_batches,
547 void *qbuffer,
void *dbuffer);
554 struct rte_ml_dev_ops {
559 mldev_configure_t dev_configure;
562 mldev_close_t dev_close;
565 mldev_start_t dev_start;
568 mldev_stop_t dev_stop;
571 mldev_queue_pair_setup_t dev_queue_pair_setup;
574 mldev_queue_pair_release_t dev_queue_pair_release;
577 mldev_stats_get_t dev_stats_get;
580 mldev_stats_reset_t dev_stats_reset;
583 mldev_xstats_names_get_t dev_xstats_names_get;
586 mldev_xstats_by_name_get_t dev_xstats_by_name_get;
589 mldev_xstats_get_t dev_xstats_get;
592 mldev_xstats_reset_t dev_xstats_reset;
595 mldev_dump_t dev_dump;
598 mldev_selftest_t dev_selftest;
601 mldev_model_load_t model_load;
604 mldev_model_unload_t model_unload;
607 mldev_model_start_t model_start;
610 mldev_model_stop_t model_stop;
613 mldev_model_info_get_t model_info_get;
616 mldev_model_params_update_t model_params_update;
619 mldev_io_input_size_get_t io_input_size_get;
622 mldev_io_output_size_get_t io_output_size_get;
625 mldev_io_quantize_t io_quantize;
628 mldev_io_dequantize_t io_dequantize;
637 struct rte_ml_dev_data {
645 __extension__ uint8_t dev_started : 1;
648 uint16_t nb_queue_pairs;
673 mldev_enqueue_t enqueue_burst;
676 mldev_dequeue_t dequeue_burst;
679 mldev_op_error_get_t op_error_get;
682 struct rte_ml_dev_data *data;
685 struct rte_ml_dev_ops *dev_ops;
688 struct rte_device *device;
691 __extension__ uint8_t attached : 1;
699 struct rte_ml_dev_global {
701 struct rte_ml_dev *devs;
704 struct rte_ml_dev_data **data;
int(* mldev_info_get_t)(struct rte_ml_dev *dev, struct rte_ml_dev_info *dev_info)
#define __rte_cache_aligned