DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1 1/1] ml/cnxk: fix incorrect handling of TVM model I/O
@ 2024-07-31  6:10 Srikanth Yalavarthi
  0 siblings, 0 replies; 3+ messages in thread
From: Srikanth Yalavarthi @ 2024-07-31  6:10 UTC (permalink / raw)
  To: Srikanth Yalavarthi, Prince Takkar; +Cc: dev, sshankarnara, aprabhu

Fixed incorrect handling of TVM models with single MRVL
layer. Set the I/O layout to packed and fixed calculation
of quantized and dequantized data buffer addresses.

Fixes: 5cea2c67edfc ("ml/cnxk: update internal TVM model info structure")
Fixes: df2358f3adce ("ml/cnxk: add structures for TVM model type")

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 drivers/ml/cnxk/cnxk_ml_ops.c    | 12 ++++++++----
 drivers/ml/cnxk/mvtvm_ml_model.c |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c
index 971362b2420..07c7001b175 100644
--- a/drivers/ml/cnxk/cnxk_ml_ops.c
+++ b/drivers/ml/cnxk/cnxk_ml_ops.c
@@ -1462,7 +1462,8 @@ cnxk_ml_io_quantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_buf
 	d_offset = 0;
 	q_offset = 0;
 	for (i = 0; i < info->nb_inputs; i++) {
-		if (model->type == ML_CNXK_MODEL_TYPE_TVM) {
+		if (model->type == ML_CNXK_MODEL_TYPE_TVM &&
+		    model->subtype != ML_CNXK_MODEL_SUBTYPE_TVM_MRVL) {
 			lcl_dbuffer = dbuffer[i]->addr;
 			lcl_qbuffer = qbuffer[i]->addr;
 		} else {
@@ -1474,7 +1475,8 @@ cnxk_ml_io_quantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_buf
 		if (ret < 0)
 			return ret;
 
-		if (model->type == ML_CNXK_MODEL_TYPE_GLOW) {
+		if ((model->type == ML_CNXK_MODEL_TYPE_GLOW) ||
+		    (model->subtype == ML_CNXK_MODEL_SUBTYPE_TVM_MRVL)) {
 			d_offset += info->input[i].sz_d;
 			q_offset += info->input[i].sz_q;
 		}
@@ -1516,7 +1518,8 @@ cnxk_ml_io_dequantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_b
 	q_offset = 0;
 	d_offset = 0;
 	for (i = 0; i < info->nb_outputs; i++) {
-		if (model->type == ML_CNXK_MODEL_TYPE_TVM) {
+		if (model->type == ML_CNXK_MODEL_TYPE_TVM &&
+		    model->subtype != ML_CNXK_MODEL_SUBTYPE_TVM_MRVL) {
 			lcl_qbuffer = qbuffer[i]->addr;
 			lcl_dbuffer = dbuffer[i]->addr;
 		} else {
@@ -1528,7 +1531,8 @@ cnxk_ml_io_dequantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_b
 		if (ret < 0)
 			return ret;
 
-		if (model->type == ML_CNXK_MODEL_TYPE_GLOW) {
+		if ((model->type == ML_CNXK_MODEL_TYPE_GLOW) ||
+		    (model->subtype == ML_CNXK_MODEL_SUBTYPE_TVM_MRVL)) {
 			q_offset += info->output[i].sz_q;
 			d_offset += info->output[i].sz_d;
 		}
diff --git a/drivers/ml/cnxk/mvtvm_ml_model.c b/drivers/ml/cnxk/mvtvm_ml_model.c
index e3234ae4422..c8c4f61f134 100644
--- a/drivers/ml/cnxk/mvtvm_ml_model.c
+++ b/drivers/ml/cnxk/mvtvm_ml_model.c
@@ -356,7 +356,7 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo
 	metadata = &model->mvtvm.metadata;
 	strlcpy(info->name, metadata->model.name, TVMDP_NAME_STRLEN);
 
-	info->io_layout = RTE_ML_IO_LAYOUT_SPLIT;
+	info->io_layout = RTE_ML_IO_LAYOUT_PACKED;
 }
 
 void
-- 
2.45.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] ml/cnxk: fix incorrect handling of TVM model I/O
  2024-07-31  5:41 Srikanth Yalavarthi
@ 2024-09-19 17:31 ` Jerin Jacob
  0 siblings, 0 replies; 3+ messages in thread
From: Jerin Jacob @ 2024-09-19 17:31 UTC (permalink / raw)
  To: Srikanth Yalavarthi; +Cc: Prince Takkar, dev, sshankarnara, aprabhu

On Wed, Jul 31, 2024 at 11:43 AM Srikanth Yalavarthi
<syalavarthi@marvell.com> wrote:
>
> Fixed incorrect handling of TVM models with single MRVL
> layer. Set the I/O layout to packed and fixed calculation
> of quantized and dequantized data buffer addresses.
>
> Fixes: 5cea2c67edfc ("ml/cnxk: update internal TVM model info structure")
> Fixes: df2358f3adce ("ml/cnxk: add structures for TVM model type")
>
> Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>

Applied to dpdk-next-net-mrvl/for-main. Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1 1/1] ml/cnxk: fix incorrect handling of TVM model I/O
@ 2024-07-31  5:41 Srikanth Yalavarthi
  2024-09-19 17:31 ` Jerin Jacob
  0 siblings, 1 reply; 3+ messages in thread
From: Srikanth Yalavarthi @ 2024-07-31  5:41 UTC (permalink / raw)
  To: Srikanth Yalavarthi, Prince Takkar; +Cc: dev, sshankarnara, aprabhu

Fixed incorrect handling of TVM models with single MRVL
layer. Set the I/O layout to packed and fixed calculation
of quantized and dequantized data buffer addresses.

Fixes: 5cea2c67edfc ("ml/cnxk: update internal TVM model info structure")
Fixes: df2358f3adce ("ml/cnxk: add structures for TVM model type")

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 drivers/ml/cnxk/cnxk_ml_ops.c    | 12 ++++++++----
 drivers/ml/cnxk/mvtvm_ml_model.c |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c
index 971362b2420..07c7001b175 100644
--- a/drivers/ml/cnxk/cnxk_ml_ops.c
+++ b/drivers/ml/cnxk/cnxk_ml_ops.c
@@ -1462,7 +1462,8 @@ cnxk_ml_io_quantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_buf
 	d_offset = 0;
 	q_offset = 0;
 	for (i = 0; i < info->nb_inputs; i++) {
-		if (model->type == ML_CNXK_MODEL_TYPE_TVM) {
+		if (model->type == ML_CNXK_MODEL_TYPE_TVM &&
+		    model->subtype != ML_CNXK_MODEL_SUBTYPE_TVM_MRVL) {
 			lcl_dbuffer = dbuffer[i]->addr;
 			lcl_qbuffer = qbuffer[i]->addr;
 		} else {
@@ -1474,7 +1475,8 @@ cnxk_ml_io_quantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_buf
 		if (ret < 0)
 			return ret;
 
-		if (model->type == ML_CNXK_MODEL_TYPE_GLOW) {
+		if ((model->type == ML_CNXK_MODEL_TYPE_GLOW) ||
+		    (model->subtype == ML_CNXK_MODEL_SUBTYPE_TVM_MRVL)) {
 			d_offset += info->input[i].sz_d;
 			q_offset += info->input[i].sz_q;
 		}
@@ -1516,7 +1518,8 @@ cnxk_ml_io_dequantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_b
 	q_offset = 0;
 	d_offset = 0;
 	for (i = 0; i < info->nb_outputs; i++) {
-		if (model->type == ML_CNXK_MODEL_TYPE_TVM) {
+		if (model->type == ML_CNXK_MODEL_TYPE_TVM &&
+		    model->subtype != ML_CNXK_MODEL_SUBTYPE_TVM_MRVL) {
 			lcl_qbuffer = qbuffer[i]->addr;
 			lcl_dbuffer = dbuffer[i]->addr;
 		} else {
@@ -1528,7 +1531,8 @@ cnxk_ml_io_dequantize(struct rte_ml_dev *dev, uint16_t model_id, struct rte_ml_b
 		if (ret < 0)
 			return ret;
 
-		if (model->type == ML_CNXK_MODEL_TYPE_GLOW) {
+		if ((model->type == ML_CNXK_MODEL_TYPE_GLOW) ||
+		    (model->subtype == ML_CNXK_MODEL_SUBTYPE_TVM_MRVL)) {
 			q_offset += info->output[i].sz_q;
 			d_offset += info->output[i].sz_d;
 		}
diff --git a/drivers/ml/cnxk/mvtvm_ml_model.c b/drivers/ml/cnxk/mvtvm_ml_model.c
index e3234ae4422..c8c4f61f134 100644
--- a/drivers/ml/cnxk/mvtvm_ml_model.c
+++ b/drivers/ml/cnxk/mvtvm_ml_model.c
@@ -356,7 +356,7 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo
 	metadata = &model->mvtvm.metadata;
 	strlcpy(info->name, metadata->model.name, TVMDP_NAME_STRLEN);
 
-	info->io_layout = RTE_ML_IO_LAYOUT_SPLIT;
+	info->io_layout = RTE_ML_IO_LAYOUT_PACKED;
 }
 
 void
-- 
2.45.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-19 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-31  6:10 [PATCH v1 1/1] ml/cnxk: fix incorrect handling of TVM model I/O Srikanth Yalavarthi
  -- strict thread matches above, loose matches on Subject: below --
2024-07-31  5:41 Srikanth Yalavarthi
2024-09-19 17:31 ` Jerin Jacob

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).