From patchwork Thu Mar 23 16:23:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srikanth Yalavarthi X-Patchwork-Id: 125461 X-Patchwork-Delegate: thomas@monjalon.net 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 100084281F; Thu, 23 Mar 2023 17:23:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EDCD840689; Thu, 23 Mar 2023 17:23:19 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 54FF14021E for ; Thu, 23 Mar 2023 17:23:18 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32NBpgtN024001; Thu, 23 Mar 2023 09:23:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=Jj1S/TLJqsOrCHg8mfjU9twfa2seSjMPqnAtyNx8OZ4=; b=Tex691MWCDkMVMZ7la7Xal0TFtCA2ss5RkNcucEGJL9zduPtW+eTAIuYbxw1qYxdm7mH oKeCo2Pwo43A5MakmAtM54UX2TfOnnd2MwQ39LY7VD3Lr656rxiG5iOZtCA9JzT8PmUc LUZPorl/Sfml//K6Ys14dOrSZS3F5xZizfuoLLFEy1B0AEyp0Ad+Gz5+rM9BnyPfNlgH qAEUiCgMAHIO4IJQv/Kc3vuk67gtGIBtTxL1/WSk6Y4ciMKRSeabqu7D8FxeERZ/T85i qBiOwxi8CrYLF/szIkUOOizBELg+vfr+6sDhN4XmS4iGPXKUssme9NADymmxEcLKk+jA FA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pg9urcjn5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 23 Mar 2023 09:23:16 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 23 Mar 2023 09:23:15 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Thu, 23 Mar 2023 09:23:15 -0700 Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id 2B6FA3F7075; Thu, 23 Mar 2023 09:23:15 -0700 (PDT) From: Srikanth Yalavarthi To: Srikanth Yalavarthi , David Marchand , Stephen Hemminger , Anup Prabhu CC: Subject: [PATCH 1/1] app/mldev: fix code formatting and alignment Date: Thu, 23 Mar 2023 09:23:13 -0700 Message-ID: <20230323162313.13295-1-syalavarthi@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-GUID: c9ppswGT_CsqRkFUuBx_Lz49rfpwIv6Z X-Proofpoint-ORIG-GUID: c9ppswGT_CsqRkFUuBx_Lz49rfpwIv6Z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-22_21,2023-03-23_02,2023-02-09_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 Updated ML application source files to have uniform code formatting style across. Remove extra blank lines. Fixes: 8cb22a545447 ("app/mldev: fix debug build") Fixes: c9f073cdca95 ("mldev: remove unnecessary null checks") Fixes: da6793390596 ("app/mldev: support inference validation") Signed-off-by: Srikanth Yalavarthi --- app/test-mldev/test_inference_common.c | 38 ++++++++++++-------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/app/test-mldev/test_inference_common.c b/app/test-mldev/test_inference_common.c index 410e63bca4..f8960ae726 100644 --- a/app/test-mldev/test_inference_common.c +++ b/app/test-mldev/test_inference_common.c @@ -20,23 +20,23 @@ #define ML_TEST_READ_TYPE(buffer, type) (*((type *)buffer)) -#define ML_TEST_CHECK_OUTPUT(output, reference, tolerance) \ +#define ML_TEST_CHECK_OUTPUT(output, reference, tolerance) \ (((float)output - (float)reference) <= (((float)reference * tolerance) / 100.0)) -#define ML_OPEN_WRITE_GET_ERR(name, buffer, size, err) \ - do { \ - FILE *fp = fopen(name, "w+"); \ - if (fp == NULL) { \ - ml_err("Unable to create file: %s, error: %s", name, strerror(errno)); \ - err = true; \ - } else { \ - if (fwrite(buffer, 1, size, fp) != size) { \ - ml_err("Error writing output, file: %s, error: %s", name, \ - strerror(errno)); \ - err = true; \ - } \ - fclose(fp); \ - } \ +#define ML_OPEN_WRITE_GET_ERR(name, buffer, size, err) \ + do { \ + FILE *fp = fopen(name, "w+"); \ + if (fp == NULL) { \ + ml_err("Unable to create file: %s, error: %s", name, strerror(errno)); \ + err = true; \ + } else { \ + if (fwrite(buffer, 1, size, fp) != size) { \ + ml_err("Error writing output, file: %s, error: %s", name, \ + strerror(errno)); \ + err = true; \ + } \ + fclose(fp); \ + } \ } while (0) static void @@ -937,7 +937,7 @@ ml_request_finish(struct rte_mempool *mp, void *opaque, void *obj, unsigned int if (t->cmn.opt->debug) { /* dump quantized output buffer */ if (asprintf(&dump_path, "%s.q.%u", t->cmn.opt->filelist[req->fid].output, - obj_idx) == -1) + obj_idx) == -1) return; ML_OPEN_WRITE_GET_ERR(dump_path, req->output, model->out_qsize, error); free(dump_path); @@ -945,8 +945,8 @@ ml_request_finish(struct rte_mempool *mp, void *opaque, void *obj, unsigned int return; /* dump dequantized output buffer */ - if (asprintf(&dump_path, "%s.%u", t->cmn.opt->filelist[req->fid].output, - obj_idx) == -1) + if (asprintf(&dump_path, "%s.%u", t->cmn.opt->filelist[req->fid].output, obj_idx) == + -1) return; ML_OPEN_WRITE_GET_ERR(dump_path, model->output, model->out_dsize, error); free(dump_path); @@ -1077,7 +1077,6 @@ ml_inference_stats_get(struct ml_test *test, struct ml_options *opt) /* release buffers */ rte_free(t->xstats_map); - rte_free(t->xstats_values); /* print end-to-end stats */ @@ -1116,7 +1115,6 @@ ml_inference_stats_get(struct ml_test *test, struct ml_options *opt) error: rte_free(t->xstats_map); - rte_free(t->xstats_values); return ret;