mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
L1/L2 friendly PhaseTable[]
In Movepicker c'tor we access during initialization one of MainSearchPhaseIndex..QsearchWithoutChecksPhaseIndex globals. Postpone definition of PhaseTable[] just after them so that when PhaseTable[] will be accessed later in get_next_move() it will be already present in L1/L2. It works like an implicit prefetching of PhaseTable[]. Also shrink PhaseTable[] to fit an L1 cache line of 16 bytes using uint8_t instead of int. This apparentely innocuous patch gives an astonish speed up of 1.6% under MSVC 2010 beta, pgo optimized ! No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -42,12 +42,12 @@ namespace {
|
|||||||
|
|
||||||
/// Variables
|
/// Variables
|
||||||
|
|
||||||
MovePicker::MovegenPhase PhaseTable[32];
|
CACHE_LINE_ALIGNMENT
|
||||||
int MainSearchPhaseIndex;
|
int MainSearchPhaseIndex;
|
||||||
int EvasionsPhaseIndex;
|
int EvasionsPhaseIndex;
|
||||||
int QsearchWithChecksPhaseIndex;
|
int QsearchWithChecksPhaseIndex;
|
||||||
int QsearchWithoutChecksPhaseIndex;
|
int QsearchWithoutChecksPhaseIndex;
|
||||||
|
uint8_t PhaseTable[32];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,4 +66,11 @@ typedef uint64_t Bitboard;
|
|||||||
#define USE_BSFQ
|
#define USE_BSFQ
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Cache line alignment specification
|
||||||
|
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||||
|
#define CACHE_LINE_ALIGNMENT __declspec(align(64))
|
||||||
|
#else
|
||||||
|
#define CACHE_LINE_ALIGNMENT __attribute__ ((aligned(64)))
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // !defined(TYPES_H_INCLUDED)
|
#endif // !defined(TYPES_H_INCLUDED)
|
||||||
|
|||||||
Reference in New Issue
Block a user