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 1rmKDR-007FHB-RT for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Mar 2024 21:08:18 +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 1rmKDQ-0062vi-3x for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Mar 2024 21:08:16 +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 1rmKDP-0062va-QK for pgsql-hackers@lists.postgresql.org; Mon, 18 Mar 2024 21:08:16 +0000 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rmKDM-005Cs7-FY for pgsql-hackers@lists.postgresql.org; Mon, 18 Mar 2024 21:08:15 +0000 Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-7c897ac777aso110514739f.2 for ; Mon, 18 Mar 2024 14:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710796092; x=1711400892; darn=lists.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=OrAznmvQ7hyWtRKekkiGkVoETuXclpl3VZMhqyzMwkA=; b=LTefPUX9ZQ8o8aIIHN674apiexEJY4IjDPPRHfP1Tj6AJGwDyH7hsWFABcmN1hnpKy T2CQw6C4oPpltI0RvTDycEeJgBNGNUYEEQyAYf/sXRFh9rvxoTZDJsYnzKcJGxW/Z2mH 7mrJAvLEGkaZp31gUSNBftgaXCUapQY9HkDtou4QYWHZ/7qj2n5+lWph5jM+Ql0ZneEm Li0u21sC2ZJGSqG/QKTcCCSOvkgUTXPrAeeBSwuIy+Wh6OZX7tbZiB+n+fm5+4FoqjZc Ynf3jx5nbQXkJ+vmHsYBCHn/fE3v7E3tHgkk0TAfp5BYjDgKFMjcRn4vY88Ol5pW8euE yRZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710796092; x=1711400892; 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=OrAznmvQ7hyWtRKekkiGkVoETuXclpl3VZMhqyzMwkA=; b=xN3HIt/Aa0peEDSDjXA58ZSJWz6I1ga2U41caZ+8e3pKqay4b6dc2AZKBQAgzFUGNv dd7EsCKwhqyTpBV0Ob+/7mz+f2k74WKqj0Ykn16RQgHkHD9lFyPpZsEy95jeCl88SQLf BoDSToVzXvfYW23vsPSOfVGiyObCRvB2dcMPqGgcr+lqC19HnxtKscbMWSSz25V9nP2z 6fsWBrdRgttq26MKjH+yKAiYO9nKqrfVk5TePzoOnC9PAzmdWJ3CSL0Ec8l/Vbi/IJCr 2DeSp2kzuAMoPgmOBOvXgQPdixCkMYtyHBKC18OsiTzHbRLmDvhfmqmG7GXWJfH4EFEe xZNQ== X-Forwarded-Encrypted: i=1; AJvYcCXKsa13tmcE9VAOeoNbTMV3TiRflUfwinqfeir6b5MPRO3S3J82i1n41V5f3DXAWWOUaFJb/SbR/Z+6RmMApf7sKINuNJdh2GQ1R/Pr4n69pCDJ X-Gm-Message-State: AOJu0YzgIDk/QyoylzZ/Cko2hIUe6dFbe2s10DaYv0AQaHdu/TxdZJNb fGDEnFcjmb2pIlosQhjAfizRLJu//CpIHTSfcWFy7SqR4UC/5gOK X-Google-Smtp-Source: AGHT+IEqoGBmf7xBq757fb23kZuZiojFBHbhkjoMzP7zxpMGYIM+JotXu92r8xwXqLWi7/sDA+Z/Rg== X-Received: by 2002:a5e:df0a:0:b0:7ce:f419:cdec with SMTP id f10-20020a5edf0a000000b007cef419cdecmr29115ioq.9.1710796092017; Mon, 18 Mar 2024 14:08:12 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id j4-20020a05663822c400b00474f8940230sm2506213jat.11.2024.03.18.14.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 14:08:11 -0700 (PDT) Date: Mon, 18 Mar 2024 16:08:10 -0500 From: Nathan Bossart To: David Rowley Cc: "Amonson, Paul D" , Andres Freund , Alvaro Herrera , "Shankaran, Akash" , Noah Misch , Tom Lane , Matthias van de Meent , "pgsql-hackers@lists.postgresql.org" Subject: Re: Popcount optimization using AVX512 Message-ID: <20240318210810.GA582529@nathanxps13> References: <20240312013436.GA1787866@nathanxps13> <20240315150611.GA3495582@nathanxps13> <20240318152902.GA2850@nathanxps13> <20240318162018.GA204772@nathanxps13> <20240318173004.GA361138@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Mar 19, 2024 at 10:02:18AM +1300, David Rowley wrote: > I looked at your latest patch and tried out the performance on a Zen4 > running windows and a Zen2 running on Linux. As follows: Thanks for taking a look. > The only thing I'd question in the patch is in pg_popcount_fast(). It > looks like you've opted to not do the 32-bit processing on 32-bit > machines. I think that's likely still worth coding in a similar way to > how pg_popcount_slow() works. i.e. use "#if SIZEOF_VOID_P >= 8". > Probably one day we'll remove that code, but it seems strange to have > pg_popcount_slow() do it and not pg_popcount_fast(). The only reason I left it out was because I couldn't convince myself that it wasn't dead code, given we assume that popcntq is available in pg_popcount64_fast() today. But I don't see any harm in adding that just in case. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com