From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 6AAE7425CD;
	Wed, 20 Sep 2023 09:19:28 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 58DC940DDB;
	Wed, 20 Sep 2023 09:19:24 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173])
 by mails.dpdk.org (Postfix) with ESMTP id 6CB0E4067E
 for <dev@dpdk.org>; Wed, 20 Sep 2023 09:19:22 +0200 (CEST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 38JJR6pE009223 for <dev@dpdk.org>; Wed, 20 Sep 2023 00:19:21 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=UmUXmrZCLS+yjqC7DCyBlW/03eTSqisXW8c34/kxvSU=;
 b=LaZfMI3g+y22gpOMwcgciZBhO6c72sw6v7PO23SiJmH7pdZ2gR2zx0frBoGNAWDAb75B
 ZvFNNK8hCGvTUEyVuVUYaMZ4MSGQwOgaX17C9EjH9Fh9Y2R+Eb+0L5CubqzVoUyVkmb6
 PP3qc2PQTrOHMLpY+AkPlTPEzU8QzguFcj/oNm8VhXZcpJjPqqzx+AGSMDSJ5TL4Y/Y/
 uS9JadBAFWmbuBOlzlcBejsMM4dXhW4tJPPgCxyGJ0mEqEe+sVjbGs86h3xEzxBtT1Yl
 bS9/YiU1DUyMKC49QC+XzzlxkhVprQz+045JKeWD15Lkobs+Z9ryxq96sQ5lgFwcj54D ZQ== 
Received: from dc5-exch02.marvell.com ([199.233.59.182])
 by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3t7htasxva-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)
 for <dev@dpdk.org>; Wed, 20 Sep 2023 00:19:21 -0700
Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;
 Wed, 20 Sep 2023 00:19:19 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend
 Transport; Wed, 20 Sep 2023 00:19:19 -0700
Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233])
 by maili.marvell.com (Postfix) with ESMTP id 99E255B6922;
 Wed, 20 Sep 2023 00:19:17 -0700 (PDT)
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
To: Srikanth Yalavarthi <syalavarthi@marvell.com>
CC: <dev@dpdk.org>, <sshankarnara@marvell.com>, <aprabhu@marvell.com>,
 <ptakkar@marvell.com>
Subject: [PATCH v2 3/3] mldev: drop input and output size get APIs
Date: Wed, 20 Sep 2023 00:19:10 -0700
Message-ID: <20230920071910.10428-4-syalavarthi@marvell.com>
X-Mailer: git-send-email 2.41.0
In-Reply-To: <20230920071910.10428-1-syalavarthi@marvell.com>
References: <20230830155303.30380-1-syalavarthi@marvell.com>
 <20230920071910.10428-1-syalavarthi@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-ORIG-GUID: cIERVjov7RWUXnMaIDARcYCrNgviYKJ6
X-Proofpoint-GUID: cIERVjov7RWUXnMaIDARcYCrNgviYKJ6
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26
 definitions=2023-09-20_02,2023-09-19_01,2023-05-22_02
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Drop support and use of ML input and output size get functions,
rte_ml_io_input_size_get and rte_ml_io_output_size_get.

These functions are not required, as the model buffer size can
be computed from the fields of updated rte_ml_io_info structure.

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 drivers/ml/cnxk/cn10k_ml_ops.c | 50 ----------------------------
 lib/mldev/rte_mldev.c          | 38 ---------------------
 lib/mldev/rte_mldev.h          | 60 ----------------------------------
 lib/mldev/rte_mldev_core.h     | 54 ------------------------------
 lib/mldev/version.map          |  2 --
 5 files changed, 204 deletions(-)

diff --git a/drivers/ml/cnxk/cn10k_ml_ops.c b/drivers/ml/cnxk/cn10k_ml_ops.c
index 1d72fb52a6..4abf4ae0d3 100644
--- a/drivers/ml/cnxk/cn10k_ml_ops.c
+++ b/drivers/ml/cnxk/cn10k_ml_ops.c
@@ -2110,54 +2110,6 @@ cn10k_ml_model_params_update(struct rte_ml_dev *dev, uint16_t model_id, void *bu
 	return 0;
 }
 
