Sting - A fatal error in Hash code (Stockfish.2.1.1)

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

Moderators: hgm, Rebel, chrisw

lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by lech »

I found a very important bug, next and next and I doubt that the last one; in the Stockfish 2.1.1 code.
Thanks to this, you (Sting) may use only max 3072 M hash. If you try tu set more (e.g. 4096) you in fact get and use only 64 K (KILO !!!).

Sting probably has all needed tools but to solve each tough position, needs strong hardware (large Hash and many CPUs), solid and stable search.

I prepared quickly a test (with correction) version of Sting 7 (only 32 bit).
download: http://www.mediafire.com/download/xxceg ... 7-test.zip

If somebody is able to help me and to test (solving with a large hash) this version, is welcome.
Especially this very intersting position for a question of lazzy King is worth to try (I can to add a special code or not).
[d]B7/p1p5/k2p4/p3p3/P1Nb1p2/6p1/7p/3K4 w - - 0 1 win Ke1 -> c8 by h3 gate.
White King can statrs from e.g. a2!

The full version of Sting 7 (with source code and 64-bit compilation) should to be ready in c.a. two weeks.
Maybe, I can't be friendly, but let me be useful.
Jouni
Posts: 3293
Joined: Wed Mar 08, 2006 8:15 pm

Re: Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by Jouni »

Analysis by Stockfish 100316 64 BMI2:

1.Ke1 f3 2.Bxf3 Be3 3.Kf1 Bg5 4.Kg2 Bh4 5.Bc6 h1R 6.Kxh1 Bg5 7.Kg2 Bf4 8.Bf3 e4 9.Bxe4 Be5 10.Kh3 Bf4 11.Kg4 Bg5 12.Kf5 Bd8 13.Ke6 d5 14.Bxd5 c6 15.Bxc6 g2 16.Bxg2 Bg5 17.Kd7 Bf6 18.Kc8 Bd8 19.Bb7#
+- (#19) Depth: 55/62 00:05:39 4155mN, tb=3132094
Jouni
Paloma
Posts: 1167
Joined: Thu Dec 25, 2008 9:07 pm
Full name: Herbert L

Re: Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by Paloma »

Thank's Marek

unfortunately my comp has only 4GB RAM, so i can't test it.
Vinvin
Posts: 5228
Joined: Thu Mar 09, 2006 9:40 am
Full name: Vincent Lejeune

Re: Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by Vinvin »

Hello Marek,
the engine have trouble to start in Arena with 8 GB of hashtable ...
Dann Corbit
Posts: 12542
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by Dann Corbit »

32 bit processes have limits on addressable ram.
SEE:
https://msdn.microsoft.com/en-us/library/aa366778.aspx

Typically you get 2 GB by default and 4GB with a special flag (if available) on 32 bit Windows.

The rules differ on 32 and 64 bit OS, but in both cases 32 bit processes are limited.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by lech »

Dann Corbit wrote:32 bit processes have limits on addressable ram.
SEE:
https://msdn.microsoft.com/en-us/library/aa366778.aspx

Typically you get 2 GB by default and 4GB with a special flag (if available) on 32 bit Windows.

The rules differ on 32 and 64 bit OS, but in both cases 32 bit processes are limited.
Thanks Dann!

I changed the hash code of Stockfish 2.1.1 :

Code: Select all

size_t newSize = 1024;
 while &#40;2ULL * newSize * sizeof&#40;TTCluster&#41; <= &#40;mbSize << 20&#41;)
      newSize *= 2;
to:

Code: Select all

size_t newSize = 1024;
while &#40;2ULL * newSize * sizeof&#40;TTCluster&#41; <= &#40;uint64_t&#40;mbSize&#41; << 20&#41;)
      newSize *= 2;
mbSize is size_t type, and it is probably 32-bit for 64-bit Microsoft compiler too.
But, as you wrote it is too small for the 32-bit compilation. :)
Maybe, I can't be friendly, but let me be useful.
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by lech »

Vinvin wrote:Hello Marek,
the engine have trouble to start in Arena with 8 GB of hashtable ...
Hi Vincent, if you can start this test Sting with 4 GB it would be a good result. Let me know if not. Thanks! :)
Maybe, I can't be friendly, but let me be useful.
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by lech »

Jouni wrote:Analysis by Stockfish 100316 64 BMI2:

1.Ke1 f3 2.Bxf3 Be3 3.Kf1 Bg5 4.Kg2 Bh4 5.Bc6 h1R 6.Kxh1 Bg5 7.Kg2 Bf4 8.Bf3 e4 9.Bxe4 Be5 10.Kh3 Bf4 11.Kg4 Bg5 12.Kf5 Bd8 13.Ke6 d5 14.Bxd5 c6 15.Bxc6 g2 16.Bxg2 Bg5 17.Kd7 Bf6 18.Kc8 Bd8 19.Bb7#
+- (#19) Depth: 55/62 00:05:39 4155mN, tb=3132094
Thanks, Jouni.
It would be good to know, if Stockfish is able to solve the same positions but with white King on a2 square.
[d]B7/p1p5/k2p4/p3p3/P1Nb1p2/6p1/K6p/8 w - - 0 1 win Ka2 -> c8 by h3 gate.
The problem of lazy King is very interesting and you can help me much. :)
Maybe, I can't be friendly, but let me be useful.
lech
Posts: 1136
Joined: Sun Feb 14, 2010 10:02 pm

Re: Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by lech »

Paloma wrote:Thank's Marek

unfortunately my comp has only 4GB RAM, so i can't test it.
Thanks Herbert!
Unfortunately I can use only 1 GB Hash and I am like a blind men in the forest. :lol:
Maybe, I can't be friendly, but let me be useful.
Dann Corbit
Posts: 12542
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Sting - A fatal error in Hash code (Stockfish.2.1.1)

Post by Dann Corbit »

If you use size_t for allocations it should be useful for any model.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.