Remove band-aid aspiration window loop fix, use old alpha/beta values for widening (bench 5739439)

This commit is contained in:
2026-04-04 13:44:15 +02:00
parent d8ccfa570c
commit 6b4a3c97f1
2 changed files with 2 additions and 14 deletions

View File

@@ -21,4 +21,4 @@ requires "https://github.com/demotomohiro/pathX == 0.1"
requires "struct == 0.2.3"
requires "nimsimd == 1.2.13"
requires "noise >= 0.1.10"
requires "noise >= 0.1.10"

View File

@@ -1430,29 +1430,17 @@ proc aspirationSearch(self: var SearchManager, depth: int, score: Score): Score
if mateDepth > 0:
alpha = mateIn(mateDepth * 2 - 1)
beta = mateIn(0)
var fullWindow = false
while true:
score = self.search(depth - reduction, 0, alpha, beta, true, true, false)
if delta == SCORE_INF:
# FIXME: For some mysterious reason heimdall seems to
# be losing on time when low on time with many threads (like 200+).
# The likely culprit is this while loop failing to exit.
# We check if the delta is equal to the maximum score because
# if we searched with the full window we can exit. This should
# already be handled by the else clause at the end of the loop,
# but ¯\_(ツ)_/¯
if fullWindow:
break
fullWindow = true
if self.shouldStop():
break
# Score is outside window bounds, widen the one that
# we got past to get a better result
if score <= alpha:
alpha = max(-SCORE_INF, score - delta)
# Grow the window downward as well when we fail
# low (cuts off faster)
beta = (alpha + beta) div 2
alpha = max(-SCORE_INF, score - delta)
# Reset the reduction whenever we fail low to ensure
# we don't miss good stuff that seems bad at first
reduction = 0