From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 840A4456FF; Wed, 31 Jul 2024 08:13:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5802E410E8; Wed, 31 Jul 2024 08:13:40 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id E7D80402C8 for ; Wed, 31 Jul 2024 08:10:19 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46V4ePb7025531 for ; Tue, 30 Jul 2024 23:10:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=hKsXoFStYBK+16s9Tq277Jb ZlTbrtD+w+O2MgiePZFo=; b=R2eWOc5gxWCH7oa67Od8caJLRlZFg1BXU0N767N ruZwt+kBQiyM4qRaTRdlEJJf9Mr/icxYHt6ZlKFnydnoYWOSKZXDSGHyxa6IbzH4 cxn6qup7eN1puX5msU8C1mYJHb6jyLuyaV9hFoLA7N2aIVZt8m0+6mjTSbAxIiSr 9r8JzlbC7Imx9nw3DbiB6W0VnGcGDvdN+RqBlGgm6Wckc0ATPZ8D284YTr+dVQJd GKnwc+/APFUF2IDwZi5dnQTVQ+B1CvoR9B7TiuYtZzfNDbMQLsI0Ue9npDYqlGcJ gao0Ndk5JgQtRdrrZlbTkTHdaqcNQCkGftVN9LhEpv7Oyuw== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 40qeeur8tn-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 30 Jul 2024 23:10:18 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 30 Jul 2024 23:10:18 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 30 Jul 2024 23:10:18 -0700 Received: from ml-host-33.sclab.marvell.com. (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id CEA4A5E6861; Tue, 30 Jul 2024 23:10:17 -0700 (PDT) From: Srikanth Yalavarthi To: Srikanth Yalavarthi , Prince Takkar CC: , , Subject: [PATCH v1 1/1] ml/cnxk: fix incorrect handling of TVM model I/O Date: Tue, 30 Jul 2024 23:10:15 -0700 Message-ID: <20240731061016.8086-1-syalavarthi@marvell.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 7EiVUZQnnfHoVIbN87jlGWB9vYPosIvh X-Proofpoint-ORIG-GUID: 7EiVUZQnnfHoVIbN87jlGWB9vYPosIvh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-31_03,2024-07-30_01,2024-05-17_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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