Skip to content

AVX10 feature mismatch between GCC and LLVM #135394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sayantn opened this issue Apr 11, 2025 · 4 comments · Fixed by #135489
Closed

AVX10 feature mismatch between GCC and LLVM #135394

sayantn opened this issue Apr 11, 2025 · 4 comments · Fixed by #135489
Assignees

Comments

@sayantn
Copy link

sayantn commented Apr 11, 2025

The Intel Software Developers Manual (March 2025) specifies that AVX10.1 supports the following AVX512 instruction families (Volume 1, Table 16-2)

  • AVX512F
  • AVX512CD
  • AVX512BW
  • AVX512DQ
  • AVX512VBMI
  • AVX512IFMA
  • AVX512VNNI
  • AVX512BF16
  • AVX512VPOPCNTDQ
  • AVX512VBMI2
  • VAES
  • GFNI
  • VPCLMULQDQ
  • AVX512-BITALG
  • AVX512-FP16

With the following additional note

VAES, VPCLMULQDQ, and GFNI EVEX instructions will be supported on Intel AVX10.1 machines but will continue to be enumerated by their existing discrete CPUID feature flags. This requires the developer to check for both the feature and Intel AVX10, e.g., {AVX10.1 AND VAES}.

GCC and LLVM agree to enable all avx512* features, but they do not seem to agree about vaes, vpclmulqdq and gfni

  • Running gcc -mavx10.1-512 -Q --help=target shows that avx10.1-512 implies none of GFNI, VAES and VPCLMULQDQ
  • Examining X86.td shows that avx10.1-512 implies only VAES and VPCLMULQDQ, not GFNI

Both seems to be following the Intel spec, but in different ways, which is not good for the ecosystem in general, and creates more confusion between end users. This would probably require some collaboration with GCC (and possible Intel too).

GCC version

gcc (GCC) 14.2.1 20250207
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@llvmbot
Copy link
Member

llvmbot commented Apr 11, 2025

@llvm/issue-subscribers-backend-x86

Author: Sayantan Chakraborty (sayantn)

The Intel Software Developers Manual (March 2025) specifies that AVX10.1 supports the following AVX512 instruction families (Volume 1, Table 16-2) - AVX512F - AVX512CD - AVX512BW - AVX512DQ - AVX512VBMI - AVX512IFMA - AVX512VNNI - AVX512BF16 - AVX512VPOPCNTDQ - AVX512VBMI2 - VAES - GFNI - VPCLMULQDQ - AVX512-BITALG - AVX512-FP16

With the following additional note
> VAES, VPCLMULQDQ, and GFNI EVEX instructions will be supported on Intel AVX10.1 machines but will continue to be enumerated by their existing discrete CPUID feature flags. This requires the developer to check for both the feature and Intel AVX10, e.g., {AVX10.1 AND VAES}.

GCC and LLVM agree to enable all avx512* features, but they do not seem to agree about vaes, vpclmulqdq and gfni

  • Running gcc -mavx10.1-512 -Q --help=target shows that avx10.1-512 implies none of GFNI, VAES and VPCLMULQDQ
  • Examining X86.td shows that avx10.1-512 implies only VAES and VPCLMULQDQ, not GFNI

Both seems to be following the Intel spec, but in different ways, which is not good for the ecosystem in general, and creates more confusion between end users. This would probably require some collaboration with GCC (and possible Intel too).

GCC version

gcc (GCC) 14.2.1 20250207
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@pinskia
Copy link

pinskia commented Apr 11, 2025

Note gcc (GCC) 14.2.1 20250207 is pre the change to AVX10 to GCC. It was backported on Feb 18th to GCC 14 branch.
So you might want to recompare again. And there was the avx10.1 change to include 512 on March 24th.

@sayantn
Copy link
Author

sayantn commented Apr 11, 2025

Even in the current git version (see here) avx10.1-512 only implies the avx512* target features, none of vaes, vpclmulqdq and gfni

@phoebewang phoebewang self-assigned this Apr 12, 2025
@phoebewang
Copy link
Contributor

Thanks for the report! According to latest SDM, both vaes and vpclmulqdq require a second flag. I'll change it in LLVM side.

phoebewang added a commit that referenced this issue Apr 14, 2025
According to SDM, they require both VAES/VPCLMULQDQ and AVX10.1 CPUID
bits.

Fixes: #135394
swift-ci pushed a commit to swiftlang/llvm-project that referenced this issue Apr 14, 2025
…5489)

According to SDM, they require both VAES/VPCLMULQDQ and AVX10.1 CPUID
bits.

Fixes: llvm#135394
(cherry picked from commit ebba554)
var-const pushed a commit to ldionne/llvm-project that referenced this issue Apr 17, 2025
…5489)

According to SDM, they require both VAES/VPCLMULQDQ and AVX10.1 CPUID
bits.

Fixes: llvm#135394
Zalathar added a commit to Zalathar/rust that referenced this issue May 4, 2025
Add the AVX10 target features

Parent rust-lang#138843

Adds the `avx10_target_feature` feature gate, and `avx10.1` and `avx10.2` target features.

It is confirmed that Intel is dropping AVX10/256 (see [this comment](rust-lang#111137 (comment))), so this should be safe to implement now.

The LLVM fix for llvm/llvm-project#135394 was merged, and has been backported to LLVM20, and the patch has also been propagated to rustc in rust-lang#140502

`@rustbot` label O-x86_64 O-x86_32 A-target-feature A-SIMD
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 4, 2025
Rollup merge of rust-lang#139675 - sayantn:avx10, r=Amanieu

Add the AVX10 target features

Parent rust-lang#138843

Adds the `avx10_target_feature` feature gate, and `avx10.1` and `avx10.2` target features.

It is confirmed that Intel is dropping AVX10/256 (see [this comment](rust-lang#111137 (comment))), so this should be safe to implement now.

The LLVM fix for llvm/llvm-project#135394 was merged, and has been backported to LLVM20, and the patch has also been propagated to rustc in rust-lang#140502

`@rustbot` label O-x86_64 O-x86_32 A-target-feature A-SIMD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants