Skip to content
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

Implicitly enable evex512 if avx512 is enabled #121088

Merged
merged 1 commit into from
Feb 15, 2024
Merged

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Feb 14, 2024

LLVM 18 requires the evex512 feature to allow use of zmm registers. LLVM automatically sets it when using a generic CPU, but not when -C target-cpu is specified. This will result either in backend legalization crashes, or code unexpectedly using ymm instead of zmm registers.

For now, make sure that avx512* features imply evex512. Long term we'll probably have to deal with the AVX10 mess somehow.

Fixes #121081.

r? @Amanieu

LLVM 18 requires the evex512 feature to allow use of zmm registers.
LLVM automatically sets it when using a generic CPU, but not when
`-C target-cpu` is specified. This will result either in backend
legalization crashes, or code unexpectedly using ymm instead of
zmm registers.

For now, make sure that `avx512*` features imply `evex512`. Long
term we'll probably have to deal with the AVX10 mess somehow.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 14, 2024
@Amanieu
Copy link
Member

Amanieu commented Feb 14, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Feb 14, 2024

📌 Commit 369fff6 has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 14, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 15, 2024
…llaumeGomez

Rollup of 8 pull requests

Successful merges:

 - rust-lang#120449 (Document requirements for unsized {Rc,Arc}::from_raw)
 - rust-lang#120505 (Fix BTreeMap's Cursor::remove_{next,prev})
 - rust-lang#120672 (std::thread update freebsd stack guard handling.)
 - rust-lang#121088 (Implicitly enable evex512 if avx512 is enabled)
 - rust-lang#121104 (Ignore unsized types when trying to determine the size of the original type)
 - rust-lang#121107 (Fix msg for verbose suggestions with confusable capitalization)
 - rust-lang#121113 (Continue compilation even if inherent impl checks fail)
 - rust-lang#121120 (Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7d6c99d into rust-lang:master Feb 15, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 15, 2024
Rollup merge of rust-lang#121088 - nikic:evex512, r=Amanieu

Implicitly enable evex512 if avx512 is enabled

LLVM 18 requires the evex512 feature to allow use of zmm registers. LLVM automatically sets it when using a generic CPU, but not when `-C target-cpu` is specified. This will result either in backend legalization crashes, or code unexpectedly using ymm instead of zmm registers.

For now, make sure that `avx512*` features imply `evex512`. Long term we'll probably have to deal with the AVX10 mess somehow.

Fixes rust-lang#121081.

r? `@Amanieu`
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this pull request May 16, 2024
  [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694)

This prevents problems with ports that fail to build with
CPUTYPE=native, if the native CPU supports AVX512F, resulting in errors
like:

  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
    197 |         const vec_t ones = VSET1_8(1);
        |                            ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^

Ports known to be affected are: archivers/libdeflate, devel/highway,
www/node20, and lang/rust.

(For rust itself there is also a similar issue reported at
rust-lang/rust#121088).

PR:		276104
Reported by:	netchild
MFC after:	3 days
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this pull request May 20, 2024
  [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694)

This prevents problems with ports that fail to build with
CPUTYPE=native, if the native CPU supports AVX512F, resulting in errors
like:

  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
    197 |         const vec_t ones = VSET1_8(1);
        |                            ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^

Ports known to be affected are: archivers/libdeflate, devel/highway,
www/node20, and lang/rust.

(For rust itself there is also a similar issue reported at
rust-lang/rust#121088).

PR:		276104
Reported by:	netchild
MFC after:	3 days

(cherry picked from commit fcfb2d6)
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this pull request May 20, 2024
  [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694)

This prevents problems with ports that fail to build with
CPUTYPE=native, if the native CPU supports AVX512F, resulting in errors
like:

  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
    197 |         const vec_t ones = VSET1_8(1);
        |                            ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^

Ports known to be affected are: archivers/libdeflate, devel/highway,
www/node20, and lang/rust.

(For rust itself there is also a similar issue reported at
rust-lang/rust#121088).

PR:		276104
Reported by:	netchild
MFC after:	3 days

(cherry picked from commit fcfb2d6)
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this pull request May 20, 2024
  [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694)

This prevents problems with ports that fail to build with
CPUTYPE=native, if the native CPU supports AVX512F, resulting in errors
like:

  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
    197 |         const vec_t ones = VSET1_8(1);
        |                            ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^

Ports known to be affected are: archivers/libdeflate, devel/highway,
www/node20, and lang/rust.

(For rust itself there is also a similar issue reported at
rust-lang/rust#121088).

PR:		276104
Reported by:	netchild
Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit fcfb2d6)
(cherry picked from commit 14efb9b)
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this pull request Aug 28, 2024
  [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694)

This prevents problems with ports that fail to build with
CPUTYPE=native, if the native CPU supports AVX512F, resulting in errors
like:

  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
    197 |         const vec_t ones = VSET1_8(1);
        |                            ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^

Ports known to be affected are: archivers/libdeflate, devel/highway,
www/node20, and lang/rust.

(For rust itself there is also a similar issue reported at
rust-lang/rust#121088).

PR:		276104
Reported by:	netchild
MFC after:	3 days
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this pull request Aug 29, 2024
  [X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694)

This prevents problems with ports that fail to build with
CPUTYPE=native, if the native CPU supports AVX512F, resulting in errors
like:

  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
    197 |         const vec_t ones = VSET1_8(1);
        |                            ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^

Ports known to be affected are: archivers/libdeflate, devel/highway,
www/node20, and lang/rust.

(For rust itself there is also a similar issue reported at
rust-lang/rust#121088).

PR:		276104
Reported by:	netchild
MFC after:	3 days
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LLVM ERROR: Do not know how to split the result of this operator!
4 participants