Komodo 9 and hash table usage

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

royb
Posts: 536
Joined: Thu Mar 09, 2006 12:53 am

Komodo 9 and hash table usage

Post by royb »

Both SCID-vs-PC and Arena 3.5 show (incorrectly?) that Komodo 9 does not clear hash between moves. The % of hash used continues to grow with each move in a game. Is that what is actually happening or are the two GUIs just not able to accurately report Komodo 9 hash table usage?

The Komodo 9 behavior (if hash is not cleared between moves) is different from Stockfish and every other engine I can think of at the moment. Does this give Komodo 9 an advantage in the programmer's eyes?
Hurnavich
Posts: 732
Joined: Wed Jun 19, 2013 8:14 pm

Re: Komodo 9 and hash table usage

Post by Hurnavich »

Same here in Fritz 14 GUI

It may be worth letting Komodo team know about this.
I notice that K9 has lost a small amount of games in my tests on time, may be a time usage issue not sure mind only a small sample of 1 hour aside games played so far no increments.
"May your next game be your best"
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Komodo 9 and hash table usage

Post by hgm »

Why would you ever clear hash between moves? That seems a serious mistake, which will certainly cost you Elo. A very large part of the hashed positions will still be in the search tree for the next move. And by throwing away all that information that was available for free, you would have to rediscover it the expensive way.

There is really only one reason I can think of to do this: to make debugging easier, as errors will always be fully reproducible. But on a non-buggy version it just makes no sense.

Clearing hash between games is another matter, although even then there is nothing to gain by it. Stale entries will be automatically replaced, even if they were non-empty.

BTW, the GUI is supposed just to display what the engine says. It would be very strange, almost inconceivable if they did not manage to do that correctly.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Komodo 9 and hash table usage

Post by Evert »

royb wrote:Both SCID-vs-PC and Arena 3.5 show (incorrectly?) that Komodo 9 does not clear hash between moves.
I can't think of a good reason why it would do otherwise. It seems like a very bad idea in general.
The % of hash used continues to grow with each move in a game.
That should be expected, right? If it didn't, that means the engine is not using the hash table effectively.
However, the fraction of the hashtable used should approach 100% fairly quickly, so I don't think this is a particularly useful piece of information.
The Komodo 9 behavior (if hash is not cleared between moves) is different from Stockfish and every other engine I can think of at the moment. Does this give Komodo 9 an advantage in the programmer's eyes?
Stockfish doesn't report "hashfull", so the GUI doesn't know how much of the hash table Stockfish is using. It also only clears the hash when it receives "ucinewgame" and if you activate the "Clear Hash" option.

This from looking at the source, where the term "hashfull" does not appear and the hash table is only cleared in those cases.

I would be very surprised if many (any?) engines behaved differently from Komodo in this respect, but I would be less surprised if many engines simply do not report the information.
gordonr
Posts: 194
Joined: Thu Aug 06, 2009 8:04 pm
Location: UK

Re: Komodo 9 and hash table usage

Post by gordonr »

Separate from clearing hash between game moves, I have noticed the following...

Using Arena 3.5 to manually traverse a set of test positions in an EPD file, when I go from one position to the next, using Komodo 9 does not involve the hash being cleared - it keeps growing across test positions. But with the same setup, Komodo 8 does clear the hash.

Unlike a game, in this case there is no benefit to maintaining the hash between unrelated test positions and I did expect it to be cleared. Works as I expected with Komodo 8. I'm not even sure what impact this has for Komodo 9... will it just start to replace entries in the hash table once its full?!
User avatar
Ajedrecista
Posts: 1968
Joined: Wed Jul 13, 2011 9:04 pm
Location: Madrid, Spain.

Re: Komodo 9 and hash table usage.

Post by Ajedrecista »

Hello Roy:
royb wrote:Both SCID-vs-PC and Arena 3.5 show (incorrectly?) that Komodo 9 does not clear hash between moves. The % of hash used continues to grow with each move in a game. Is that what is actually happening or are the two GUIs just not able to accurately report Komodo 9 hash table usage?

