Right, I only save entires in alpha-beta. I'm not even sure how one only saves them in the ID loop.mvanthoor wrote: ↑Wed Oct 20, 2021 11:37 am You save entries into the TT in alpha-beta, not in iterative deepening (I hope). I don't check if time is up before saving an entry into the TT; I check this at the beginning of alpha-beta. The problem you now have is this:
- You do alpha-bèta
- After the move loop, you write into the TT
- Somewhere along the line, time's up
- And then the recursive alpha-beta unwinds
- But when you should be saving to the TT you don't, because the time is up.
If you are saving into the TT in the bèta cutoff (beta-flag) and after the move loop (alpha-flag), then you're missing all the alpha-flag saves. If you are saving only once (like me, with fail-soft), you miss a huge number of TT-writes.
And am I actually missing a huge amount of TT entries? I didn't realize that. My thinking was that entries after time is up weren't going to be worth anything, since I was simply returning a value of zero to unwind the alpha-beta call stack.
In other words, when I imagine my engine is running alpha-beta at some depth D, and it realizes it's out of time, it now returns zero and aborts the search early. And the value from this aborted search propagates up to D-1, which may or may not finish its move loop, and then returns to D-2, and so on. But the important point to me here is that whatever I return from the node at depth D when I realize I'm out of time, is going to change the overall results of the search, which means we can't necessarily trust entries being written to the TT once our time is up. A beta-cutoff might not actually be a beta-cutoff. Or a node that fails-low might not actually fail-low if we had finished searching.
Hadn't necessarily thought about that scheme, but it makes sense to me and sounds like it would work well.mvanthoor wrote: ↑Wed Oct 20, 2021 11:37 am You shouldn't be checking if the time is up before you write to the TT. You need to allocate something like 50-200ms (depending on how fast your engine is) of headroom. So if you calculate a time slice of 800ms for a move, you subtract 100ms. Then you can spend the slice of 700ms for searching, and then you have 100ms to unwind alpha-beta (AND write to the TT) when time is up.
Perhaps I am doing something odd here, but making sure time is up to prevent garbage entries into TT makes sense to me inuitvely.mvanthoor wrote: ↑Wed Oct 20, 2021 11:37 am Strange. I'll do a time-up check before writing to the TT then, and see if my engine increases 170 Elo in playing strength. I still think you're doing something strange here. You _SHOULD_ check if you've broken iterative deepening because of time-up, because you will have to ignore that run and send the previously saved best move to the GUI.
Sure, I could. But if I wrote things correctly this latest time, which I believe I did, then I made sure to copy your time-check up code too.
On a related note, I switched Blunder over to fail-soft last night, in alpha-beta and qsearch, and it seems like it made a difference, and PVS was a ~32 Elo win, even when checking if time was up before saving to the TT. Not sure why.