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 1tiK7b-00EV5x-BH for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 21:18:15 +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 1tiK7Z-00EiDH-8m for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Feb 2025 21:18:13 +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 1tiK7Y-00EiD4-Vg for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 21:18:13 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tiK7W-000Utc-1Q for pgsql-hackers@lists.postgresql.org; Wed, 12 Feb 2025 21:18:13 +0000 Received: by mail-io1-xd34.google.com with SMTP id ca18e2360f4ac-851c4f1fb18so4804839f.2 for ; Wed, 12 Feb 2025 13:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739395089; x=1739999889; 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=l6jYU9+M5dOjlngbTRkZ73S/xECLKKCS6BZLuuEOlXA=; b=et/Ry+V2WUF/NM/53dHHqwS59t/JTSrqkXSljdfY2y4UewIwWWefP09YPsDoWCJ6D6 1XD0Ku5x6qYkY+rMNwFI4IvTsLcJkLEv11ExKXr7oB/FQ/6ybIYRnaDanZKvEBW/fh2J oyphF0LAaEK4h4jV09eEV0Pw3zIUYA5cwIaVKjyhQtAOxMJlYVGR4sh1ncZ2bXs/k+Ie pwB9NbSrE+OgP5173u01LHMzymH4o1EKzOwFDgeChadre2VdEv0uZW4VHtXFmDTX6x1s xGVAzjlRgKcSAVQSwIacMobDut+40KU7zGyhsmLmMGB7wVzG/mJLZ/zvSNtivnUDZFUh OsVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739395089; x=1739999889; 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=l6jYU9+M5dOjlngbTRkZ73S/xECLKKCS6BZLuuEOlXA=; b=vdguQHubQzXGZbgN3cbtYZIZvQl+lDSmghGKFSLeniODff54omUWat10Gy1pv2zhVT WHH/Sgqn89DlxHf1TPo6Gp9uJQobz0A/Lz3pUM8n29WSKOmwezZTP7xnJBaLGqPy8QE2 7q2Im29lMIQoC/VSOSQfeY5SJ9vsRWFw5WN+SDZ3qYh367ChgoLDY4PBLF61pS59N8tf E8s+MVNqX4TmhL46UmQ2h7wy99ePBpeU47To5UbPV+UQ/VEKS4LqmM0XYLX8p+SlyynE +uytLRBEvw1EgYR7pA9Wrh4udsg/U8MRh3Hgsb/eCqNPt7pqSPxQ5xRZhOmSjkUcH2gB nqGA== X-Forwarded-Encrypted: i=1; AJvYcCW8EzfVczWqLEs3n2u4UZrLDd3Gkr3Yeiqx+xNhSJZCvaWUVpVr9X1UkIl/+/69tE7VIGE4KcmIoiNiokEs@lists.postgresql.org X-Gm-Message-State: AOJu0Yzc+meqfPvNePKMTHG2YMXXmYMMn/pBag/Wg2qCld39/2PVREGe Te31NcYnm+5sMkq5WgY6u/65GgLf/6Ul8Dh0q7pqI03MaMEpBTuw X-Gm-Gg: ASbGncttz+9RPEm4vghiSyur0HVEqGtJufXPMCqgoQt2rwBwRe7m4EvnpDqw+rzsEuo aacRylDAxxuzP7fCPp/jhokXl5tEheU3NRAQA1BTUxH7yanmlXCuy8CKKs2vqil5olzAuPiRJ/K 1H8dmItQ2tVOr9b02YXmMz3wtoriQcGS9MZjo1WUrGhDl2e/E46/xEOOdFLYkQA5kNE+uYnImXf i90oQX1deX7gvgYenyQanVnxzwqSe+cesLMDyRSvhoQqtLhDXpliixE/a6EEccs2+ZX9jNoFI5i N+xNYD8KVhU4rjwXFzaqNcd0czj5vA1GHRv/3bzoZ7pb9i5a2bucpOI8C9i2mW4JkVloreoui3J IwetEKA== X-Google-Smtp-Source: AGHT+IHnmPpzZjfKqe7Xd+pgRGXd0Q4IvWQNa8BUsn6xjbTDsCHcoznlFn/gA7af51qIsv6ChGQRLQ== X-Received: by 2002:a05:6602:6c05:b0:83a:b43b:da89 with SMTP id ca18e2360f4ac-85555daf6ebmr418545439f.10.1739395088735; Wed, 12 Feb 2025 13:18:08 -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-4ed216bf57esm265678173.12.2025.02.12.13.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2025 13:18:08 -0800 (PST) Date: Wed, 12 Feb 2025 15:18:06 -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:02:27PM +0000, Devulapalli, Raghuveer wrote: > Also, do we really need to have both USE_SSE42_CRC32C and USE_SSE42_CRC32C_WITH_RUNTIME_CHECK > features support? The former macro is used to enable running the SSE42 version without a runtime check > when someone builds with -msse4.2. The code looks fine now, but the runtime dispatch rules get complicated > as we add the PCLMUL and AVX512 dispatch in the future. IMO, this additional complexity is not worth it. > The cpuid runtime dispatch runs just once when postgres server is first setup and would hardly affect performance. > Let me know what you think. 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]. [0] https://postgr.es/m/flat/20231030161706.GA3011%40nathanxps13 -- nathan