From patchwork Thu Feb 2 09:13:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Baum X-Patchwork-Id: 122889 X-Patchwork-Delegate: gakhil@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 A824041BAB; Thu, 2 Feb 2023 10:14:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CD62942D59; Thu, 2 Feb 2023 10:14:01 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2073.outbound.protection.outlook.com [40.107.220.73]) by mails.dpdk.org (Postfix) with ESMTP id 1D85F42D49 for ; Thu, 2 Feb 2023 10:14:00 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PVtxWl/wvXrVuAR76Z+EldPZ5J9QV8Onwrz85z5DJ9KimyQcSt+7iau7RFRxTZ1Y7SO7f8X0vynX+iph/3QpTfhVBp3cvNqxNL3ID96MZc34PWFSklAy7Y0E9qJoSDuTxJoGcGBAwXxOOKw8ZgAgL06Cjjbc+jOd7V+y8N7I2ddW1HA8sXG49s+WcyuOe4S/ur6JSjdItkMpPyM3M9AoraTR3u0QEonYPDw0PunFp5csTfQZxC7Fx8gfB+gnKc+2ceMouTtPXsyF6YgE3F6v2drd46QCnhhxsfQde7jKwRzx8cJDJCkTuKoNFtNuUk+9r9X0cmr+ifLTM/U/GO6I5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pofdpSpu2+hwZcp4y+nPG2NU1JjGVX7/JQCzjWWzraI=; b=kro0+wf0uZki1hlgpiqiBn+uCOzmVFbEVq/niysPzlXFnC1VP/E8m77tmShqLDNr5+vmHAuNNzw0tElaqPORAbc4viaH7rYHDSzOsIoAB1roGfCocw+fELCIppXoaNPkJbCWHBMQcTMuQdjyCezB92hNu7GnEJ9+I7y6wHsEgmC3wu446T2wMtk5U8Oa6TLaohKD+6aYCn5YW9vMQ6PnaPTc9gsVAig3uy5otJbg6lrfCgpt6jDxioJMnUsFKwNevVjXzrb42hH+0aoesjxs24BQe+dMuq3v85qXdLLBkEarwYZXdlIjYTZp1jJE1e+XVTnovQ6Jdf0A5xfBBstIFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pofdpSpu2+hwZcp4y+nPG2NU1JjGVX7/JQCzjWWzraI=; b=dYolvaXNPuUv2LHPuU/bgF+iWES3ZmUs2rko/SLNzJsyuV/Wt0dCwiJI7UwVRTqLR1XaZh8hWzLdmaxpP8R6H61OLEep02xXnqZsFWpCjoE5ztHQubaTq/+knQ2C3O5CuRBeaRQHEK5nRXU8E5Fe/rZeWV4TfDgL5mNJQP0OCgsZmm1OBK+CQNkUrLMzMI/JK/eB+RQx6kamwaczI0wUSElPItDqLA2tsH94tGV+mN1ll67glpra/2rmLJNWGn2zoDac9S0oljGHCrCJhzO00ngoab3Qvp3Du8KjsWF2qsU1Ql4THrFwen1xDCsdJg5YuFEVCqnrIL1znLgUBWizpg== Received: from BN0PR08CA0001.namprd08.prod.outlook.com (2603:10b6:408:142::6) by PH7PR12MB6857.namprd12.prod.outlook.com (2603:10b6:510:1af::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Thu, 2 Feb 2023 09:13:57 +0000 Received: from BN8NAM11FT110.eop-nam11.prod.protection.outlook.com (2603:10b6:408:142:cafe::2b) by BN0PR08CA0001.outlook.office365.com (2603:10b6:408:142::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.25 via Frontend Transport; Thu, 2 Feb 2023 09:13:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BN8NAM11FT110.mail.protection.outlook.com (10.13.176.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27 via Frontend Transport; Thu, 2 Feb 2023 09:13:57 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 2 Feb 2023 01:13:43 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 2 Feb 2023 01:13:42 -0800 Received: from nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36 via Frontend Transport; Thu, 2 Feb 2023 01:13:40 -0800 From: Michael Baum To: CC: Matan Azrad , Akhil Goyal , "Ashish Gupta" , Fiona Trahe , "Thomas Monjalon" Subject: [PATCH v2 2/4] app/test-compress-perf: allow test single compress operation Date: Thu, 2 Feb 2023 11:13:30 +0200 Message-ID: <20230202091332.1037078-3-michaelba@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230202091332.1037078-1-michaelba@nvidia.com> References: <20230109074526.2507344-1-michaelba@nvidia.com> <20230202091332.1037078-1-michaelba@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT110:EE_|PH7PR12MB6857:EE_ X-MS-Office365-Filtering-Correlation-Id: fb96c6d5-e828-4ec5-dbaf-08db04fdd07b X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3aRw6pcVV1PlVjiTPSf8UOH/+xVG/nrHATwDYDX41f1ikezotJCk++1+m2Voj7K0TTRvRMcpWAzweuPKAHO8kXJXUTiJmQZ80Tt+M3zn6ZL5uaOt7OMteF+89vbKfVnw8kehmjtr4VXkDQm8tLagyNn3m4aQEnOS6QLkfXMm+jBasXQV+L95jna9H9dxZCeAtMlbC4fZDqE4jX1KIRMX58ybKNeT/7ly+f/M/4DqLNt9Xd3KHidv+iLVnF+piauRjbUvp2lscL5KwNP0AauGVxJQ/AflXXk0s+z/QLaU9EzpNyBLN7PMf3H7jKanK5hmKBogHaZnBqsGf0+XMhMsDoQWAIo50wmMres20xOUpglafwb7evVf4tQL77wSaROAWrkDQTMLUqky8hABvLJeO7sE76dm/oKDdj02pu53PdX8fH+F2gf585J52hZKzOFnECSbPOzdhSnxT/eTM42Q9yByz3tmHKRVfWL1XAvhjdMjNSIfcasdYx8PdAFBDJ5uupdj2xc4jphREzfuHXjgrh3XRD2gxQcVzoVQ8W2dmX54hzyeaDY5IhyMxkwzFA07a8zK/4Kxc7oa7TLo0o6mI3CUbJWVMKp7yRyEzhe5HPC1VBrbPtoEJe7wt8Qzf3t/Xo9YaoF/VuLSGbtZdXtsnp2eforc8YTFGyor/ksUI49fLvQiUI9PLXuNQpwyng0ic75dcwxBYJ/tQ3M7/zerdw== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(376002)(136003)(39860400002)(396003)(346002)(451199018)(40470700004)(46966006)(36840700001)(336012)(66899018)(2906002)(478600001)(36756003)(70586007)(30864003)(40460700003)(6666004)(1076003)(26005)(186003)(6286002)(2616005)(7696005)(55016003)(8936002)(40480700001)(47076005)(86362001)(5660300002)(356005)(41300700001)(426003)(82310400005)(8676002)(83380400001)(70206006)(4326008)(6916009)(316002)(82740400003)(36860700001)(7636003)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2023 09:13:57.2041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb96c6d5-e828-4ec5-dbaf-08db04fdd07b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT110.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6857 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 Part of the application options is to test only compress and only decompress but actually the application ignores this user option and tries to test always both compress and decompress. Allow testing only compress and only decompress. Signed-off-by: Matan Azrad Signed-off-by: Michael Baum --- app/test-compress-perf/comp_perf_options.h | 6 +- .../comp_perf_options_parse.c | 4 +- .../comp_perf_test_common.c | 126 +++++++++++++----- .../comp_perf_test_cyclecount.c | 71 ++++++---- .../comp_perf_test_throughput.c | 64 +++++---- .../comp_perf_test_verify.c | 64 +++++---- app/test-compress-perf/main.c | 8 ++ doc/guides/rel_notes/release_23_03.rst | 4 + 8 files changed, 230 insertions(+), 117 deletions(-) diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h index 57dd146330..d00b299247 100644 --- a/app/test-compress-perf/comp_perf_options.h +++ b/app/test-compress-perf/comp_perf_options.h @@ -32,9 +32,9 @@ enum cperf_test_type { }; enum comp_operation { - COMPRESS_ONLY, - DECOMPRESS_ONLY, - COMPRESS_DECOMPRESS + COMPRESS = (1 << 0), + DECOMPRESS = (1 << 1), + COMPRESS_DECOMPRESS = (COMPRESS | DECOMPRESS), }; struct range_list { diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c index 019eddb7bd..7a992bf43e 100644 --- a/app/test-compress-perf/comp_perf_options_parse.c +++ b/app/test-compress-perf/comp_perf_options_parse.c @@ -446,11 +446,11 @@ parse_op_type(struct comp_test_data *test_data, const char *arg) struct name_id_map optype_namemap[] = { { "comp", - COMPRESS_ONLY + COMPRESS }, { "decomp", - DECOMPRESS_ONLY + DECOMPRESS }, { "comp_and_decomp", diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c index b402a0d839..cd60958944 100644 --- a/app/test-compress-perf/comp_perf_test_common.c +++ b/app/test-compress-perf/comp_perf_test_common.c @@ -227,23 +227,43 @@ comp_perf_allocate_memory(struct comp_test_data *test_data, { uint16_t comp_mbuf_size; uint16_t decomp_mbuf_size; + size_t comp_data_size; + size_t decomp_data_size; + size_t output_data_sz; test_data->out_seg_sz = find_buf_size(test_data->seg_sz); - /* Number of segments for input and output - * (compression and decompression) - */ - test_data->total_segs = DIV_CEIL(test_data->input_data_sz, - test_data->seg_sz); + if (test_data->test_op & COMPRESS) { + /* + * Number of segments for input and output + * (compression and decompression) + */ + test_data->total_segs = DIV_CEIL(test_data->input_data_sz, + test_data->seg_sz); + } else { + /* + * When application does decompression only, input data is + * compressed and smaller than the output. The expected size of + * uncompressed data given by the user in segment size argument. + */ + test_data->total_segs = test_data->max_sgl_segs; + } + + output_data_sz = (size_t) test_data->out_seg_sz * test_data->total_segs; + output_data_sz = + RTE_MAX(output_data_sz, (size_t) MIN_COMPRESSED_BUF_SIZE); if (test_data->use_external_mbufs != 0) { if (comp_perf_allocate_external_mbufs(test_data, mem) < 0) return -1; comp_mbuf_size = 0; decomp_mbuf_size = 0; - } else { + } else if (test_data->test_op & COMPRESS) { comp_mbuf_size = test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM; decomp_mbuf_size = test_data->seg_sz + RTE_PKTMBUF_HEADROOM; + } else { + comp_mbuf_size = test_data->seg_sz + RTE_PKTMBUF_HEADROOM; + decomp_mbuf_size = test_data->out_seg_sz + RTE_PKTMBUF_HEADROOM; } char pool_name[32] = ""; @@ -287,26 +307,28 @@ comp_perf_allocate_memory(struct comp_test_data *test_data, return -1; } - /* - * Compressed data might be a bit larger than input data, - * if data cannot be compressed - */ - mem->compressed_data = rte_zmalloc_socket(NULL, - RTE_MAX( - (size_t) test_data->out_seg_sz * - test_data->total_segs, - (size_t) MIN_COMPRESSED_BUF_SIZE), - 0, - rte_socket_id()); + if (test_data->test_op & COMPRESS) { + /* + * Compressed data might be a bit larger than input data, + * if data cannot be compressed + */ + comp_data_size = output_data_sz; + decomp_data_size = test_data->input_data_sz; + } else { + comp_data_size = test_data->input_data_sz; + decomp_data_size = output_data_sz; + } + + mem->compressed_data = rte_zmalloc_socket(NULL, comp_data_size, 0, + rte_socket_id()); if (mem->compressed_data == NULL) { RTE_LOG(ERR, USER1, "Memory to hold the data from the input " "file could not be allocated\n"); return -1; } - mem->decompressed_data = rte_zmalloc_socket(NULL, - test_data->input_data_sz, 0, - rte_socket_id()); + mem->decompressed_data = rte_zmalloc_socket(NULL, decomp_data_size, 0, + rte_socket_id()); if (mem->decompressed_data == NULL) { RTE_LOG(ERR, USER1, "Memory to hold the data from the input " "file could not be allocated\n"); @@ -351,6 +373,7 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) uint16_t segs_per_mbuf = 0; uint32_t cmz = 0; uint32_t dmz = 0; + bool decompress_only = !!(test_data->test_op == DECOMPRESS); for (i = 0; i < mem->total_bufs; i++) { /* Allocate data in input mbuf and copy data from input file */ @@ -361,8 +384,6 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) return -1; } - data_sz = RTE_MIN(remaining_data, test_data->seg_sz); - if (test_data->use_external_mbufs != 0) { rte_pktmbuf_attach_extbuf(mem->decomp_bufs[i], mem->decomp_memzones[dmz]->addr, @@ -372,16 +393,23 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) dmz++; } + if (!decompress_only) + data_sz = RTE_MIN(remaining_data, test_data->seg_sz); + else + data_sz = test_data->out_seg_sz; + data_addr = (uint8_t *) rte_pktmbuf_append( mem->decomp_bufs[i], data_sz); if (data_addr == NULL) { RTE_LOG(ERR, USER1, "Could not append data\n"); return -1; } - rte_memcpy(data_addr, input_data_ptr, data_sz); - input_data_ptr += data_sz; - remaining_data -= data_sz; + if (!decompress_only) { + rte_memcpy(data_addr, input_data_ptr, data_sz); + input_data_ptr += data_sz; + remaining_data -= data_sz; + } /* Already one segment in the mbuf */ segs_per_mbuf = 1; @@ -398,8 +426,6 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) return -1; } - data_sz = RTE_MIN(remaining_data, test_data->seg_sz); - if (test_data->use_external_mbufs != 0) { rte_pktmbuf_attach_extbuf( next_seg, @@ -410,6 +436,12 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) dmz++; } + if (!decompress_only) + data_sz = RTE_MIN(remaining_data, + test_data->seg_sz); + else + data_sz = test_data->out_seg_sz; + data_addr = (uint8_t *)rte_pktmbuf_append(next_seg, data_sz); @@ -418,9 +450,11 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) return -1; } - rte_memcpy(data_addr, input_data_ptr, data_sz); - input_data_ptr += data_sz; - remaining_data -= data_sz; + if (!decompress_only) { + rte_memcpy(data_addr, input_data_ptr, data_sz); + input_data_ptr += data_sz; + remaining_data -= data_sz; + } if (rte_pktmbuf_chain(mem->decomp_bufs[i], next_seg) < 0) { @@ -447,16 +481,26 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) cmz++; } - data_addr = (uint8_t *) rte_pktmbuf_append( - mem->comp_bufs[i], - test_data->out_seg_sz); + if (decompress_only) + data_sz = RTE_MIN(remaining_data, test_data->seg_sz); + else + data_sz = test_data->out_seg_sz; + + data_addr = (uint8_t *) rte_pktmbuf_append(mem->comp_bufs[i], + data_sz); if (data_addr == NULL) { RTE_LOG(ERR, USER1, "Could not append data\n"); return -1; } + if (decompress_only) { + rte_memcpy(data_addr, input_data_ptr, data_sz); + input_data_ptr += data_sz; + remaining_data -= data_sz; + } + /* Chain mbufs if needed for output mbufs */ - for (j = 1; j < segs_per_mbuf; j++) { + for (j = 1; j < segs_per_mbuf && remaining_data > 0; j++) { struct rte_mbuf *next_seg = rte_pktmbuf_alloc(mem->comp_buf_pool); @@ -476,13 +520,25 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) cmz++; } + if (decompress_only) + data_sz = RTE_MIN(remaining_data, + test_data->seg_sz); + else + data_sz = test_data->out_seg_sz; + data_addr = (uint8_t *)rte_pktmbuf_append(next_seg, - test_data->out_seg_sz); + data_sz); if (data_addr == NULL) { RTE_LOG(ERR, USER1, "Could not append data\n"); return -1; } + if (decompress_only) { + rte_memcpy(data_addr, input_data_ptr, data_sz); + input_data_ptr += data_sz; + remaining_data -= data_sz; + } + if (rte_pktmbuf_chain(mem->comp_bufs[i], next_seg) < 0) { RTE_LOG(ERR, USER1, "Could not chain mbufs\n"); diff --git a/app/test-compress-perf/comp_perf_test_cyclecount.c b/app/test-compress-perf/comp_perf_test_cyclecount.c index 7473cb6277..ce6c4d7605 100644 --- a/app/test-compress-perf/comp_perf_test_cyclecount.c +++ b/app/test-compress-perf/comp_perf_test_cyclecount.c @@ -514,38 +514,55 @@ cperf_cyclecount_test_runner(void *test_ctx) if (cperf_verify_test_runner(&ctx->ver)) return EXIT_FAILURE; - /* - * Run the tests twice, discarding the first performance - * results, before the cache is warmed up - */ - - /* C O M P R E S S */ - for (i = 0; i < 2; i++) { - if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) - return EXIT_FAILURE; - } + if (test_data->test_op & COMPRESS) { + /* + * Run the test twice, discarding the first performance + * results, before the cache is warmed up + */ + for (i = 0; i < 2; i++) { + if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) + return EXIT_FAILURE; + } - ops_enq_retries_comp = ctx->ops_enq_retries; - ops_deq_retries_comp = ctx->ops_deq_retries; + ops_enq_retries_comp = ctx->ops_enq_retries; + ops_deq_retries_comp = ctx->ops_deq_retries; - duration_enq_per_op_comp = ctx->duration_enq / - (ctx->ver.mem.total_bufs * test_data->num_iter); - duration_deq_per_op_comp = ctx->duration_deq / - (ctx->ver.mem.total_bufs * test_data->num_iter); + duration_enq_per_op_comp = ctx->duration_enq / + (ctx->ver.mem.total_bufs * test_data->num_iter); + duration_deq_per_op_comp = ctx->duration_deq / + (ctx->ver.mem.total_bufs * test_data->num_iter); + } else { + ops_enq_retries_comp = 0; + ops_deq_retries_comp = 0; - /* D E C O M P R E S S */ - for (i = 0; i < 2; i++) { - if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) - return EXIT_FAILURE; + duration_enq_per_op_comp = 0; + duration_deq_per_op_comp = 0; } - ops_enq_retries_decomp = ctx->ops_enq_retries; - ops_deq_retries_decomp = ctx->ops_deq_retries; + if (test_data->test_op & DECOMPRESS) { + /* + * Run the test twice, discarding the first performance + * results, before the cache is warmed up + */ + for (i = 0; i < 2; i++) { + if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) + return EXIT_FAILURE; + } - duration_enq_per_op_decomp = ctx->duration_enq / - (ctx->ver.mem.total_bufs * test_data->num_iter); - duration_deq_per_op_decomp = ctx->duration_deq / - (ctx->ver.mem.total_bufs * test_data->num_iter); + ops_enq_retries_decomp = ctx->ops_enq_retries; + ops_deq_retries_decomp = ctx->ops_deq_retries; + + duration_enq_per_op_decomp = ctx->duration_enq / + (ctx->ver.mem.total_bufs * test_data->num_iter); + duration_deq_per_op_decomp = ctx->duration_deq / + (ctx->ver.mem.total_bufs * test_data->num_iter); + } else { + ops_enq_retries_decomp = 0; + ops_deq_retries_decomp = 0; + + duration_enq_per_op_decomp = 0; + duration_deq_per_op_decomp = 0; + } duration_setup_per_op = ctx->duration_op / (ctx->ver.mem.total_bufs * test_data->num_iter); @@ -563,7 +580,7 @@ cperf_cyclecount_test_runner(void *test_ctx) " [D-e] - decompression enqueue\n" " [D-d] - decompression dequeue\n" " - Cycles section: number of cycles per 'op' for the following operations:\n" - " setup/op - memory allocation, op configuration and memory dealocation\n" + " setup/op - memory allocation, op configuration and memory deallocation\n" " [C-e] - compression enqueue\n" " [C-d] - compression dequeue\n" " [D-e] - decompression enqueue\n" diff --git a/app/test-compress-perf/comp_perf_test_throughput.c b/app/test-compress-perf/comp_perf_test_throughput.c index 79cd2b2bf2..c9f8237626 100644 --- a/app/test-compress-perf/comp_perf_test_throughput.c +++ b/app/test-compress-perf/comp_perf_test_throughput.c @@ -359,41 +359,53 @@ cperf_throughput_test_runner(void *test_ctx) * First the verification part is needed */ if (cperf_verify_test_runner(&ctx->ver)) { - ret = EXIT_FAILURE; + ret = EXIT_FAILURE; goto end; } - /* - * Run the tests twice, discarding the first performance - * results, before the cache is warmed up - */ - for (i = 0; i < 2; i++) { - if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) { - ret = EXIT_FAILURE; - goto end; + if (test_data->test_op & COMPRESS) { + /* + * Run the test twice, discarding the first performance + * results, before the cache is warmed up + */ + for (i = 0; i < 2; i++) { + if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) { + ret = EXIT_FAILURE; + goto end; + } } - } - for (i = 0; i < 2; i++) { - if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) { - ret = EXIT_FAILURE; - goto end; - } + ctx->comp_tsc_byte = + (double)(ctx->comp_tsc_duration[test_data->level]) / + test_data->input_data_sz; + ctx->comp_gbps = rte_get_tsc_hz() / ctx->comp_tsc_byte * 8 / + 1000000000; + } else { + ctx->comp_tsc_byte = 0; + ctx->comp_gbps = 0; } - ctx->comp_tsc_byte = - (double)(ctx->comp_tsc_duration[test_data->level]) / - test_data->input_data_sz; + if (test_data->test_op & DECOMPRESS) { + /* + * Run the test twice, discarding the first performance + * results, before the cache is warmed up + */ + for (i = 0; i < 2; i++) { + if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) { + ret = EXIT_FAILURE; + goto end; + } + } - ctx->decomp_tsc_byte = + ctx->decomp_tsc_byte = (double)(ctx->decomp_tsc_duration[test_data->level]) / - test_data->input_data_sz; - - ctx->comp_gbps = rte_get_tsc_hz() / ctx->comp_tsc_byte * 8 / - 1000000000; - - ctx->decomp_gbps = rte_get_tsc_hz() / ctx->decomp_tsc_byte * 8 / - 1000000000; + test_data->input_data_sz; + ctx->decomp_gbps = rte_get_tsc_hz() / ctx->decomp_tsc_byte * 8 / + 1000000000; + } else { + ctx->decomp_tsc_byte = 0; + ctx->decomp_gbps = 0; + } exp = 0; if (__atomic_compare_exchange_n(&display_once, &exp, 1, 0, diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c index 8964442891..7d6b6abecd 100644 --- a/app/test-compress-perf/comp_perf_test_verify.c +++ b/app/test-compress-perf/comp_perf_test_verify.c @@ -114,7 +114,8 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type) output_data_sz = &ctx->decomp_data_sz; input_bufs = mem->comp_bufs; output_bufs = mem->decomp_bufs; - out_seg_sz = test_data->seg_sz; + out_seg_sz = (test_data->test_op & COMPRESS) ? + test_data->seg_sz : test_data->out_seg_sz; } /* Create private xform */ @@ -226,7 +227,7 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type) op->status == RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE) { RTE_LOG(ERR, USER1, -"Out of space error occurred due to uncompressible input data expanding to larger than destination buffer. Increase the EXPANSE_RATIO constant to use this data.\n"); +"Out of space error occurred due to incompressible input data expanding to larger than destination buffer. Increase the EXPANSE_RATIO constant to use this data.\n"); res = -1; goto end; } else if (op->status != @@ -311,7 +312,7 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type) op->status == RTE_COMP_OP_STATUS_OUT_OF_SPACE_RECOVERABLE) { RTE_LOG(ERR, USER1, -"Out of space error occurred due to uncompressible input data expanding to larger than destination buffer. Increase the EXPANSE_RATIO constant to use this data.\n"); +"Out of space error occurred due to incompressible input data expanding to larger than destination buffer. Increase the EXPANSE_RATIO constant to use this data.\n"); res = -1; goto end; } else if (op->status != @@ -392,44 +393,59 @@ cperf_verify_test_runner(void *test_ctx) int ret = EXIT_SUCCESS; static uint16_t display_once; uint32_t lcore = rte_lcore_id(); + uint16_t exp = 0; ctx->mem.lcore_id = lcore; test_data->ratio = 0; - if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) { - ret = EXIT_FAILURE; - goto end; + if (test_data->test_op & COMPRESS) { + if (main_loop(ctx, RTE_COMP_COMPRESS) < 0) { + ret = EXIT_FAILURE; + goto end; + } } - if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) { - ret = EXIT_FAILURE; - goto end; - } + if (test_data->test_op & DECOMPRESS) { + if (main_loop(ctx, RTE_COMP_DECOMPRESS) < 0) { + ret = EXIT_FAILURE; + goto end; + } - if (ctx->decomp_data_sz != test_data->input_data_sz) { - RTE_LOG(ERR, USER1, - "Decompressed data length not equal to input data length\n"); - RTE_LOG(ERR, USER1, - "Decompressed size = %zu, expected = %zu\n", - ctx->decomp_data_sz, test_data->input_data_sz); - ret = EXIT_FAILURE; - goto end; - } else { - if (memcmp(ctx->mem.decompressed_data, - test_data->input_data, - test_data->input_data_sz) != 0) { + if (!(test_data->test_op & COMPRESS)) { + /* + * For DECOMPRESS_ONLY mode there is no more + * verifications, reset the 'ratio' and 'comp_data_sz' + * fields for other tests report. + */ + ctx->comp_data_sz = 0; + ctx->ratio = 0; + goto end; + } + + if (ctx->decomp_data_sz != test_data->input_data_sz) { + RTE_LOG(ERR, USER1, + "Decompressed data length not equal to input data length\n"); RTE_LOG(ERR, USER1, - "Decompressed data is not the same as file data\n"); + "Decompressed size = %zu, expected = %zu\n", + ctx->decomp_data_sz, test_data->input_data_sz); ret = EXIT_FAILURE; goto end; + } else { + if (memcmp(ctx->mem.decompressed_data, + test_data->input_data, + test_data->input_data_sz) != 0) { + RTE_LOG(ERR, USER1, + "Decompressed data is not the same as file data\n"); + ret = EXIT_FAILURE; + goto end; + } } } ctx->ratio = (double) ctx->comp_data_sz / test_data->input_data_sz * 100; - uint16_t exp = 0; if (!ctx->silent) { if (__atomic_compare_exchange_n(&display_once, &exp, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c index 41b8edc2bd..bbb4c7917b 100644 --- a/app/test-compress-perf/main.c +++ b/app/test-compress-perf/main.c @@ -254,6 +254,14 @@ comp_perf_dump_input_data(struct comp_test_data *test_data) goto end; } + if (!(test_data->test_op & COMPRESS) && + test_data->input_data_sz > + (size_t) test_data->seg_sz * (size_t) test_data->max_sgl_segs) { + RTE_LOG(ERR, USER1, + "Size of input must be less than total segments\n"); + goto end; + } + test_data->input_data = rte_zmalloc_socket(NULL, test_data->input_data_sz, 0, rte_socket_id()); diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index 2722296180..15fa8e812b 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -85,6 +85,10 @@ New Features * Added support for ``RTE_COMP_ALGO_LZ4``. * Added support for ``RTE_COMP_CHECKSUM_XXHASH32``. +* **Allowed test single compress operation in test-compress-perf.** + + Enable the application options for testing only compress and only decompress. + Removed Items -------------