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 68E42A0C47; Wed, 27 Oct 2021 16:31:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 027CB40E0F; Wed, 27 Oct 2021 16:31:36 +0200 (CEST) Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by mails.dpdk.org (Postfix) with ESMTP id B72B2407FF for ; Wed, 27 Oct 2021 16:31:34 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id C191A580569; Wed, 27 Oct 2021 10:31:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 27 Oct 2021 10:31:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= 93LCChtZfmc3E8sW68Wopzxx2rP36GtjQ9tRb3lUKVc=; b=RSyH865qaee3Tmx4 gcSORWCi7vHuaoBoCUuKRSb5r9HXnhYGo6ISTZfhUr9UmmOnYIr0gaK0SCA3R9DY 1oR63YYMeVDHybbgIMg9wSgBAc1FhRxvqc2CsdCVl8Lrhtv6G3/whDtlIzEQpxPw rKblbhhKFw1zjD2hkXLQoLTq36pCvbJ0ojHK1f7P+iadRw99yrVfozu3MPJOiRcj ETMEnY3z1Nz+CvtzOojYOTcEHlZwd1rZRP4fzsIypsRqBuUuiENm85CE/l0zv7PW LQVRcekQXHqHb0rtpOdNSzJK8h7l9hROKAbK6OH74fpotKi2+Q6shrbXIw5eC10C wgz+kQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=93LCChtZfmc3E8sW68Wopzxx2rP36GtjQ9tRb3lUK Vc=; b=OociHtZQJOpaaB/Tw8S2dOIvyEyc2wMnFJSYlR/RMm03tuX/ldIeLUGl7 fDFGk40z7jca9B6rAu62EetFE2XdQ4UbupkJHYif48t7JuXkXnNXKTGVzIHKbCKO lC3oP8jfpEVRi0rOAdqOsXO+og5VJ2cn1+X5MkC7ZR3ZMolRSM9xS+uExmg52V/G 4CNCQDfxv2BBhhLr1Aheisz8Hk5/k+Kmn+KnV+XDqkmD4ca3vyKu8b+R1Aak7jmJ DsPW9GDn4Pr67QFXj+4+mYSBI10JDh7YfKAeXjPeA4t/MZ16qEcebF5e2jk+YmRe vGlaGL0vds4EIDUk2/4TQcp4UUTIA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdegtddgjeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepffdvffejueetleefieeludduuefgteejleevfeekjeefieegheet ffdvkeefgedunecuffhomhgrihhnpeguphgukhdrohhrghenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhn rdhnvght X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 27 Oct 2021 10:31:27 -0400 (EDT) From: Thomas Monjalon To: Aman Kumar , "Ananyev, Konstantin" , "Van Haaren, Harry" Cc: "mattias. ronnblom" , "dev@dpdk.org" , "viacheslavo@nvidia.com" , "Burakov, Anatoly" , "Song, Keesang" , "jerinjacobk@gmail.com" , "Richardson, Bruce" , "honnappa.nagarahalli@arm.com" , Ruifeng Wang , David Christensen , "david.marchand@redhat.com" , "stephen@networkplumber.org" Date: Wed, 27 Oct 2021 16:31:25 +0200 Message-ID: <2811952.0RjXIbInLB@thomas> In-Reply-To: References: <20211026155645.246783-1-aman.kumar@vvdntech.in> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v4 2/2] lib/eal: add temporal store memcpy support for AMD platform 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 Sender: "dev" 27/10/2021 16:10, Van Haaren, Harry: > From: Aman Kumar > On Wed, Oct 27, 2021 at 5:53 PM Ananyev, Konstantin wrote > > > > Hi Mattias, > > > > > > 6) What is the use-case for this? When would a user *want* to use this instead > > > of rte_memcpy()? > > > > If the data being loaded is relevant to datapath/packets, presumably other > > > packets might require the > > > > loaded data, so temporal (normal) loads should be used to cache the source > > > data? > > > > > > > > > I'm not sure if your first question is rhetorical or not, but a memcpy() > > > in a NT variant is certainly useful. One use case for a memcpy() with > > > temporal loads and non-temporal stores is if you need to archive packet > > > payload for (distant, potential) future use, and want to avoid causing > > > unnecessary LLC evictions while doing so. > > > > Yes I agree that there are certainly benefits in using cache-locality hints. > > There is an open question around if the src or dst or both are non-temporal. > > > > In the implementation of this patch, the NT/T type of store is reversed from your use-case: > > 1) Loads are NT (so loaded data is not cached for future packets) > > 2) Stores are T (so copied/dst data is now resident in L1/L2) > > > > In theory there might even be valid uses for this type of memcpy where loaded > > data is not needed again soon and stored data is referenced again soon, > > although I cannot think of any here while typing this mail.. > > > > I think some use-case examples, and clear documentation on when/how to choose > > between rte_memcpy() or any (potential future) rte_memcpy_nt() variants is required > > to progress this patch. > > > > Assuming a strong use-case exists, and it can be clearly indicators to users of DPDK APIs which > > rte_memcpy() to use, we can look at technical details around enabling the implementation. > > > > [Konstantin wrote]: > +1 here. > Function behaviour and restrictions (src parameter needs to be 16/32 B aligned, etc.), > along with expected usage scenarios have to be documented properly. > Again, as Harry pointed out, I don't see any AMD specific instructions in this function, > so presumably such function can go into __AVX2__ code block and no new defines will > be required. > > > [Aman wrote]: > Agreed that APIs are generic but we've kept under an AMD flag for a simple reason that it is NOT tested on any other platform. > A use-case on how to use this was planned earlier for mlx5 pmd but dropped in this version of patch as the data path of mlx5 is going to be refactored soon and may not be useful for future versions of mlx5 (>22.02). > Ref link: https://patchwork.dpdk.org/project/dpdk/patch/20211019104724.19416-2-aman.kumar@vvdntech.in/(we've plan to adapt this into future version) > The patch in the link basically enhances mlx5 mprq implementation for our specific use-case and with 128B packet size, we achieve ~60% better perf. We understand the use of this copy function should be documented which we shall plan along with few other platform specific optimizations in future versions of DPDK. As this does not conflict with other platforms, can we still keep under AMD flag for now as suggested by Thomas? I said I could merge if there is no objection. I've overlooked that it's adding completely new functions in the API. And the comments go in the direction of what I asked in previous version: what is specific to AMD here? Now seeing the valid objections, I agree it should be reworked. We must provide API to applications which is generic, stable and well documented. > [HvH wrote]: > As an open-source community, any contributions should aim to improve the whole. > In the past, numerous improvements have been merged to DPDK that improve performance. > Sometimes these are architecture specific (x86/arm/ppc) sometimes the are ISA specific (SSE, AVX512, NEON). > > I am not familiar with any cases in DPDK, where there is a #ifdef based on a *specific platform*. > A quick "grep" through the "dpdk/lib" directory does not show any place where PMD or generic code > has been explicitly optimized for a *specific platform*. > > Obviously, in cases where ISA either exists or does not exist, yes there is an optimization to enable it. > But this is not exposed as a top-level compile-time option, it uses runtime CPU ISA detection. > > Please take a step back from the code, and look at what this patch asks of DPDK: > "Please accept & maintain these changes upstream, which benefit only platform X, even though these ISA features are also available on other platforms". > > Other patches that enhance performance of DPDK ask this: > "Please accept & maintain these changes upstream, which benefit all platforms which have ISA capability X". > > > === Question "As this does not conflict with other platforms, can we still keep under AMD flag for now"? > I feel the contribution is too specific to a platform. Make it generic by enabling it at an ISA capability level. > > Please yes, contribute to the DPDK community by improving performance of a PMD by enabling/leveraging ISA. > But do so in a way that does not benefit only a specific platform - do so in a way that enhances all of DPDK, as > other patches have done for the DPDK that this patch is built on. > > If you have concerns that the PMD maintainers will not accept the changes due to potential regressions on > other platforms, then discuss those, make a plan on how to performance validate, and work to a solution. > > > === Regarding specifically the request for "can we still keep under AMD flag for now"? > I do not believe we should introduce APIs for specific platforms. DPDK's EAL is an abstraction layer. > The value of EAL is to provide a common abstraction. This platform-specific flag breaks the abstraction, > and results in packaging issues, as well as API/ABI instability based on -Dcpu_instruction_set choice. > So, no, we should not introduce APIs based on any compile-time flag. I agree