io-chess
UCI chess engine
Loading...
Searching...
No Matches
SearchSharedData Struct Reference

Thread-safe shared state for search coordination and Lazy SMP. More...

#include <ISearch.h>

Collaboration diagram for SearchSharedData:

Classes

struct  SearchConfig
 Runtime tunable parameters for the search algorithm. More...
struct  VizNode
 Represents a single node in the search tree for export and visualization. More...

Public Types

enum class  PruneReason : uint8_t {
  NONE = 0 , LMP , FUTILITY , SEE ,
  DRAW , RAZOR , REVERSE_FUTILITY , NULL_MOVE ,
  INTERNAL , LAZY_EVAL , TB_CUTOFF , TT_CUTOFF ,
  BETA_CUTOFF , DEPTH_LIMIT , SINGULAR_SKIP
}
 Enumeration of reasons why a node might be pruned (used for tree visualization). More...

Public Attributes

std::atomic< bool > stop {false}
 Global flag to immediately stop all search threads.
std::atomic< bool > disableTablebase {false}
 Disables tablebase probing (e.g., when Syzygy coverage is incomplete).
std::atomic< uint64_t > totalNodes {0}
 Global node count across all threads.
std::atomic< int > selDepth {0}
 Maximum selective depth reached by any thread.
std::atomic< uint64_t > tbHits {0}
 Total tablebase hits across all threads.
std::atomic< uint64_t > ttHits {0}
 Total transposition table hits across all threads.
std::atomic< int > mainThreadScore {0}
 Main thread's current score (used by helpers for aspiration windows).
std::atomic< int > mainThreadDepth {0}
 Main thread's completed depth (used by helpers for early termination).
std::atomic< int > targetDepth {0}
 Target search depth (set by main thread at search start).
int numThreads {1}
 Total number of active search threads.
std::atomic< int64_t > startTimeNs {0}
 Search start time in steady_clock nanoseconds (atomic for ponderhit updates).
int64_t softLimit = 0
 Soft time limit in milliseconds.
int64_t hardLimit = 0
 Hard time limit in milliseconds.
struct SearchSharedData::SearchConfig config
int lazyEvalMaxDepth = 6
 Maximum depth to apply lazy evaluation.
int lazyEvalBaseMargin = 350
 Base margin for lazy evaluation (approx 1 Sigma of residual error).
int lazyEvalDepthMargin = 60
 Depth multiplier margin for lazy evaluation.
int lazyEvalMinMargin = 200
 Absolute minimum margin for lazy evaluation.
bool enableLazyEval = false
 Flag to enable or disable lazy evaluation.
std::vector< VizNodevizTree
 Stores edges for top layers of the search tree.
bool exportTree = false
 Flag to enable tree export visualization.
int exportTreeDepth = 4
 Maximum depth to record nodes for tree visualization.

Detailed Description

Thread-safe shared state for search coordination and Lazy SMP.

This struct holds the atomic variables used to coordinate multiple search threads, manage time limits, and collect statistics across the entire engine.

Member Enumeration Documentation

◆ PruneReason

enum class SearchSharedData::PruneReason : uint8_t
strong

Enumeration of reasons why a node might be pruned (used for tree visualization).

Enumerator
NONE 

Not pruned - fully searched.

LMP 

Late Move Pruning.

FUTILITY 

Futility Pruning.

SEE 

Static Exchange Evaluation pruning.

DRAW 

Draw by repetition or 50-move rule.

RAZOR 

Razoring (drop to qsearch).

REVERSE_FUTILITY 

Reverse Futility / Static Null Move.

NULL_MOVE 

Null Move Pruning cutoff.

INTERNAL 

Internal Node Pruning (Eval Margin).

LAZY_EVAL 

Lazy Eval skip (fast score sufficient).

TB_CUTOFF 

Tablebase cutoff.

TT_CUTOFF 

Transposition table cutoff.

BETA_CUTOFF 

Normal beta cutoff.

DEPTH_LIMIT 

Beyond exportTreeDepth and not PV.

SINGULAR_SKIP 

Skipped during singular extension search.

Member Data Documentation

◆ config

struct SearchSharedData::SearchConfig SearchSharedData::config

◆ disableTablebase

std::atomic<bool> SearchSharedData::disableTablebase {false}

Disables tablebase probing (e.g., when Syzygy coverage is incomplete).

◆ enableLazyEval

bool SearchSharedData::enableLazyEval = false

Flag to enable or disable lazy evaluation.

◆ exportTree

bool SearchSharedData::exportTree = false

Flag to enable tree export visualization.

◆ exportTreeDepth

int SearchSharedData::exportTreeDepth = 4

Maximum depth to record nodes for tree visualization.

◆ hardLimit

int64_t SearchSharedData::hardLimit = 0

Hard time limit in milliseconds.

◆ lazyEvalBaseMargin

int SearchSharedData::lazyEvalBaseMargin = 350

Base margin for lazy evaluation (approx 1 Sigma of residual error).

◆ lazyEvalDepthMargin

int SearchSharedData::lazyEvalDepthMargin = 60

Depth multiplier margin for lazy evaluation.

◆ lazyEvalMaxDepth

int SearchSharedData::lazyEvalMaxDepth = 6

Maximum depth to apply lazy evaluation.

◆ lazyEvalMinMargin

int SearchSharedData::lazyEvalMinMargin = 200

Absolute minimum margin for lazy evaluation.

◆ mainThreadDepth

std::atomic<int> SearchSharedData::mainThreadDepth {0}

Main thread's completed depth (used by helpers for early termination).

◆ mainThreadScore

std::atomic<int> SearchSharedData::mainThreadScore {0}

Main thread's current score (used by helpers for aspiration windows).

◆ numThreads

int SearchSharedData::numThreads {1}

Total number of active search threads.

◆ selDepth

std::atomic<int> SearchSharedData::selDepth {0}

Maximum selective depth reached by any thread.

◆ softLimit

int64_t SearchSharedData::softLimit = 0

Soft time limit in milliseconds.

◆ startTimeNs

std::atomic<int64_t> SearchSharedData::startTimeNs {0}

Search start time in steady_clock nanoseconds (atomic for ponderhit updates).

◆ stop

std::atomic<bool> SearchSharedData::stop {false}

Global flag to immediately stop all search threads.

◆ targetDepth

std::atomic<int> SearchSharedData::targetDepth {0}

Target search depth (set by main thread at search start).

◆ tbHits

std::atomic<uint64_t> SearchSharedData::tbHits {0}

Total tablebase hits across all threads.

◆ totalNodes

std::atomic<uint64_t> SearchSharedData::totalNodes {0}

Global node count across all threads.

◆ ttHits

std::atomic<uint64_t> SearchSharedData::ttHits {0}

Total transposition table hits across all threads.

◆ vizTree

std::vector<VizNode> SearchSharedData::vizTree

Stores edges for top layers of the search tree.


The documentation for this struct was generated from the following file: