Storing multiple moves in TT entry

Discussion of chess software programming and technical issues.

Moderator: Ras

Witek
Posts: 87
Joined: Thu Oct 07, 2021 12:48 am
Location: Warsaw, Poland
Full name: Michal Witanowski

Storing multiple moves in TT entry

Post by Witek »

Hi,

Did anyone try storing multiple "best" moves inside transposition table entry to help move ordering?

I did an experiment in my Caissa engine and it gave ~30 Elo improvement.
I reduced TT entry hash from 64 bits to 32 bits so I could store two additional moves, so in total I store 3 moves, and the memory footprint of TT is the same.

It works as follows: First, inside alpha-beta search function I read the move list from TT entry and try them in the first place (then comes captures, history heuristics etc.). Once best score in a node is beaten, I push this move to the front of the list. In the end, I write back the moves to transposition table.

I made sure it works correctly by printing TT entry with some "ttprobe" command. For example, in initial position, after searching 10 plys deep it ends up with c2c4, e2e4, d2d4 as best moves:

Code: Select all

> position startpos
> go depth 10
info depth 10 seldepth 21 score cp 52 time 31 nodes 32920 nps 1049319 pv c2c4 e7e5 b1c3 g8f6 g1f3 b8c6 e2e3 d7d5 d2d4 e5d4
bestmove c2c4 ponder e7e5
> ttprobe
Score:      52
Depth:      10
Bounds:     exact
Generation: 1
Moves:      c2c4 e2e4 d2d4
Author of Caissa Chess Engine: https://github.com/Witek902/Caissa
dangi12012
Posts: 1062
Joined: Tue Apr 28, 2020 10:03 pm
Full name: Daniel Infuehr

Re: Storing multiple moves in TT entry

Post by dangi12012 »

Witek wrote: Tue Nov 23, 2021 7:08 pm Hi,

Did anyone try storing multiple "best" moves inside transposition table entry to help move ordering?

I did an experiment in my Caissa engine and it gave ~30 Elo improvement.
I reduced TT entry hash from 64 bits to 32 bits so I could store two additional moves, so in total I store 3 moves, and the memory footprint of TT is the same.

It works as follows: First, inside alpha-beta search function I read the move list from TT entry and try them in the first place (then comes captures, history heuristics etc.). Once best score in a node is beaten, I push this move to the front of the list. In the end, I write back the moves to transposition table.

I made sure it works correctly by printing TT entry with some "ttprobe" command. For example, in initial position, after searching 10 plys deep it ends up with c2c4, e2e4, d2d4 as best moves:

Code: Select all

> position startpos
> go depth 10
info depth 10 seldepth 21 score cp 52 time 31 nodes 32920 nps 1049319 pv c2c4 e7e5 b1c3 g8f6 g1f3 b8c6 e2e3 d7d5 d2d4 e5d4
bestmove c2c4 ponder e7e5
> ttprobe
Score:      52
Depth:      10
Bounds:     exact
Generation: 1
Moves:      c2c4 e2e4 d2d4
Isnt this how SF does it too?
I see they use 64 bit hashes but an entry has a 32 bit key?
https://github.com/spinkham/stockfish/b ... a/src/tt.h

But maybe i am mistaken.
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Storing multiple moves in TT entry

Post by hgm »

I thought SF used a 16-bit signature. But not multiple moves, which is the point here. SF just uses the space savings for cramming more slots in the same cache-line bucket.
User avatar
Rebel
Posts: 7299
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: Storing multiple moves in TT entry

Post by Rebel »

I tried 2 moves in the TT, it never gave me anything.
90% of coding is debugging, the other 10% is writing bugs.
Mergi
Posts: 127
Joined: Sat Aug 21, 2021 9:55 pm
Full name: Jen

Re: Storing multiple moves in TT entry

Post by Mergi »

dangi12012 wrote: Tue Nov 23, 2021 9:08 pm
Isnt this how SF does it too?
I see they use 64 bit hashes but an entry has a 32 bit key?
https://github.com/spinkham/stockfish/b ... a/src/tt.h

But maybe i am mistaken.
That's a 12 year old repo. As HGM says, current SF uses 16bit keys and stores 1 move per entry (along with bunch of other info).

https://github.com/official-stockfish/S ... r/src/tt.h