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 D1903426D0; Fri, 6 Oct 2023 14:29:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5161F402A8; Fri, 6 Oct 2023 14:29:59 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 491FF4014F for ; Fri, 6 Oct 2023 14:29:58 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id D9403207F1 for ; Fri, 6 Oct 2023 14:29:57 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id CD58220867; Fri, 6 Oct 2023 14:29:57 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=ALL_TRUSTED,AWL autolearn=disabled version=3.4.6 X-Spam-Score: -1.5 Received: from [192.168.1.59] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 6AF51208DD; Fri, 6 Oct 2023 14:29:57 +0200 (CEST) Message-ID: <188898b5-3182-4b0e-a294-e79873a65633@lysator.liu.se> Date: Fri, 6 Oct 2023 14:29:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH] eventdev: ensure 16-byte alignment for events Content-Language: en-US To: Bruce Richardson Cc: dev@dpdk.org, Jerin Jacob References: <20231005115101.12276-1-bruce.richardson@intel.com> From: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP 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 On 2023-10-06 14:19, Bruce Richardson wrote: > On Fri, Oct 06, 2023 at 02:15:00PM +0200, Mattias Rönnblom wrote: >> On 2023-10-05 13:51, Bruce Richardson wrote: >>> The event structure in DPDK is 16-bytes in size, and events are >>> regularly passed as parameters directly rather than being passed as >>> pointers. >> >> When are events passed by-value, rather than by-reference? There are no such >> examples in the public eventdev API. >> >> To help compiler optimize correctly, we can explicitly request >>> 16-byte alignment for events, which means that we should be able >>> to do aligned vector loads/stores (e.g. with SSE or Neon) when working >>> with those events. >>> >> >> That change is both helping and sabotaging the optimizer's work. Now every >> stack allocation needs to be 2-byte aligned - in DPDK code, and in the >> application. >> >> The effect this change has on an eventdev app using DSW is a ~3 cycle/event >> performance degradation on an AMD Zen 3 system, and a ~4 cycle/event >> performance degradation on a Skylake-generation Intel CPU. >> > > Thanks for checking - this is the sort of feedback needed alright. In SW > eventdev we copy events around alot without using pointers, so I felt that > alignment would be helpful to avoid issues with events spanning cachelines. > > However, since it has negative impacts, I'm quite happy to drop the idea, > and keep things as they are. I'll mark the change as rejected in patchwork. > I think this was an excellent idea, it just didn't happen to have the desired effect. At least not in the particular cases where I evaluated it. Given the complexity of compilers and CPUs, it's almost impossible to predict the outcome, performance-wise, of a particular change.