Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How to make your movegen 4x slower in 1 easy step

Author: Dann Corbit

Date: 11:07:50 08/30/01

Go up one level in this thread


On August 30, 2001 at 13:56:53, Scott Gasch wrote:

>I'm moving around data structures in my engine to consolodate things that are
>going to be needed on a per-cpu basis if/when I go parallel.
>
>One such structure is my move stack.  It's a big array of moves with a start and
>end index per ply.  So for example it might look like this:
>
>start[0] = 0  ...  end[0] = 32  [array entries 0..32 hold moves at ply 0]
>start[1] = 33 ...  end[1] = 60  [array entries 33..60 hold moves at ply 1]
>...
>
>Well if more than one thread is searching at once I will need more than one move
>stack and more than one ply counter.  So I kept the same move stack struct and
>made g_MoveStack an array:
>
>MOVE_STACK g_MoveStack[NUM_CPU];
>
>The code to access the move stack goes from this:
>
>g_MoveStack.iStart[g_iPly] = 0;
>
>to this:
>
>g_MoveStack[iCpuId].iStart[g_iPly[iCpuId]] = 0;
>
>Talk about a huge impact -- move move generator benchmark literally is 4x
>slower!  These dereferences are damn expensive.  There has to be a better way,
>can one of you assembly gurus give me a clue?
>
>Here is a solution I am thinking about -- have a struct per-thread that houses
>the ply and a pointer to the start of the right move stack entry.  Then do
>something like this:
>
>THREAD_INFO *pThreadInfo = &(g_ThreadInfo[iCurrentThreadId]);
>(pThreadInfo->pMoveStack)->iStart[sThreadInfo->iCpuId] = 0;
>
>I bet this is just as slow though... Any advice?

Dumb question:
Why not let them all have their own move generator and just share the hash
table?



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.