summaryrefslogtreecommitdiff
path: root/src/fathom/tbprobe.h
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2026-09-25 08:44:25 -0700
committerScott Gasch <[email protected]>2026-09-25 08:44:25 -0700
commit9b28080f8b3dca4588cb2aaaf748451f45e3c626 (patch)
tree54e0aff5d6ee1520c590c7c04a5ae2f8299e7497 /src/fathom/tbprobe.h
parent66740dc89c7351c120c25788d0079055034f4942 (diff)
Two ideas:
1. Nullmove R=3 + depth/6 along with some ShouldWeDoNullmoveSearch tweaking and calibrating. 2. Probe EGTB everywhere in the search as long as the table/position is resident in memory.
Diffstat (limited to 'src/fathom/tbprobe.h')
-rw-r--r--src/fathom/tbprobe.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/fathom/tbprobe.h b/src/fathom/tbprobe.h
index 82850e7..6f4e5e0 100644
--- a/src/fathom/tbprobe.h
+++ b/src/fathom/tbprobe.h
@@ -181,6 +181,64 @@ bool tb_init(const char *_path);
void tb_free(void);
/*
+ * Cheap, non-blocking check for whether the WDL table covering a given
+ * material signature (per-side piece-type bitboards, no square/turn/ep
+ * info needed) is already mapped into memory from an earlier probe this
+ * process -- i.e. whether a probe of a position with this material is
+ * likely to be low-latency versus pay a first-touch mmap()+parse (and
+ * possibly disk-read) cost. See the routine description in tbprobe.c for
+ * the full contract and caveats.
+ *
+ * PARAMETERS:
+ * - white, black, queens, rooks, bishops, knights, pawns:
+ * Per-side piece-type bitboards (kings/turn/ep are irrelevant to the
+ * material-signature key and are omitted).
+ *
+ * RETURN:
+ * - 1: table exists and is already resident (fast probe expected).
+ * - 0: table exists but hasn't been touched yet this run (first probe
+ * will pay the one-time mmap()+header-parse cost).
+ * - -1: no WDL table covers this material signature at all.
+ */
+int tb_wdl_is_resident(uint64_t white, uint64_t black, uint64_t queens,
+ uint64_t rooks, uint64_t bishops, uint64_t knights,
+ uint64_t pawns);
+
+/*
+ * Precise, non-blocking check for whether a WDL probe of this EXACT
+ * position (not just its material signature) would hit only pages
+ * already resident in the OS page cache. Unlike tb_wdl_is_resident()
+ * above -- which only knows whether the table's header/index metadata
+ * has been parsed at all, a weak proxy for large 6-man files -- this
+ * walks the same indexTable/sizeTable/compressed-data-block addresses a
+ * real probe would touch and confirms each one via mincore() before
+ * trusting the next, so it never blocks on disk I/O itself. Small (3-5
+ * man) WDL files are mlock()'d whole at load time (see init_table() in
+ * tbprobe.c), so for that tier this degenerates to the same
+ * header-parsed check as tb_wdl_is_resident() -- a guarantee, not a
+ * guess, for that tier specifically.
+ *
+ * PARAMETERS:
+ * - white, black, kings, queens, rooks, bishops, knights, pawns:
+ * The current position (bitboards), matching tb_probe_wdl's layout.
+ * - turn: true if White is to move.
+ *
+ * RETURN:
+ * - 1: a real probe here is expected to touch only resident pages.
+ * - 0: table not loaded, material untabulated, or some page on the
+ * lookup path isn't resident yet.
+ *
+ * Not available under _WIN32 (mincore() has no portable equivalent
+ * wired up there yet).
+ */
+#ifndef _WIN32
+int tb_wdl_probe_is_resident(uint64_t white, uint64_t black, uint64_t kings,
+ uint64_t queens, uint64_t rooks,
+ uint64_t bishops, uint64_t knights,
+ uint64_t pawns, bool turn);
+#endif
+
+/*
* Probe the Win-Draw-Loss (WDL) table.
*
* PARAMETERS: