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 1tiKo2-00EeuF-QF for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 22:02:06 +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 1tiKo0-00FLjK-7h for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 22:02:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tiKnz-00FLj6-Uz for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 22:02:04 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tiKny-000VE3-1w for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 22:02:04 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3d1469adf26so601375ab.0 for ; Wed, 12 Feb 2025 14:02:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739397721; x=1740002521; 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=Jpn+lJbCtcth1AqKp0TAk1oLZs0fx1yu42pUhBFZR+A=; b=EgnTbDRnhwWT9lj/UBSfasaN+IKaSyuIpzU0NA23kuK/cuvlwDuxr7I3YTbIZXPcDV 2t9eNSLfXRPFx5uRtsDR6TZ20xCb7xlwV7lBjz49QMH37C9/MRFM8mv9Ri33lttU3myv ix49H0yBzNMxk2aEbPNIPLZ3ptXRmop/UAIlB6aGc8wFyKVH9wXH14lDA3uoEhg5QXxb KWzNObloTOkZpw/E9t71iHI5fKLiX3zAAa2zMvvTF9Fla6TXFPNxcAJOm9GbWL6WaYyq X8QP7b5IT6OX+ILQCABekcxffG9QvLaweeCutGX3AWpTmkJU4uNhZsry9xD4A5xEREKB fJ4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739397721; x=1740002521; 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=Jpn+lJbCtcth1AqKp0TAk1oLZs0fx1yu42pUhBFZR+A=; b=G4z4eXAZEPG2dSnbI13jGNIlgKBHxHfD1Q6HQpf42iyIH/NYX816Z1eOxxpNfVc+k9 Lfnk7dRj9OiNb20C43OrEMIFjoJTla6W6l5mfO4iHCDEA64dF4niO74IW6Kc+g9Onln2 G1lAYHWWf4SX4vbGOSCTej5BeKoDYyM7Y9h3NhgG06ElesNm5KFpZmz4M/zLtmlqTT5u T1lAiDpINq2iAnws20OuuUmr+nr5k6qmnAPvylyjOikB0U9L0Gt6m8IwVmPHQ2fFdH5+ B8QLzfk7VwWJ1Q4OR2kwUqkpndJX+ruc7yVjfcuWnwkTp0joqRAtD3vqSRUcoPLHXVBz Oc5A== X-Forwarded-Encrypted: i=1; AJvYcCW46srMls7ZU/WKXa6ZdfTGqEiR5ezJMpDeFjneANzd1k6jglrCom4jkp3Do/Gbw8mCN6gNxR1eOzBvQKnx@lists.postgresql.org X-Gm-Message-State: AOJu0Yy/2sXU/OvKdr6jQApql9lO9dt3oj1dkMh3f9rF0AUm9jsUZTIl 6xDG3xYdHT97qbUNfX4BKIs4zAXD2VUmqNoe3Ae21yI48cx4QNN4qJwkoA== X-Gm-Gg: ASbGncu3BG7+K4TJy7NoWDIiIiyiTBjxNcFSeLh4R7RwaD0c/RgX+y7WuIqIofreo/G 9KkRwTy8OWrczw5ktIVxwEn18tTU31d0+Rud59BD9N5flNuB0peKEov6JJHxqxt0qhH32BQ6eKg 3Z+5fA9HmidvH9x4uFPWnekWm3/hzhu3qSZdT3Hn0J7u700WPtRZiAgfvTxa0MoWgg5Ip0r8S4h q0MF2Xim2k33spS4sWM7UFeuxX/MCLSyNeMMmkxBNk/la+1+uRZtP3u3SXgElDlSZKfvtznAxa/ 1iUXQi5xoFvUkp3uEuSnQDwLt2mSzcEFsDTjmkw/Hm3EWstNWfJn/dIfswTyIC4DWyUFrlOCigr ntAvrWg== X-Google-Smtp-Source: AGHT+IFch/QSbDHhY6DtA+UDRO1SpUoour0qDJzD8HjzOuRB60CARt4iHy1i/gIkpDuToLgEAhaV8w== X-Received: by 2002:a05:6e02:1d9b:b0:3d0:258e:484f with SMTP id e9e14a558f8ab-3d18c2daa36mr7746755ab.16.1739397720633; Wed, 12 Feb 2025 14:02:00 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4ed282dd0f7sm2362173.112.2025.02.12.14.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2025 14:02:00 -0800 (PST) Date: Wed, 12 Feb 2025 16:01:58 -0600 From: Nathan Bossart To: "Devulapalli, Raghuveer" Cc: John Naylor , "pgsql-hackers@lists.postgresql.org" , "Shankaran, Akash" Subject: Re: Improve CRC32C performance on SSE4.2 Message-ID: References: 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 Wed, Feb 12, 2025 at 09:48:57PM +0000, Devulapalli, Raghuveer wrote: >> I think the idea behind USE_SSE42_CRC32C is to avoid the function pointer >> overhead if possible. I looked at switching to always using runtime checks for this >> stuff, and we concluded that we'd better not [0]. > > Does that mean we want this feature for the new PCLMUL (and AVX-512) crc32c implementations too? The code for that will look a little ugly, I might need to think about a cleaner way to do this. Well, I suspect the AVX-512 version will pretty much always need the runtime check given that its not available on a lot of newer hardware and requires a bunch of extra runtime checks (see pg_popcount_avx512.c). But it might be worth doing for PCLMUL. Otherwise, I think we'd have to leave out the PCLMUL optimizations if built with -msse4.2 -mpclmul because we don't want to regress existing -msse4.2 users with a runtime check. -- nathan