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 1t9ABL-0088jt-Gv for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Nov 2024 21:36:46 +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 1t9ABI-002pfV-VO for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Nov 2024 21:36:45 +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 1t9ABI-002pfN-LQ for pgsql-hackers@lists.postgresql.org; Thu, 07 Nov 2024 21:36:45 +0000 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t9ABG-000hGt-B5 for pgsql-hackers@lists.postgresql.org; Thu, 07 Nov 2024 21:36:44 +0000 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-3a6bfc1dc8eso5826395ab.1 for ; Thu, 07 Nov 2024 13:36:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731015401; x=1731620201; 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=+WM6up0KRd2yW22isl8iRnd7Plo0l081KeMGKnJ6bYg=; b=la7nkmgOQWVjHiHUpnDlGgs9eKYBwWhSngMN4HZXHMF9zdUjfBqFSR0WenwY2pYBng vEXl28WL6MFaZqjURkO3h9mOGiSOH3jC8mqwqRMky6bJ5NmicXGyaHD7mVeWfM6mD0Ym 4UwQ9e3lfzL3v11et71rspk/D4lLt9XR3h9Ki9yf48m4VqgTEewnbMP7UQCQFTDEweTR 0z8dz/TOzDEyyFIfSN7RggfEJNFyWdyJ6CaXRqgrd96R3oqhBl2YsJvnmxyu7QquaknZ lQ4usICYyU//z0fQknA7afj3sgH0YUk1LZL+7zfe8GLKEwKWbWpIVc0lKzKowuDEix79 swtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015401; x=1731620201; 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=+WM6up0KRd2yW22isl8iRnd7Plo0l081KeMGKnJ6bYg=; b=VYyl79x6d+hvHsuYiNgaZcyO9qWu5oqefXNFQM3m1/aRfywHo5i2JpA4LwwQc4X5tT NPg2mc2SPJzf0c4pGBczC2/lBLd7rJlUG+CO5V9cbzAuRmhqiQfI98EXq6v6q6ylCWVu OERfOT8nrl+fjPlDJ2okRG+AOeuUbKYvSBmStKytyI/1BRBl3YTgONqSaCi9d9jhehXm ECszkydYVFOOCXkWmdj+pNA3oJKYoeNXLY0JTEZKXgAqhjSrNsMheBX5Xjk4m7ItslQo q/Ea8kriBWk3cRtn6S45PIT4ylSIGw+gOU+Q4y7Ocn8fkzoZvx6qtLlvV3Tt3p9vQc6D oJQA== X-Gm-Message-State: AOJu0YyGJmhh8prFPHgvVWz/SfstPNBDBkB/flgUk2ojXKpcA/mDZGwE p2eCZDAFxYx7DTytBUCrCYrAb0jyClC2P0wJtZK7rEJ1fSmmr7mJ X-Google-Smtp-Source: AGHT+IGsQ5SBAg2VMo8V39CdYOKmgXCd2j4/R9JegQgJCMpP8bdkOxT7E/yG6ATKLn9BUDYSIyIYOQ== X-Received: by 2002:a05:6e02:1aab:b0:3a5:d2a:10e0 with SMTP id e9e14a558f8ab-3a6f1994842mr10650295ab.5.1731015401291; Thu, 07 Nov 2024 13:36:41 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead1b734sm4794765ab.59.2024.11.07.13.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:36:40 -0800 (PST) Date: Thu, 7 Nov 2024 15:36:38 -0600 From: Nathan Bossart To: "Devulapalli, Raghuveer" Cc: "pgsql-hackers@lists.postgresql.org" Subject: Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C 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 Thu, Nov 07, 2024 at 09:30:32PM +0000, Devulapalli, Raghuveer wrote: >> # Check for Intel SSE 4.2 intrinsics to do CRC calculations. >> # >> -# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used -# >> with the default compiler flags. If not, check if adding the -msse4.2 -# flag helps. >> CFLAGS_CRC is set to -msse4.2 if that's required. >> +# Check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used # >> +with the __attribute__((target("sse4.2"))). >> PGAC_SSE42_CRC32_INTRINSICS([]) >> -if test x"$pgac_sse42_crc32_intrinsics" != x"yes"; then >> - PGAC_SSE42_CRC32_INTRINSICS([-msse4.2]) >> -fi >> >> IIUC this means we will never set USE_SSE42_CRC32C_WITH_RUNTIME_CHECK. > > I don't think so. USE_SSE42_CRC32C additionally requires SSE4_2_TARGETED > to be true which will only happen when explicitly built with -msse4.2. > When this explicit compiler flag is missing, we set > USE_SSE42_CRC32C_WITH_RUNTIME_CHECK to true. This logic is further down > in the configure.ac file: > > if test x"$pgac_sse42_crc32_intrinsics" = x"yes" && test x"$SSE4_2_TARGETED" = x"1" ; then > USE_SSE42_CRC32C=1 > else Oh, you are right, sorry. >> + 'pg_crc32c_sse42_choose.c', >> + 'pg_crc32c_sse42.c', >> >> Can we combine these? > > Knowing the AVX-512 will come next, I think it makes sense to keep the > runtime choose function separate. Otherwise this gets polluted with > runtime choose function, sse42 algorithm and the avx512 algorithm in the > next patch. Does that make sense?? Is the idea that we will put both "choose" functions in one file and the actual CRC-32C code in another? I'm okay with that. -- nathan