From 630fda2e2cfd44ccf33c2c66ec30842fbca9a4f3 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 13 Jun 2009 11:13:09 +0100 Subject: [PATCH] Reduce SMP contention on TT Move TT object away from heavy write accessed NodesSincePoll and also, inside TT isolate the heavy accessed writes variable. No functional change. Signed-off-by: Marco Costalba --- src/search.cpp | 6 +++--- src/tt.h | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 577484a9..3382e09c 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -189,6 +189,9 @@ namespace { // Remaining depth: 1 ply 1.5 ply 2 ply 2.5 ply 3 ply 3.5 ply const Value RazorApprMargins[6] = { Value(0x520), Value(0x300), Value(0x300), Value(0x300), Value(0x300), Value(0x300) }; + // The main transposition table + TranspositionTable TT; + /// Variables initialized by UCI options @@ -268,9 +271,6 @@ namespace { int NodesSincePoll; int NodesBetweenPolls = 30000; - // The main transposition table - TranspositionTable TT; - /// Functions diff --git a/src/tt.h b/src/tt.h index c570761b..fb414bf1 100644 --- a/src/tt.h +++ b/src/tt.h @@ -92,7 +92,13 @@ public: private: inline TTEntry* first_entry(const Key posKey) const; - unsigned size, writes; + // Be sure 'writes' is at least one cacheline away + // from read only variables. + unsigned char pad_before[64 - sizeof(unsigned)]; + unsigned writes; // heavy SMP read/write access here + unsigned char pad_after[64]; + + unsigned size; TTEntry* entries; uint8_t generation; }; -- 2.39.2