The Komodo 9 behavior (if hash is not cleared between moves) is different from Stockfish and every other engine I can think of at the moment. Does this give Komodo 9 an advantage in the programmer's eyes?
I do not know if what I write now is unrelated or not to what you say:

Re: For Don D. : NO 32 bit window Komodo????
Ajedrecista wrote:Posted: Sat Aug 20, 2011 6:17 pm

I use Arena 2.0.1 and when I try to clear hash, it appears 'clear hash not recognized' (the same as in Komodo 2.03). Does it mean that Arena is not able of clear hash when Komodo is the used engine? It would be nice that in future releases Komodo can recognize the 'clear hash' command of Arena (I do not know if other GUIs behave in the same way as Arena 2.0.1).
It happens with Komodo 3. I wrote that thinking when I wanted to start a new game. Don answered me in only seven minutes! The answer can be read at that thread.

I agree with Muller that clear the hash during a game is waste previous searches. But if he says that the new info overwrites the old one without overhead, I trust him.

Regards from Spain.

Ajedrecista.
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Komodo 9 and hash table usage

Post by hgm »

gordonr wrote:will it just start to replace entries in the hash table once its full?!
It will even start to replace entries even long before the table is full. This is how hash tables work: you map the position to a location in the table, and it then must be stored in that location, or not at all. Otherwise you would have to look in more than one place when you want to retreive the information, which is prohibitively expensive. (A 'location' usually encompasses some 4 entries, though, which the harware would retreive from memory together anyway, so that you have some leeway without the cost of extra memory accesses.)

So if the location to which the position maps happens to be fully occupied, you must replace something there (as recent positions are always more important than older ones), even if there are millions of entries elsewhere in the table that are still empty.

Usually entries contain some 'aging counter' that identifies them as being used in the current search as opposed to the previous one, and you then preferentially replace those entries in the 'bucket' of 4 that were from the old search. These would be exactly the same entries as that would be empty when you had cleared the table after the previous search. So it really makes no difference, and the time send on clearing is basically just wasted time.
Last edited by hgm on Thu Apr 30, 2015 11:47 am, edited 1 time in total.
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Komodo 9 and hash table usage

Post by zullil »

royb wrote:Both SCID-vs-PC and Arena 3.5 show (incorrectly?) that Komodo 9 does not clear hash between moves. The % of hash used continues to grow with each move in a game. Is that what is actually happening or are the two GUIs just not able to accurately report Komodo 9 hash table usage?

The Komodo 9 behavior (if hash is not cleared between moves) is different from Stockfish and every other engine I can think of at the moment. Does this give Komodo 9 an advantage in the programmer's eyes?
Stockfish doesn't clear hash between moves.
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Komodo 9 and hash table usage

Post by zullil »

Evert wrote:
royb wrote:Both SCID-vs-PC and Arena 3.5 show (incorrectly?) that Komodo 9 does not clear hash between moves.
I can't think of a good reason why it would do otherwise. It seems like a very bad idea in general.
The % of hash used continues to grow with each move in a game.
That should be expected, right? If it didn't, that means the engine is not using the hash table effectively.
However, the fraction of the hashtable used should approach 100% fairly quickly, so I don't think this is a particularly useful piece of information.
The Komodo 9 behavior (if hash is not cleared between moves) is different from Stockfish and every other engine I can think of at the moment. Does this give Komodo 9 an advantage in the programmer's eyes?
Stockfish doesn't report "hashfull", so the GUI doesn't know how much of the hash table Stockfish is using. It also only clears the hash when it receives "ucinewgame" and if you activate the "Clear Hash" option.

This from looking at the source, where the term "hashfull" does not appear and the hash table is only cleared in those cases.

I would be very surprised if many (any?) engines behaved differently from Komodo in this respect, but I would be less surprised if many engines simply do not report the information.
Stockfish now reports hashfull.

https://github.com/official-stockfish/S ... h/pull/233
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Komodo 9 and hash table usage

Post by Evert »

zullil wrote: Stockfish now reports hashfull.

https://github.com/official-stockfish/S ... h/pull/233
Interesting.
The one I looked at was https://github.com/mcostalba/Stockfish , which was the first hit when I googled for "stockfish git".