From patchwork Mon Mar 11 14:47:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Szczepanek X-Patchwork-Id: 758 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 F422043C88; Mon, 11 Mar 2024 15:47:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 852474067B; Mon, 11 Mar 2024 15:47:30 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 95FBA4026B for ; Mon, 11 Mar 2024 15:47:29 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AF6B0FEC; Mon, 11 Mar 2024 07:48:05 -0700 (PDT) Received: from ampere-altra-2-1.usa.Arm.com (ampere-altra-2-1.usa.arm.com [10.118.91.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B100B3F762; Mon, 11 Mar 2024 07:47:28 -0700 (PDT) From: Paul Szczepanek To: dev@dpdk.org Cc: bruce.richardson@intel.com, Paul Szczepanek Subject: [PATCH v9 0/5] add pointer compression API Date: Mon, 11 Mar 2024 14:47:01 +0000 Message-Id: <20240311144706.204831-1-paul.szczepanek@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230927150854.3670391-2-paul.szczepanek@arm.com> References: <20230927150854.3670391-2-paul.szczepanek@arm.com> MIME-Version: 1.0 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 This patchset is proposing adding a new header only library with utility functions that allow compression of arrays of pointers. Since this is a header only library a patch needed to be added to amend the build system to allow adding libraries without source files. When passing caches full of pointers between threads, memory containing the pointers is copied multiple times which is especially costly between cores. A compression method will allow us to shrink the memory size copied. The compression takes advantage of the fact that pointers are usually located in a limited memory region (like a mempool). We can compress them by converting them to offsets from a base memory address. Offsets can be stored in fewer bytes (dictated by the memory region size and alignment of the pointer). For example: an 8 byte aligned pointer which is part of a 32GB memory pool can be stored in 4 bytes. The API is very generic and does not assume mempool pointers, any pointer can be passed in. Compression is based on few and fast operations and especially with vector instructions leveraged creates minimal overhead. The API accepts and returns arrays because the overhead means it only is worth it when done in bulk. Test is added that shows potential performance gain from compression. In this test an array of pointers is passed through a ring between two cores. It shows the gain which is dependent on the bulk operation size. In this synthetic test run on ampere altra a substantial (up to 25%) performance gain is seen if done in bulk size larger than 32. At 32 it breaks even and lower sizes create a small (less than 5%) slowdown due to overhead. In a more realistic mock application running the l3 forwarding dpdk example that works in pipeline mode on two cores this translated into a ~5% throughput increase on an ampere altra. v2: * addressed review comments (style, explanations and typos) * lowered bulk iterations closer to original numbers to keep runtime short * fixed pointer size warning on 32-bit arch v3: * added 16-bit versions of compression functions and tests * added documentation of these new utility functions in the EAL guide v4: * added unit test * fix bug in NEON implementation of 32-bit decompress v5: * disable NEON and SVE implementation on AARCH32 due to wrong pointer size v6: * added example usage to commit message of the initial commit v7: * rebase to remove clashing mailmap changes v8: * put ptr compress into its own library * add depends-on tag * remove copyright bumps * typos v9 * added MAINTAINERS entries, release notes, doc indexes etc. * added patch for build system to allow header only library Paul Szczepanek (5): lib: allow libraries with no sources ptr_compress: add pointer compression library test: add pointer compress tests to ring perf test docs: add pointer compression guide test: add unit test for ptr compression MAINTAINERS | 6 + app/test/meson.build | 21 +- app/test/test_ptr_compress.c | 108 +++++++ app/test/test_ring.h | 92 ++++++ app/test/test_ring_perf.c | 352 ++++++++++++++------- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + doc/guides/prog_guide/index.rst | 1 + doc/guides/prog_guide/ptr_compress_lib.rst | 142 +++++++++ doc/guides/rel_notes/release_24_03.rst | 6 + lib/meson.build | 15 + lib/ptr_compress/meson.build | 4 + lib/ptr_compress/rte_ptr_compress.h | 266 ++++++++++++++++ 13 files changed, 883 insertions(+), 132 deletions(-) create mode 100644 app/test/test_ptr_compress.c create mode 100644 doc/guides/prog_guide/ptr_compress_lib.rst create mode 100644 lib/ptr_compress/meson.build create mode 100644 lib/ptr_compress/rte_ptr_compress.h --- 2.25.1