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 1rmFjp-006shP-Db for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Mar 2024 16:21:25 +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 1rmFip-003n3g-Os for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Mar 2024 16:20:24 +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 1rmFip-003n3Y-Fp for pgsql-hackers@lists.postgresql.org; Mon, 18 Mar 2024 16:20:23 +0000 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rmFim-005AfQ-Ac for pgsql-hackers@lists.postgresql.org; Mon, 18 Mar 2024 16:20:22 +0000 Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-7c8ccffacbcso66177139f.2 for ; Mon, 18 Mar 2024 09:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710778821; x=1711383621; 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=E8rMr7KDCctJV87ljZeZlMauh6pFrdqlgq9123P3qbU=; b=Rvh31IqE2Oidnmg0PcDEUNbmjYIk3/w99pwuJ+SNevfCJNyoc6xWm0th53Zw84ouGZ ZbJoP0Q2EVPUhtjhVYhTWBtbIAe8jMzkXv015rINivW44i+gwzEKIKiSxvYkr8HKCfRq w1axo7xNsesffxTBZklcyjhxEIYOI+1sTxKa1aYTZpijtFWAMYn3S65SFU/R/+aVbSx2 +VWwdrnE5SUbDvRrZRuNl4s3RTSXVcdgXHQn9HtqWCeGIFKYma+3UsxsQN4/S/SJnqk3 +FgTuiY3SKoVvSookV45JPxmHbBzUc7Pzc6gMCZ4PQJhmcb2nmSNQ+95DEhGgDyOtSGm klgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778821; x=1711383621; 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=E8rMr7KDCctJV87ljZeZlMauh6pFrdqlgq9123P3qbU=; b=r3+rW1S7kOecZL4/xDCgg1499BTJXwTSMPcE1gTGNLtQ8aaAasBUUqwucuu5Q302z5 59yRxn9lmg2/ZNG+ncFanjncYnPH7rj8GpQ4osI6aP8kqxG0llmd/8jwsYC+Hi04bJ/Y X4iBJIZfj8uVBB5270OetxVJBjriu7dmvDJsSRiH2jyAbp/PUVqnr8U9T3cRnQ8FZEbg ET2v6jHzfTzHYA8Ds8W+p49GBCl74uCsHCfS07GhqtTDMaOucG5EicU698o3maC37kz+ pkhCVARpr+t9Q9Xny7J6NkRNmHYC3w2W87JIfmptP095u/7lNvAnWKDT0ZjejsHrduwR 5DRg== X-Forwarded-Encrypted: i=1; AJvYcCVlhJNi19H4/x+56ZUolvas5WvSR2OLPVqJKbUmRQ9BGGlUpD4+pJRhDCYx+fisQkprRyIz7ZfMG6692D0dWwwIHzUq4lpGdbqqGg54ejtkNJBE X-Gm-Message-State: AOJu0YwSfKJbTeQ27YAkYgsi2pANxWVuZY4OB+i4QDqwBFNlbYJDdfaZ qprDOHQu6SUyKv9ErLxS0IN6c3ngWdqISn4kFRE4SBWA9+VtxW1D X-Google-Smtp-Source: AGHT+IF1qtHC5CPkDUpBay5y6ynVRvBa5dmRIt8o3vvbbiKsQIlGTdrC7kcYmEZmktqaThNgx1KMxQ== X-Received: by 2002:a5d:9253:0:b0:7c8:e931:b2b5 with SMTP id e19-20020a5d9253000000b007c8e931b2b5mr13550095iol.16.1710778820777; Mon, 18 Mar 2024 09:20:20 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id u17-20020a02aa91000000b004771c912fbbsm2426869jai.4.2024.03.18.09.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:20:20 -0700 (PDT) Date: Mon, 18 Mar 2024 11:20:18 -0500 From: Nathan Bossart To: "Amonson, Paul D" Cc: David Rowley , 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: <20240318162018.GA204772@nathanxps13> References: <20240307173318.GA455851@nathanxps13> <20240307213600.GA563369@nathanxps13> <20240312013436.GA1787866@nathanxps13> <20240315150611.GA3495582@nathanxps13> <20240318152902.GA2850@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 Mon, Mar 18, 2024 at 04:07:40PM +0000, Amonson, Paul D wrote: > Won't I still need the runtime checks? If I compile with a compiler > supporting the HW "feature" but run on HW without that feature, I will > want to avoid faults due to illegal operations. Won't that also affect > performance? I don't think David was suggesting that we need to remove the runtime checks for AVX512. IIUC he was pointing out that most of the performance gain is from removing the function call overhead, which your v8-0002 patch already does for the proposed AVX512 code. We can apply a similar optimization for systems without AVX512 by inlining the code for pg_popcount64() and pg_popcount32(). -- Nathan Bossart Amazon Web Services: https://aws.amazon.com