public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tobias Bussmann <[email protected]>
To: John Naylor <[email protected]>
Cc: Lukas Fittl <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Jakob Egger <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Sandeep Thakkar <[email protected]>
Subject: Re: Broken build on macOS (Universal / Intel): cpuid instruction not available
Date: Tue, 2 Jun 2026 14:49:54 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CANWCAZZNu5nLzeeNs8TyC6Xs4HKzHni=yeTqCH7_QNpktR2nMQ@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<[email protected]>
<CAP53PkzLmeNUiNtcOyw62KkD7OzthdCbkwGTyAk+Lu3LKsmOcg@mail.gmail.com>
<CANWCAZa5TEmjLy0xtBjP9NyuVCJpCOpVkBSzw-fqmH8D9tFzDg@mail.gmail.com>
<[email protected]>
<CANWCAZZNu5nLzeeNs8TyC6Xs4HKzHni=yeTqCH7_QNpktR2nMQ@mail.gmail.com>
> Am 08.05.2026 um 12:04 schrieb John Naylor <[email protected]>:
>
> Taking a quick look at the configure output you provided, certain
> optimizations will be lacking on both architectures:
Indeed. The universal builds seem to disable optimisations that are supported
natively. I did a comparison on the attached configure outputs with different
CFLAGS on arm64 - the first three ran the compiler in x86_64 emulation. I'd expect
this to be similar to a native x86_64 environment, but need to verify.
1. configure.x86_64.out: -arch x86_64 using rosetta2
2. configure.universal-cross.out: -arch arm64 -arch x86_64 using rosetta2
3. configure.arm64-cross.out: -arch arm64 using rosetta2
4. configure.x86_64-cross.out: -arch x86_64
5. configure.universal.out: -arch arm64 -arch x86_64
6. configure.arm64.out: -arch arm64
The difference on active features in detail are:
Only with arm64 native (6):
* svcnt_x
* pmull and pmull2
Both with arm64 native (6) and cross (3):
* __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS
Only with x86_64 emulation (1):
* assembler supports x86_64 popcntq
* _mm512_popcnt_epi64
* _mm512_clmulepi64_epi128
Both with x86_64 emulation/native (1) and arm64 cross (3) and universal cross (2)
* AVX2 target attribute support
Both with x86_64 cross (4) and emulation (1):
* __get_cpuid
* __get_cpuid_count
* _xgetbv
* _mm_crc32_u8 and _mm_crc32_u32
This results in the following CRC-32 decisions:
CRC-32C implementation:
1. x86_64 emulation: SSE 4.2 with runtime check
2. universal emulation: slicing-by-8
3. arm64 cross emulation: ARMv8 CRC instructions
4. x86_64 cross: SSE 4.2 with runtime check
5. universal: slicing-by-8
6. arm64: ARMv8 CRC instructions
Vectorized CRC-32C:
1. x86_64 emulation: AVX-512 with runtime check
2. universal emulation: none
3. arm64 cross emulation: none
4. x86_64 cross: none
5. universal: none
6. arm64: CRYPTO PMULL with runtime check
The differences between cross compilation and emulation(native) may be
worth looking into.
Cross-compiling arm64 or universal from x86_64 does not work, however:
checksum.c:57:6: error: call to undeclared function 'x86_feature_available'
if (x86_feature_available(PG_AVX2))
^
checksum.c:57:28: error: use of undeclared identifier 'PG_AVX2'
if (x86_feature_available(PG_AVX2))
This may have to do with the detection of "AVX2 target attribute support"
As Sandeep Thakkar just confirmed on the packagers list, this also affects bulding on a native x86_64 host not only an emulated one. The AVX2 target attribute support when ran on x86_64 cross compiling to arm64 (3) (or universal (2)) seems to be wrong.
Best regards
Tobias
Attachments:
[application/octet-stream] configure.x86_64.out (19.0K, 2-configure.x86_64.out)
download
[application/octet-stream] configure.universal-cross.out (19.0K, 3-configure.universal-cross.out)
download
[application/octet-stream] configure.arm64-cross.out (18.8K, 4-configure.arm64-cross.out)
download
[application/octet-stream] configure.x86_64-cross.out (18.9K, 5-configure.x86_64-cross.out)
download
[application/octet-stream] configure.universal.out (18.9K, 6-configure.universal.out)
download
[application/octet-stream] configure.arm64.out (18.7K, 7-configure.arm64.out)
download
view thread (24+ 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], [email protected], [email protected]
Subject: Re: Broken build on macOS (Universal / Intel): cpuid instruction not available
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