-static int
-cn10k_ml_io_input_size_get(struct rte_ml_dev *dev, uint16_t model_id, uint32_t nb_batches,
-			   uint64_t *input_qsize, uint64_t *input_dsize)
-{
-	struct cn10k_ml_model *model;
-
-	model = dev->data->models[model_id];
-
-	if (model == NULL) {
-		plt_err("Invalid model_id = %u", model_id);
-		return -EINVAL;
-	}
-
-	if (input_qsize != NULL)
-		*input_qsize = PLT_U64_CAST(model->addr.total_input_sz_q *
-					    PLT_DIV_CEIL(nb_batches, model->batch_size));
-
-	if (input_dsize != NULL)
-		*input_dsize = PLT_U64_CAST(model->addr.total_input_sz_d *
-					    PLT_DIV_CEIL(nb_batches, model->batch_size));
-
-	return 0;
-}
-
-static int
-cn10k_ml_io_output_size_get(struct rte_ml_dev *dev, uint16_t model_id, uint32_t nb_batches,
-			    uint64_t *output_qsize, uint64_t *output_dsize)
-{
-	struct cn10k_ml_model *model;
-
-	model = dev->data->models[model_id];
-
-	if (model == NULL) {
-		plt_err("Invalid model_id = %u", model_id);
-		return -EINVAL;
-	}
-
-	if (output_qsize != NULL)
-		*output_qsize = PLT_U64_CAST(model->addr.total_output_sz_q *
-					     PLT_DIV_CEIL(nb_batches, model->batch_size));
-
-	if (output_dsize != NULL)
-		*output_dsize = PLT_U64_CAST(model->addr.total_output_sz_d *
-					     PLT_DIV_CEIL(nb_batches, model->batch_size));
-
-	return 0;
-}
-
 static int
 cn10k_ml_io_quantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_buff_seg **dbuffer,
 		     struct rte_ml_buff_seg **qbuffer)
@@ -2636,8 +2588,6 @@ struct rte_ml_dev_ops cn10k_ml_ops = {
 	.model_params_update = cn10k_ml_model_params_update,
 
 	/* I/O ops */
-	.io_input_size_get = cn10k_ml_io_input_size_get,
-	.io_output_size_get = cn10k_ml_io_output_size_get,
 	.io_quantize = cn10k_ml_io_quantize,
 	.io_dequantize = cn10k_ml_io_dequantize,
 };
diff --git a/lib/mldev/rte_mldev.c b/lib/mldev/rte_mldev.c
index 9a48ed3e94..cc5f2e0cc6 100644
--- a/lib/mldev/rte_mldev.c
+++ b/lib/mldev/rte_mldev.c
@@ -691,44 +691,6 @@ rte_ml_model_params_update(int16_t dev_id, uint16_t model_id, void *buffer)
 	return (*dev->dev_ops->model_params_update)(dev, model_id, buffer);
 }
 
-int
-rte_ml_io_input_size_get(int16_t dev_id, uint16_t model_id, uint32_t nb_batches,
-			 uint64_t *input_qsize, uint64_t *input_dsize)
-{
-	struct rte_ml_dev *dev;
-
-	if (!rte_ml_dev_is_valid_dev(dev_id)) {
-		RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id);
-		return -EINVAL;
-	}
-
-	dev = rte_ml_dev_pmd_get_dev(dev_id);
-	if (*dev->dev_ops->io_input_size_get == NULL)
-		return -ENOTSUP;
-
-	return (*dev->dev_ops->io_input_size_get)(dev, model_id, nb_batches, input_qsize,
-						  input_dsize);
-}
-
-int
-rte_ml_io_output_size_get(int16_t dev_id, uint16_t model_id, uint32_t nb_batches,
-			  uint64_t *output_qsize, uint64_t *output_dsize)
-{
-	struct rte_ml_dev *dev;
-
-	if (!rte_ml_dev_is_valid_dev(dev_id)) {
-		RTE_MLDEV_LOG(ERR, "Invalid dev_id = %d\n", dev_id);
-		return -EINVAL;
-	}
-
-	dev = rte_ml_dev_pmd_get_dev(dev_id);
-	if (*dev->dev_ops->io_output_size_get == NULL)
-		return -ENOTSUP;
-
-	return (*dev->dev_ops->io_output_size_get)(dev, model_id, nb_batches, output_qsize,
-						   output_dsize);
-}
-
 int
 rte_ml_io_quantize(int16_t dev_id, uint16_t model_id, struct rte_ml_buff_seg **dbuffer,
 		   struct rte_ml_buff_seg **qbuffer)
diff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h
index 316c6fd018..63b2670bb0 100644
--- a/lib/mldev/rte_mldev.h
+++ b/lib/mldev/rte_mldev.h
@@ -1008,66 +1008,6 @@ rte_ml_model_params_update(int16_t dev_id, uint16_t model_id, void *buffer);
 
 /* IO operations */
 
-/**
- * Get size of quantized and dequantized input buffers.
- *
- * Calculate the size of buffers required for quantized and dequantized input data.
- * This API would return the buffer sizes for the number of batches provided and would
- * consider the alignment requirements as per the PMD. Input sizes computed by this API can
- * be used by the application to allocate buffers.
- *
- * @param[in] dev_id
- *   The identifier of the device.
- * @param[in] model_id
- *   Identifier for the model created
- * @param[in] nb_batches
- *   Number of batches of input to be processed in a single inference job
- * @param[out] input_qsize
- *   Quantized input size pointer.
- * NULL value is allowed, in which case input_qsize is not calculated by the driver.
- * @param[out] input_dsize
- *   Dequantized input size pointer.
- * NULL value is allowed, in which case input_dsize is not calculated by the driver.
- *
- * @return
- *   - Returns 0 on success
- *   - Returns negative value on failure
- */
-__rte_experimental
-int
-rte_ml_io_input_size_get(int16_t dev_id, uint16_t model_id, uint32_t nb_batches,
-			 uint64_t *input_qsize, uint64_t *input_dsize);
-
-/**
- * Get size of quantized and dequantized output buffers.
- *
- * Calculate the size of buffers required for quantized and dequantized output data.
- * This API would return the buffer sizes for the number of batches provided and would consider
- * the alignment requirements as per the PMD. Output sizes computed by this API can be used by the
- * application to allocate buffers.
- *
- * @param[in] dev_id
- *   The identifier of the device.
- * @param[in] model_id
- *   Identifier for the model created
- * @param[in] nb_batches
- *   Number of batches of input to be processed in a single inference job
- * @param[out] output_qsize
- *   Quantized output size pointer.
- * NULL value is allowed, in which case output_qsize is not calculated by the driver.
- * @param[out] output_dsize
- *   Dequantized output size pointer.
- * NULL value is allowed, in which case output_dsize is not calculated by the driver.
- *
- * @return
- *   - Returns 0 on success
- *   - Returns negative value on failure
- */
-__rte_experimental
-int
-rte_ml_io_output_size_get(int16_t dev_id, uint16_t model_id, uint32_t nb_batches,
-			  uint64_t *output_qsize, uint64_t *output_dsize);
-
 /**
  * Quantize input data.
  *
diff --git a/lib/mldev/rte_mldev_core.h b/lib/mldev/rte_mldev_core.h
index 8530b07316..2279b1dcec 100644
--- a/lib/mldev/rte_mldev_core.h
+++ b/lib/mldev/rte_mldev_core.h
@@ -466,54 +466,6 @@ typedef int (*mldev_model_info_get_t)(struct rte_ml_dev *dev, uint16_t model_id,
  */
 typedef int (*mldev_model_params_update_t)(struct rte_ml_dev *dev, uint16_t model_id, void *buffer);
 
-/**
- * @internal
- *
- * Get size of input buffers.
- *
- * @param dev
- *	ML device pointer.
- * @param model_id
- *	Model ID to use.
- * @param nb_batches
- *	Number of batches.
- * @param input_qsize
- *	Size of quantized input.
- * @param input_dsize
- *	Size of dequantized input.
- *
- * @return
- *	- 0 on success.
- *	- <0, error on failure.
- */
-typedef int (*mldev_io_input_size_get_t)(struct rte_ml_dev *dev, uint16_t model_id,
-					 uint32_t nb_batches, uint64_t *input_qsize,
-					 uint64_t *input_dsize);
-
-/**
- * @internal
- *
- * Get size of output buffers.
- *
- * @param dev
- *	ML device pointer.
- * @param model_id
- *	Model ID to use.
- * @param nb_batches
- *	Number of batches.
- * @param output_qsize
- *	Size of quantized output.
- * @param output_dsize
- *	Size of dequantized output.
- *
- * @return
- *	- 0 on success.
- *	- <0, error on failure.
- */
-typedef int (*mldev_io_output_size_get_t)(struct rte_ml_dev *dev, uint16_t model_id,
-					  uint32_t nb_batches, uint64_t *output_qsize,
-					  uint64_t *output_dsize);
-
 /**
  * @internal
  *
@@ -627,12 +579,6 @@ struct rte_ml_dev_ops {
 	/** Update model params. */
 	mldev_model_params_update_t model_params_update;
 
-	/** Get input buffer size. */
-	mldev_io_input_size_get_t io_input_size_get;
-
-	/** Get output buffer size. */
-	mldev_io_output_size_get_t io_output_size_get;
-
 	/** Quantize data */
 	mldev_io_quantize_t io_quantize;
 
diff --git a/lib/mldev/version.map b/lib/mldev/version.map
index 40ff27f4b9..99841db6aa 100644
--- a/lib/mldev/version.map
+++ b/lib/mldev/version.map
@@ -23,8 +23,6 @@ EXPERIMENTAL {
 	rte_ml_dev_xstats_reset;
 	rte_ml_enqueue_burst;
 	rte_ml_io_dequantize;
-	rte_ml_io_input_size_get;
-	rte_ml_io_output_size_get;
 	rte_ml_io_quantize;
 	rte_ml_model_info_get;
 	rte_ml_model_load;
-- 
2.41.0