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 1rrPFt-000PPi-8G for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Apr 2024 21:31:49 +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 1rrPFr-001wQw-Pm for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Apr 2024 21:31:48 +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 1rrPFr-001wQo-Gz for pgsql-hackers@lists.postgresql.org; Mon, 01 Apr 2024 21:31:48 +0000 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rrPFo-00027l-MA for pgsql-hackers@lists.postgresql.org; Mon, 01 Apr 2024 21:31:46 +0000 Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-430a25ed4e7so30814031cf.0 for ; Mon, 01 Apr 2024 14:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712007104; x=1712611904; 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=edcHDnszDoGBeZk63CmDsFo+cSesH6Y8dPw88l1SjS8=; b=XYFSJ7IKw/XcswnN7jhT8uwuVApwdI4uwSWBfMG4WNWOhmgEVU7rY5LsZPqMo0AjJf pLILoC++EYL9k1ugI5Hab4/IldtD74/ZngZhOPM3kt0FpT/HQb5EV+KdQIpHgci4rTAX xzT/Y+mzVsToNwGOuA+lLPlPFuqh+6KbuziiQSOgecOYkJ7F3r1QCAfMr9VcHBFIred7 8K0tXupsMydXtAMuclcxqNsHpTTpfvlZT8fVaSuESnf3ybCx1PaCVz9vGFRh8jLSUIes 01JUx+dpCQyZHjDX89DjVtaAmEe8xztjjdKuBJ2RVE0jMUECtoIWxL0Jwsl871Tt8Ytz 9kng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712007104; x=1712611904; 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=edcHDnszDoGBeZk63CmDsFo+cSesH6Y8dPw88l1SjS8=; b=Tum9J52yJJaQRfdvaCUGX+POUlKJGYy7RalTU9GSSf5/osd3/qMMdRF6zoj39mb9ru JspG8X7wmccv8+bRYzqTX6lsaARHU0om4Cq38D30iRiD7N5G3xa5gztCJgzvr2pDmLMO qJFWwoTwFgdKJDWq40Bn/z+PZ8vcRvAFFcH56Os/MJTN4WSFyQubcEOJZRxEa+RzCF+f C0czdXsfpG46zMlNqK52Mn6I019NlQmSx+stKky0C23J5EAPLzYzMFnOw4/IAInyovSG D/DSYDl+TrTUiDKmGB0dyhP38IAbjWDPfg60ETzQuWcjs/8spyduEgYR7wmxwaftsheB Q3VQ== X-Forwarded-Encrypted: i=1; AJvYcCVmL3xCTFFC3xzLEeZNOSwmVpjBaRDD2v82x2/jkI7W9hJPJ2ekbmiYy0uA+rb9SLpht1PuIMB54rD8rmAfLaOBWIQaQGFGbNfKcPIC4+MReD8+ X-Gm-Message-State: AOJu0Yz0eXUmcyA676185A6hdTdVNlTL1NNVDfpT5OCrX2sohgVhxUq7 kRvLlQXZERO5T+pgNt8DLpmUQun4ItyRrszzBXpF1y8i/JbqeJyQ X-Google-Smtp-Source: AGHT+IGCSyuOETcrQsB4M3hhpYIqYC5XxUJfnW9MQ5GEi5/K++U+gNEwFqAHgKZcs7hpMbrgr+zhBw== X-Received: by 2002:ac8:5dce:0:b0:432:b76a:aa93 with SMTP id e14-20020ac85dce000000b00432b76aaa93mr11765479qtx.6.1712007103789; Mon, 01 Apr 2024 14:31:43 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id ca9-20020a05622a1f0900b00430eecd29c5sm4912921qtb.63.2024.04.01.14.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 14:31:43 -0700 (PDT) Date: Mon, 1 Apr 2024 16:31:40 -0500 From: Nathan Bossart To: Ants Aasma Cc: Alvaro Herrera , "Amonson, Paul D" , Tom Lane , David Rowley , Andres Freund , "Shankaran, Akash" , Noah Misch , Matthias van de Meent , "pgsql-hackers@lists.postgresql.org" Subject: Re: Popcount optimization using AVX512 Message-ID: <20240401213140.GA2362108@nathanxps13> References: <20240401011708.GA2128739@nathanxps13> <202404011106.y4fci35kzdqt@alvherre.pgsql> <20240401155338.GA2296072@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, Apr 02, 2024 at 12:11:59AM +0300, Ants Aasma wrote: > What about using the masking capabilities of AVX-512 to handle the > tail in the same code path? Masked out portions of a load instruction > will not generate an exception. To allow byte level granularity > masking, -mavx512bw is needed. Based on wikipedia this will only > disable this fast path on Knights Mill (Xeon Phi), in all other cases > VPOPCNTQ implies availability of BW. Sounds promising. IMHO we should really be sure that these kinds of loads won't generate segfaults and the like due to the masked-out portions. I searched around a little bit but haven't found anything that seemed definitive. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com