From patchwork Wed Jul 31 05:41:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srikanth Yalavarthi X-Patchwork-Id: 142775 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 82030456F9; Wed, 31 Jul 2024 07:57:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1059340668; Wed, 31 Jul 2024 07:57:05 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 224964066C for ; Wed, 31 Jul 2024 07:41:11 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46V3DOGF001728 for ; Tue, 30 Jul 2024 22:41:11 -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=hxEyhOYt+kabRQcYnYRGbrT3YTnOlqNPnGw14ZT 5zPpMWxXWcUghX6SW3Yz3OT8B8zAmsaBSdntJtWFmPsngE6pAV/vA+CDeHEEpsLI acEbALd0OG0J5KQJZtjHG5lgMCLjaJNBoFJpiNKDeWkDUxnJHqo8L0bAjn2X1Bl3 b3OhtUNjF4x/KLLkAZSB67NtK/rip9xa01vWJ4Z20LP7QrKLQZbuOq68SNfOg8P4 XwfDggz/DmO+IJFqc3zpxbxdc8LJ++DucEE8ytkce1L5nQzv/pYq/ayFqyTTmb6a Ke49I4wL/LoVBjOBhDNvT0cq05oT431/2BAHREJdTRt4Kag== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 40qd64rfd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 30 Jul 2024 22:41:10 -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 22:41:09 -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 22:41:09 -0700 Received: from ml-host-33.sclab.marvell.com. (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id 5AA435C68E1; Tue, 30 Jul 2024 22:41:09 -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 22:41:03 -0700 Message-ID: <20240731054104.7576-1-syalavarthi@marvell.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: WzGsLkPW1E3-sdRasrhxYBjeq1fSZmGX X-Proofpoint-GUID: WzGsLkPW1E3-sdRasrhxYBjeq1fSZmGX 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_02,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