Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: hash messed up

Author: Dan Newman

Date: 12:45:33 10/10/99

Go up one level in this thread


On October 09, 1999 at 02:02:44, Scott Gasch wrote:

>I hate to follow my own posting but I solved this problem and wanted to share
>the solution in case it helps anyone else.
>
>First of all, I was counting a hit as a signature match in the hash AND a usable
>node (depth was enough to be useful).  Some others count any signature match as
>a hit.  This difference was part of the problem.
>
>When I started counting the same way as others I noticed my hash rate was 49.97%
>on Fine 70 (see previous post).  This lead me to suspect something was wrong
>with side to move which turned out to be true.  Black to move positions were
>overwriting white to move same positions and vice versa.
>

I prevent this by having separate hash tables for black and white.  This
also effectively increases the hash code by one bit--to 65 bits.  (Not
that it's really needed...)  The other way is to (of course) hash in a
side to move bit pattern--but that has always seemed chancy to me somehow.

>So now the hash rate is near 100% on Fine 70 which makes me happy.
>Unfortunately this bug fix did not decrease the size of my search tree as I had
>intended... Dr. Hyatt has searched like 90k positions at 20 ply in Fine 70
>whereas I have broken a million at that point.  I am still searching for this
>bug and I am reasonably sure my move ordering is good.
>

After reading this I finally got around to instrumenting my probe function
(put in a count of probes and a count of hits).  I ran it on Fine 70 and got
60% hit rate and so knew something was wrong...  (It also hit a brick wall
on the 22 ply search and sat there for 40s after doing the first 21 in under
a second.)

I'd looked at that code a dozen times and had never seen anything wrong.
But now that I knew there must be a bug, I was finally able to see it.
(Funny how that works.)  I was stuffing my score (which was stored in
a 32-bit int) into a 16 bit field in the hash table entry.  This was
fine for positive scores, but I obviously wasn't thinking negative scores
when I did this, or I would have masked the score down to 16 bits
before ORing it in.  Unfortunately all those ones in the upper 16-bits
trashed 16 bits of my hash signature.  And that wasn't the only bug, I also
neglected to sign extend the thing whenever I extracted it...

So, thanks very much for the help,

-Dan.

>That said, what is the point of having a root move list in Think()?
>
>Scott



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

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