1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-12 12:09:14 +00:00

Fix a compiler bug on Clang 15+ with AVX-512

fixes https://github.com/official-stockfish/Stockfish/issues/4450
closes https://github.com/official-stockfish/Stockfish/pull/4830

No functional change.
This commit is contained in:
MinetaS 2023-10-18 04:03:39 +09:00 committed by Disservin
parent b7b7800e2b
commit 40c6a84434

View file

@ -690,6 +690,17 @@ int map_score(TBTable<DTZ>* entry, File f, int value, WDLScore wdl) {
return value + 1; return value + 1;
} }
// A temporary fix for the compiler bug with AVX-512. (#4450)
#ifdef USE_AVX512
#if defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 15
#define CLANG_AVX512_BUG_FIX __attribute__((optnone))
#endif
#endif
#ifndef CLANG_AVX512_BUG_FIX
#define CLANG_AVX512_BUG_FIX
#endif
// Compute a unique index out of a position and use it to probe the TB file. To // Compute a unique index out of a position and use it to probe the TB file. To
// encode k pieces of the same type and color, first sort the pieces by square in // encode k pieces of the same type and color, first sort the pieces by square in
// ascending order s1 <= s2 <= ... <= sk then compute the unique index as: // ascending order s1 <= s2 <= ... <= sk then compute the unique index as:
@ -697,7 +708,8 @@ int map_score(TBTable<DTZ>* entry, File f, int value, WDLScore wdl) {
// idx = Binomial[1][s1] + Binomial[2][s2] + ... + Binomial[k][sk] // idx = Binomial[1][s1] + Binomial[2][s2] + ... + Binomial[k][sk]
// //
template<typename T, typename Ret = typename T::Ret> template<typename T, typename Ret = typename T::Ret>
Ret do_probe_table(const Position& pos, T* entry, WDLScore wdl, ProbeState* result) { CLANG_AVX512_BUG_FIX Ret
do_probe_table(const Position& pos, T* entry, WDLScore wdl, ProbeState* result) {
Square squares[TBPIECES]; Square squares[TBPIECES];
Piece pieces[TBPIECES]; Piece pieces[TBPIECES];