Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uwXk4-0047I4-D3 for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Sep 2025 03:13:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uwXk2-004oZo-JT for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Sep 2025 03:12:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uwXk2-004oZg-5w for pgsql-hackers@lists.postgresql.org; Thu, 11 Sep 2025 03:12:58 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uwXk0-001lrk-16 for pgsql-hackers@postgresql.org; Thu, 11 Sep 2025 03:12:57 +0000 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-40b035b23c6so1463785ab.2 for ; Wed, 10 Sep 2025 20:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757560375; x=1758165175; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ibDlWydEUvzBW7TOIfEB9MevF+RknsSTPKWLg1SYas8=; b=OvSfBKR5MDzSmlAbvj17W8AqfW6Nky3pVMI7RzcCTRPs6Ih3RCTe15c6wFUvo1fWS4 vjKk5Z6cvneEHjC2/hl+8iQx90p8f5wiOR3zfeDI11jzPkKk8bPjbgvod6odKwQnjmUl /boEcYQVspTBtzVnSHmMjzyM/YfjgysqUJXKD9hLWpoS9uIQo65zAxHEmqTFmzWcNmKw olVBEEzEXXzMKB94IPwtFH+nCz9bA5bO+4vjFIHvdDUKgeMOZQj+9GDd7VHPCADtvFbe wYa2F/R5/iLpWSJ6TByRyfAviBdenxP8BZT+JQ/xa9PK8D2pbwTA0lwkj+SX2MeskB/8 zR7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757560375; x=1758165175; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ibDlWydEUvzBW7TOIfEB9MevF+RknsSTPKWLg1SYas8=; b=pBNGdLSb4qx90rukhQmCZ/XWHaAzYNTiiqzGYx/UBZlEHXl9A2ZLalkdcDIZRvOYF9 DooSvWpwrvjaNm1VzwoLJBKpStpVa7TiUpcGcerRaCPLMZPxDx6L2aR9e8I87zczhJbb wXtRWnc+9d2eR0nQgtZT011Zn1TFDzygm/llOz+KCqNdRtJP8GNKyObcRbxtcFLXVlBe jBGWNITIe4LXif7N891FRupTnFpZ4pPeav6nKBnBv9dmKbZP9H4T5QTsz//dCrZJ2Beo /LEXSYnx25Lqh8koutWPKFnLdXiiH1By9LbZEnaON2CkLPK2oNtAUFFNz3Vietgy/voT ALrg== X-Forwarded-Encrypted: i=1; AJvYcCWSAhTO1wGOVyYVmxQKzhdu4QXsUZfGf/G03pUULUsTJRq4BMP/uWSVQK1CEcYUycvQ0ZsnIqr0InngQBlH@postgresql.org X-Gm-Message-State: AOJu0YzUditnZmPUu84V1ManjmkW4wfoPKv5ZxA9urR8GSUifXhdi5Uw xjIy8COEycOADpRoL9E8S5wxHLx2a2fnqCEuO/uDy5tywV4GMGAJU5JvavzHcA== X-Gm-Gg: ASbGncv3WeLiaoG+C3fAPqpgu3YFK5OBAIKcUagTin8U1VnedJRyykILHp4S6vB/CaQ ikXCH9CKUSdLHVHFGbeh7mTDPmPDq+XqQHQC3D3s8v53dwMWRJ5D+Vn6wp1n/ELKFzwYmYwd++a NksuT0NP1LedAKOt7GW+MUviNgsT+yNhQR7HojS3wNMqVl1V2wmy+ZkLW8ngfIinZ5Iucr23Wgh IJUiS0Wa7W8luJ/lZF8BN8pltYbghAt3n7rVJnyq7jFkSfXbXHjnB30eLRZX1CUJ/GFi6gz5RbP EKLYLXV6VSjADWj8OM7H9F4N8nqxKJuP5daxmfUI0Av3jwIL/MU7hba+64KBKV8BNhrdaAxDsid wEMh81CHjgXeteOz3pHDwokmALydXOc0fW8gW3YEHX+tQElDeVmged4UXfAmtTOl17kGotaDiau Cr6Qrs/bHAmjnvi8vpb9h3kf9XmmxP3HqwlA== X-Google-Smtp-Source: AGHT+IG9pX/6HhU0Di4udpLhKtbpNuavMAHTZaiO67rj0eYI5VxU+Fv74ok8tj9hhkKy0xaTQdPtaA== X-Received: by 2002:a05:6e02:450a:10b0:3fd:b143:a031 with SMTP id e9e14a558f8ab-3fdb143a1b1mr225398665ab.31.1757560375437; Wed, 10 Sep 2025 20:12:55 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-41df02f4bacsm1322465ab.14.2025.09.10.20.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Sep 2025 20:12:54 -0700 (PDT) Date: Wed, 10 Sep 2025 22:12:52 -0500 From: Nathan Bossart To: "Chiranmoy.Bhattacharya@fujitsu.com" Cc: John Naylor , Tom Lane , David Rowley , "pgsql-hackers@postgresql.org" , "Devanga.Susmitha@fujitsu.com" , "Ragesh.Hajela@fujitsu.com" Subject: Re: [PATCH] Hex-coding optimizations using SVE on ARM. Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="PU9I/YwJRFyE6b6b" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --PU9I/YwJRFyE6b6b Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Sep 04, 2025 at 02:55:50PM +0000, Chiranmoy.Bhattacharya@fujitsu.com wrote: >> I see that there was some discussion about a Neon implementation upthread, >> but I'm not sure we concluded anything. For popcount, we first added a >> Neon version before adding the SVE version, which required more complicated >> configure/runtime checks. Presumably Neon is available on more hardware >> than SVE, so that could be a good place to start here, too. > > We have added the Neon versions of hex encode/decode. Thanks. I noticed that this stuff is simple enough that we can use port/simd.h (with a few added functions). This is especially nice because it takes care of x86, too. The performance gains look similar to what you reported for v6: arm buf | HEAD | patch | % diff -------+-------+-------+-------- 16 | 13 | 6 | 54 64 | 34 | 9 | 74 256 | 93 | 25 | 73 1024 | 281 | 78 | 72 4096 | 1086 | 227 | 79 16384 | 4382 | 927 | 79 65536 | 17455 | 3608 | 79 x86 buf | HEAD | patch | % diff -------+-------+-------+-------- 16 | 10 | 7 | 30 64 | 29 | 9 | 69 256 | 81 | 21 | 74 1024 | 286 | 66 | 77 4096 | 1106 | 253 | 77 16384 | 4383 | 980 | 78 65536 | 17491 | 3886 | 78 I've only modified hex_encode() for now, but I'm optimistic that we can do something similar for hex_decode(). -- nathan --PU9I/YwJRFyE6b6b Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v7-0001-Optimize-hex_encode-using-SIMD.patch