public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: John Naylor <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: pgsql: Inline CRC computation for small fixed-length input on x86
Date: Mon, 31 Mar 2025 08:12:55 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CANWCAZZSxs3a1YRKehkgk2OHKbrVn+xZ+AWW8Co2R_f70NqqmA@mail.gmail.com>
References: <[email protected]>
	<CANWCAZYRbrAyUG29SyVZdamEaSfX0FG=TuyhMaGyqJhpdTN=vg@mail.gmail.com>
	<CANWCAZbA+sDBdSQFcyp_-1T-r5HKFMbLhjM0uwZWZNZ+T9R85A@mail.gmail.com>
	<CANWCAZZSxs3a1YRKehkgk2OHKbrVn+xZ+AWW8Co2R_f70NqqmA@mail.gmail.com>

John Naylor <[email protected]> writes:
> The two problem systems are CentOS stream 9 (apparently using LTO),
> and Rocky Linux 9 (still awaiting details). Both of these are supposed
> to be like RHEL 9.

I have reproduced it on a genuine-Red-Hat RHEL 9 x86_64 machine,
but only when compiling with --with-llvm, and the error goes away
if I select CC=clang.  Furthermore, configure reports

checking which CRC-32C implementation to use... SSE 4.2

with CC=gcc but it says

checking which CRC-32C implementation to use... SSE 4.2 with runtime check

with CC=clang.  Furthermore, the failure doesn't occur when gcc
compiles a file, but it does occur when clang compiles the same
file to produce a .bc file:

[transam]$ make twophase.o
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -I../../../../src/include   -D_GNU_SOURCE   -c -o twophase.o twophase.c
[transam]$ make twophase.bc
/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -Wno-format-truncation -O2  -I../../../../src/include   -D_GNU_SOURCE  -flto=thin -emit-llvm -c -o twophase.bc twophase.c
In file included from twophase.c:79:
In file included from ../../../../src/include/access/commit_ts.h:16:
In file included from ../../../../src/include/replication/origin.h:15:
In file included from ../../../../src/include/access/xlogreader.h:41:
In file included from ../../../../src/include/access/xlogrecord.h:16:
../../../../src/include/port/pg_crc32c.h:70:10: error: always_inline function '_mm_crc32_u64' requires target feature 'crc32', but would be inlined into function 'pg_comp_crc32c_dispatch' that is compiled without support for 'crc32'
   70 |                         crc = _mm_crc32_u64(crc, *(const uint64 *) p);
      |                               ^
../../../../src/include/port/pg_crc32c.h:73:10: error: always_inline function '_mm_crc32_u32' requires target feature 'crc32', but would be inlined into function 'pg_comp_crc32c_dispatch' that is compiled without support for 'crc32'
   73 |                         crc = _mm_crc32_u32(crc, *(const uint32 *) p);
      |                               ^
../../../../src/include/port/pg_crc32c.h:75:10: error: always_inline function '_mm_crc32_u8' requires target feature 'crc32', but would be inlined into function 'pg_comp_crc32c_dispatch' that is compiled without support for 'crc32'
   75 |                         crc = _mm_crc32_u8(crc, *p++);
      |                               ^
3 errors generated.
make: *** [../../../../src/Makefile.global:1097: twophase.bc] Error 1

What I conclude is that Red Hat hot-wired gcc to assume -msse4.2,
but they didn't hot-wire clang the same way.

This seems kind of problematic for us.  Quite aside from the build
failure, doesn't it mean that the .bc files are not very
representative of what is in the .o files?

			regards, tom lane





view thread (13+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pgsql: Inline CRC computation for small fixed-length input on x86
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox