Computer Chess Club Archives


Search

Terms

Messages

Subject: CilkChess question for Don

Author: Robert Hyatt

Date: 08:27:23 01/31/99


Don...  was cleaning out some files on Friday, and I found something about
cilkchess I had printed somewhere in the past, a discussion about cilkchess
and its implementation details on a SMP platform.

One thing stood out like a sore thumb that I wanted to ask about...  You
mentioned that you don't 'lock the hash table at all'.  And I'm wondering how
you make that work.

IE suppose you have a simple implementation that requires two words, one for
the 'signature' and one for the 'value'.  Since this is two words long, it
takes two instructions to store the entry and two to access the entry. What
do you do when the 'reader' reads the first word, but gets blocked by an
interrupt (or bus conflict or whatever) so that the 'writer' stores a new
signature _and_ value?  Because now the reader will get the second word and
it does _not_ go with the first.  So you get a wrong value.

Harry and I spent several weeks debugging this in Cray Blitz way back, as I
was getting 'bad move from hash table' messages regularly, but only when
using more than one processor, so I was _certain_ it wasn't a real hash
signature collision.  We tracked it down to the above problem, and put a
'lock' around the few instructions that load or store.  IE here is what I do in
Crafty now:

HashProbe:

  Lock(lock_hasha);
  word1=htable->word1;
  word2=htable->word2;
  UnLock(lock_hasha);

'word1 and word2' are local, while htable-> points to a globally shared hash
table.

HashStore:

    Lock(lock_hashb);
    htableb->word1=word1;
    htableb->word2=word2;
    UnLock(lock_hashb);

If I remove the locks, I get _serious_ problems, because the signatures will
match, but the 'best move' will fail validation.  Which also means that the
score, the draft, the threat flags, etc are _all_ wrong for this position.

Do you fix this?  Do you even detect this?  Or do you just ignore it, which
would seem to be impossible based on tests with CB and Crafty???

Bob




This page took 0.03 seconds to execute

Last modified: Thu, 07 Jul 11 08:48:38 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.