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 1rjr2S-008LjU-Hs for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Mar 2024 01:34:44 +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 1rjr2Q-003ss6-Vl for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Mar 2024 01:34:43 +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 1rjr2Q-003sp0-M4 for pgsql-hackers@lists.postgresql.org; Tue, 12 Mar 2024 01:34:43 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rjr2M-0042ah-VA for pgsql-hackers@lists.postgresql.org; Tue, 12 Mar 2024 01:34:41 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3665a067d5eso6991425ab.1 for ; Mon, 11 Mar 2024 18:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710207279; x=1710812079; 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=+TVxpcP1qh6hSPd8SI+GOBYpr3gk6tZ6lD3KccZ1b50=; b=ByrpG6clZ//t0BTIVGWZC4+hAgkM0nN1kyrkKLH80hdM8yeQpUSsTrzCyrZzVUUrpe 39/n2Bkrj9aW3H/RE/xeMpMaZji2uRkaX8D0wiPT5i6t8ONXLKZ66gpbhLkW1aIkUEwT /cd4g1U8DYAXB0Ka4HrC8H3UqMHa4jyGg5SeHqFSHD7Dj4xoQvRKlvtYyVYZN717a9jl hxiWOaerGfOmxTLpHJBUdhkRqtOv6ANhaqdAYjMbUdo1KwQUENOnJoZcLGgyqaRJfhyi m86ze6DBe+kEwZ28ply+xlwyjpWN7BCTUb7gH8ifJ70FUM+BXUzRJ8E0n+G84fSIYtCe mF2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710207279; x=1710812079; 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=+TVxpcP1qh6hSPd8SI+GOBYpr3gk6tZ6lD3KccZ1b50=; b=gJXZWx2dHRbK/DyOn0Kzkg/0qgMrxRsCI6ODq0gtUM6nYMEe0Z0jlFZzlYm3QqArrn wYXqgJwts0Vn5S8ECIkqbfNP+3t8De3l9TYzIkdWqTqKRjXE/rNwVJ0sfkdsXE2J0aa5 m6gr02/Gn0uKyhc6O8RuaF40MGLMOWye1gAdw7W3H4qJSwzWnMVMG9SELewUuUgjV0NP j623KKBQlj352teb2pRZWHAcqrjSl6CCPvdi+7i5gwhM+uoq1MdfvB9ZGlxxR19B7BFh ZefnAmF5XlCed3c6CT/hpob0fF6Ku5Apide6JehqeeNLtIGvjYTkI5Xjlz95hMrPWSUA OOgw== X-Forwarded-Encrypted: i=1; AJvYcCUlgLlAnhftvl8fHlTSDknfGTFnQriMLvGj05eJGik99sYIVzVACwiYE65tThBTcwaM+B12oWKj6kjsGqyAw4ta27qcIgwgx2KyBp9z86ZQdgUB X-Gm-Message-State: AOJu0Ywn8TnMtMqAFP1ggxHfTEoJrVKtqv43RyItliNFQHrsKpuBoZut lkQ/tukh1h6zhfrYKE/UBD6LJtTTacCkIbqplQgd8Al+Xs4P5aOg X-Google-Smtp-Source: AGHT+IHtjnuYMJxFQYZ+3zMrdeyZeRVfgFPdZfkQiXZrdyKz/pNYMbbJYhAMdFNF9Ynt5ekGFxVeVg== X-Received: by 2002:a05:6e02:1889:b0:366:4b49:d412 with SMTP id o9-20020a056e02188900b003664b49d412mr6872215ilu.29.1710207279314; Mon, 11 Mar 2024 18:34:39 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id a2-20020a92d342000000b00363c2f47929sm2004285ilh.66.2024.03.11.18.34.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 18:34:39 -0700 (PDT) Date: Mon, 11 Mar 2024 20:34:36 -0500 From: Nathan Bossart To: "Amonson, Paul D" Cc: 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: <20240312013436.GA1787866@nathanxps13> References: <20240301214457.GA3024365@nathanxps13> <20240304222118.GB3367383@nathanxps13> <20240305163730.GA3479896@nathanxps13> <20240307173318.GA455851@nathanxps13> <20240307213600.GA563369@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 11, 2024 at 09:59:53PM +0000, Amonson, Paul D wrote: > I will be splitting the request into 2 patches. I am attaching the first > patch (refactoring only) and I updated the commitfest entry to match this > patch. I have a question however: > Do I need to wait for the refactor patch to be merged before I post the > AVX portion of this feature in this thread? Thanks. There's no need to wait to post the AVX portion. I recommend using "git format-patch" to construct the patch set for the lists. >> Apologies for harping on this, but I'm still not seeing the need for these >> SIZEOF_VOID_P changes. While it's unlikely that this makes any practical >> difference, I see no reason to more strictly check SIZEOF_VOID_P here. > > I got rid of the second occurrence as I agree it is not needed but unless > you see something I don't how to know which function to call between a > 32-bit and 64-bit architecture? Maybe I am missing something obvious? > What exactly do you suggest here? I am happy to always call either > pg_popcount32() or pg_popcount64() with the understanding that it may not > be optimal, but I do need to know which to use. I'm recommending that we don't change any of the code in the pg_popcount() function (which is renamed to pg_popcount_slow() in your v6 patch). If pointers are 8 or more bytes, we'll try to process the buffer in 64-bit chunks. Else, we'll try to process it in 32-bit chunks. Any remaining bytes will be processed one-by-one. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com