From: <jerinj@marvell.com>
To: <dev@dpdk.org>, Srikanth Yalavarthi <syalavarthi@marvell.com>
Cc: <thomas@monjalon.net>, <ferruh.yigit@xilinx.com>,
<stephen@networkplumber.org>, <dchickles@marvell.com>,
<sshankarnara@marvell.com>, Jerin Jacob <jerinj@marvell.com>
Subject: [dpdk-dev] [PATCH v3 08/12] mldev: support inference enqueue and dequeue
Date: Tue, 7 Feb 2023 20:43:12 +0530 [thread overview]
Message-ID: <20230207151316.835441-9-jerinj@marvell.com> (raw)
In-Reply-To: <20230207151316.835441-1-jerinj@marvell.com>
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
Added implementations of fast-path functions to enqueue
and dequeue ML requests from an ML device queue-pair.
Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
---
lib/mldev/rte_mldev.c | 75 ++++++++++++++++++++++++++++++++++++++
lib/mldev/rte_mldev_core.h | 46 +++++++++++++++++++++++
lib/mldev/rte_mldev_pmd.h | 2 +
lib/mldev/version.map | 2 +
4 files changed, 125 insertions(+)
diff --git a/lib/mldev/rte_mldev.c b/lib/mldev/rte_mldev.c
index da65819c08..184d87c70a 100644
--- a/lib/mldev/rte_mldev.c
+++ b/lib/mldev/rte_mldev.c
@@ -114,6 +114,9 @@ rte_ml_dev_pmd_allocate(const char *name, uint8_t socket_id)
ml_dev_globals.nb_devs++;
}
+ dev->enqueue_burst = NULL;
+ dev->dequeue_burst = NULL;
+
return dev;
}
@@ -671,4 +674,76 @@ rte_ml_op_pool_free(struct rte_mempool *mempool)
rte_mempool_free(mempool);
}
+uint16_t
+rte_ml_enqueue_burst(int16_t dev_id, uint16_t qp_id, struct rte_ml_op **ops, uint16_t nb_ops)
+{
+ struct rte_ml_dev *dev;
+
+#ifdef RTE_LIBRTE_ML_DEV_DEBUG
+ if (!rte_ml_dev_is_valid_dev(dev_id)) {
+ RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id);
+ rte_errno = -EINVAL;
+ return 0;
+ }
+
+ dev = rte_ml_dev_pmd_get_dev(dev_id);
+ if (*dev->enqueue_burst == NULL) {
+ rte_errno = -ENOTSUP;
+ return 0;
+ }
+
+ if (ops == NULL) {
+ RTE_MLDEV_LOG(ERR, "Dev %d, ops cannot be NULL\n", dev_id);
+ rte_errno = -EINVAL;
+ return 0;
+ }
+
+ if (qp_id >= dev->data->nb_queue_pairs) {
+ RTE_MLDEV_LOG(ERR, "Invalid qp_id %u\n", qp_id);
+ rte_errno = -EINVAL;
+ return 0;
+ }
+#else
+ dev = rte_ml_dev_pmd_get_dev(dev_id);
+#endif
+
+ return (*dev->enqueue_burst)(dev, qp_id, ops, nb_ops);
+}
+
+uint16_t
+rte_ml_dequeue_burst(int16_t dev_id, uint16_t qp_id, struct rte_ml_op **ops, uint16_t nb_ops)
+{
+ struct rte_ml_dev *dev;
+
+#ifdef RTE_LIBRTE_ML_DEV_DEBUG
+ if (!rte_ml_dev_is_valid_dev(dev_id)) {
+ RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id);
+ rte_errno = -EINVAL;
+ return 0;
+ }
+
+ dev = rte_ml_dev_pmd_get_dev(dev_id);
+ if (*dev->dequeue_burst == NULL) {
+ rte_errno = -ENOTSUP;
+ return 0;
+ }
+
+ if (ops == NULL) {
+ RTE_MLDEV_LOG(ERR, "Dev %d, ops cannot be NULL\n", dev_id);
+ rte_errno = -EINVAL;
+ return 0;
+ }
+
+ if (qp_id >= dev->data->nb_queue_pairs) {
+ RTE_MLDEV_LOG(ERR, "Invalid qp_id %u\n", qp_id);
+ rte_errno = -EINVAL;
+ return 0;
+ }
+#else
+ dev = rte_ml_dev_pmd_get_dev(dev_id);
+#endif
+
+ return (*dev->dequeue_burst)(dev, qp_id, ops, nb_ops);
+}
+
RTE_LOG_REGISTER_DEFAULT(rte_ml_dev_logtype, INFO);
diff --git a/lib/mldev/rte_mldev_core.h b/lib/mldev/rte_mldev_core.h
index 46e6e7a4e5..1c02813c87 100644
--- a/lib/mldev/rte_mldev_core.h
+++ b/lib/mldev/rte_mldev_core.h
@@ -33,6 +33,46 @@ extern "C" {
struct rte_ml_dev;
+/**
+ * @internal
+ *
+ * Enqueue a burst of inference requests to a queue on ML device.
+ *
+ * @param dev
+ * ML device pointer.
+ * @param qp_id
+ * Queue-pair ID.
+ * @param ops
+ * Array of ML ops to be enqueued.
+ * @param nb_ops
+ * Number of ops to enqueue.
+ *
+ * @return
+ * - Number of ops enqueued.
+ */
+typedef uint16_t (*mldev_enqueue_t)(struct rte_ml_dev *dev, uint16_t qp_id, struct rte_ml_op **ops,
+ uint16_t nb_ops);
+
+/**
+ * @internal
+ *
+ * Dequeue a burst of inference requests from a queue on ML device.
+ *
+ * @param dev
+ * ML device pointer.
+ * @param qp_id
+ * Queue-pair ID.
+ * @param ops
+ * Array of ML ops to dequeued.
+ * @param nb_ops
+ * Number of ops to dequeue.
+ *
+ * @return
+ * - Number of ops dequeued.
+ */
+typedef uint16_t (*mldev_dequeue_t)(struct rte_ml_dev *dev, uint16_t qp_id, struct rte_ml_op **ops,
+ uint16_t nb_ops);
+
/**
* Definitions of all functions exported by a driver through the generic structure of type
* *ml_dev_ops* supplied in the *rte_ml_dev* structure associated with a device.
@@ -448,6 +488,12 @@ struct rte_ml_dev_data {
* The data structure associated with each ML device.
*/
struct rte_ml_dev {
+ /** Pointer to PMD enqueue function. */
+ mldev_enqueue_t enqueue_burst;
+
+ /** Pointer to PMD dequeue function. */
+ mldev_dequeue_t dequeue_burst;
+
/** Pointer to device data. */
struct rte_ml_dev_data *data;
diff --git a/lib/mldev/rte_mldev_pmd.h b/lib/mldev/rte_mldev_pmd.h
index 33544f1b80..afe617e4bf 100644
--- a/lib/mldev/rte_mldev_pmd.h
+++ b/lib/mldev/rte_mldev_pmd.h
@@ -40,6 +40,8 @@ struct rte_ml_dev_pmd_init_params {
uint64_t private_data_size;
};
+struct rte_ml_dev;
+
/**
* @internal
*
diff --git a/lib/mldev/version.map b/lib/mldev/version.map
index 7665226d0e..e6b1ac4a4d 100644
--- a/lib/mldev/version.map
+++ b/lib/mldev/version.map
@@ -1,6 +1,7 @@
EXPERIMENTAL {
global:
+ rte_ml_dequeue_burst;
rte_ml_dev_close;
rte_ml_dev_configure;
rte_ml_dev_count;
@@ -12,6 +13,7 @@ EXPERIMENTAL {
rte_ml_dev_socket_id;
rte_ml_dev_start;
rte_ml_dev_stop;
+ rte_ml_enqueue_burst;
rte_ml_io_dequantize;
rte_ml_io_input_size_get;
rte_ml_io_output_size_get;
--
2.39.1
next prev parent reply other threads:[~2023-02-07 15:14 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-03 13:28 [dpdk-dev] [RFC PATCH 0/1] mldev: introduce machine learning device library jerinj
2022-08-03 13:28 ` [dpdk-dev] [RFC PATCH 1/1] " jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 00/12] " jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 01/12] " jerinj
2023-02-01 13:34 ` Shivah Shankar Shankar Narayan Rao
2023-02-03 0:25 ` Stephen Hemminger
2023-02-03 8:42 ` Thomas Monjalon
2023-02-03 17:33 ` Stephen Hemminger
2023-02-03 20:18 ` Thomas Monjalon
2023-02-03 20:26 ` Stephen Hemminger
2023-02-03 20:49 ` Thomas Monjalon
2023-02-05 23:41 ` Stephen Hemminger
2023-02-03 10:01 ` Jerin Jacob
2023-02-03 0:25 ` Stephen Hemminger
2023-02-03 10:04 ` Jerin Jacob
2023-02-03 0:28 ` Stephen Hemminger
2023-02-03 10:03 ` Jerin Jacob
2023-02-02 5:26 ` Shivah Shankar Shankar Narayan Rao
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 02/12] mldev: add PMD functions for ML device jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 03/12] mldev: support device handling functions jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 04/12] mldev: support device queue-pair setup jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 05/12] mldev: support handling ML models jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 06/12] mldev: support input and output data handling jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 07/12] mldev: support op pool and its operations jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 08/12] mldev: support inference enqueue and dequeue jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 09/12] mldev: support device statistics jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 10/12] mldev: support device extended statistics jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 11/12] mldev: support to retrieve error information jerinj
2022-11-14 12:02 ` [dpdk-dev] [PATCH v1 12/12] mldev: support to get debug info and test device jerinj
2023-01-25 14:20 ` [dpdk-dev] [PATCH v1 00/12] mldev: introduce machine learning device library Thomas Monjalon
2023-01-25 19:01 ` Jerin Jacob
2023-01-26 11:11 ` Thomas Monjalon
2023-01-27 2:33 ` [EXT] " Shivah Shankar Shankar Narayan Rao
2023-01-27 4:29 ` Jerin Jacob
2023-01-27 11:34 ` Thomas Monjalon
2023-01-28 11:27 ` Jerin Jacob
2023-02-01 16:57 ` Thomas Monjalon
2023-02-01 17:33 ` Jerin Jacob
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 " jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 01/12] " jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 02/12] mldev: support PMD functions for ML device jerinj
2023-02-06 21:04 ` Stephen Hemminger
2023-02-06 22:17 ` Thomas Monjalon
2023-02-07 5:16 ` Jerin Jacob
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 03/12] mldev: support ML device handling functions jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 04/12] mldev: support ML device queue-pair setup jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 05/12] mldev: support handling ML models jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 06/12] mldev: support input and output data handling jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 07/12] mldev: support ML op pool and ops jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 08/12] mldev: support inference enqueue and dequeue jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 09/12] mldev: support device statistics jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 10/12] mldev: support device extended statistics jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 11/12] mldev: support to retrieve error information jerinj
2023-02-06 20:24 ` [dpdk-dev] [PATCH v2 12/12] mldev: support to get debug info and test device jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 00/12] mldev: introduce machine learning device library jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 01/12] " jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 02/12] mldev: support PMD functions for ML device jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 03/12] mldev: support ML device handling functions jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 04/12] mldev: support ML device queue-pair setup jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 05/12] mldev: support handling ML models jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 06/12] mldev: support input and output data handling jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 07/12] mldev: support ML op pool and ops jerinj
2023-02-07 15:13 ` jerinj [this message]
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 09/12] mldev: support device statistics jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 10/12] mldev: support device extended statistics jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 11/12] mldev: support to retrieve error information jerinj
2023-02-07 15:13 ` [dpdk-dev] [PATCH v3 12/12] mldev: support to get debug info and test device jerinj
2023-02-15 12:55 ` [dpdk-dev] [PATCH v3 00/12] mldev: introduce machine learning device library Ferruh Yigit
2023-02-15 17:03 ` Jerin Jacob
2023-03-09 17:33 ` Thomas Monjalon
2022-08-03 15:19 ` [dpdk-dev] [RFC PATCH 0/1] " Stephen Hemminger
2022-08-16 13:13 ` Jerin Jacob
2022-08-16 15:45 ` Morten Brørup
2022-08-16 16:34 ` Honnappa Nagarahalli
2022-08-17 14:53 ` Jerin Jacob
2023-01-25 13:47 ` Thomas Monjalon
2023-01-25 13:54 ` Jerin Jacob
2022-08-17 5:37 ` Jerin Jacob
2022-08-17 6:58 ` Morten Brørup
2023-01-25 13:45 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230207151316.835441-9-jerinj@marvell.com \
--to=jerinj@marvell.com \
--cc=dchickles@marvell.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@xilinx.com \
--cc=sshankarnara@marvell.com \
--cc=stephen@networkplumber.org \
--cc=syalavarthi@marvell.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).