Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboards !! :)

Author: Robert Hyatt

Date: 12:57:42 07/01/04

Go up one level in this thread


On July 01, 2004 at 15:49:21, Robert Hyatt wrote:

>On July 01, 2004 at 15:02:34, Gerd Isenberg wrote:
>
>>On July 01, 2004 at 11:13:14, Robert Hyatt wrote:
>>
>>>On July 01, 2004 at 02:50:35, Tony Werten wrote:
>>>
>>>>Hi all,
>>>>
>>>>although I like the principle of bitboards, it really bothers me that I can't
>>>>seem to find a decent/fast way to evaluate weighted safe squares.
>>>>
>>>>Suppose I want to (simple) evaluate a rook, I generate a bitboard with all
>>>>reachable squares and mask off the squares attacked by lower pieces (that's no
>>>>problem).
>>>>
>>>>(This doesn't exacly generate safe squares, only the ones that aren't attacked
>>>>at all by opponents pieces are, for the remaining squares one would need a SEE,
>>>>but that's not the point )
>>>>
>>>>Now I can use this bitboard ( say rook on e4 ), mask the rank state, and look in
>>>>a precomputed table how this rankstate scores on an e rank. No problem.
>>>>
>>>>But how to do the files ? If I use the rotated board, I need to have the
>>>>opponents attackboard in this rotated board as well, wich would be very costly
>>>>to compute (ie also for the bishops,queens ) and very complicated.
>>>>
>>>>Any ideas ? Am I missing something ?
>>>>
>>>>BTW, doing a popcount isn't a solution, since it violates the elegance of
>>>>bitboards ( and is slow ?)
>>>>
>>>>Tony
>>>
>>>
>>>On the Cray there is an elegant solution, but not on X86 so far...
>>>
>>>You can create a 64-word vector of "weights".  How you compute these is up to
>>>you.  In Cray Blitz I did this as I did the evaluation, figuring out which
>>>squares were weak, unimportant, strong, useful, painful for opponent, etc.
>>>After the normal eval, I had a vector of values, one per square for all squares
>>>on the board.  Now I computed the "attack bitmap" for a piece, and stuck that in
>>>the vector mask register.  Now when I sum up the square value vector, it only
>>>sums the values with a corresponding bit mask of 1, meaning this piece attacks
>>>that square safely.
>>
>>Wow great, a scalar product 64word*64bit.
>>Was it implemented in hardware or a kind of micro-program?

BTW the cray was not micro-programmed in any way.  All pure combinational logic
in the CPU, for speed.

>
>Took a couple of instructions.  "vector mask" selects the words you want, you
>pipe them into a "reduction" operation successively to collapse N words to 1
>final sum.  This "chains" so it takes essentially no extra time to do, which is
>cute.. :)  But no similar facility on non-cray cpus to date...
>
>
>
>
>>
>>>
>>>I obviously don't do that at present, since X86 has no such direct capability
>>>and the software approach is expensive...
>>
>>Thinking about some oppropriate SSE2-instructions for that scalar product, eg.
>>64 bytes * 64 bit. Four 128-bit (16Byte) xmmm registers where each byte is
>>associated with one bit of the other operand.
>>
>>One subtask, may be the most expensive, is to expand each bit to one byte, so
>>that 1 becomes 0xff. From 64-bit word to four times 128-bit words.
>>
>
>
>I hate corresponding with you.  I end up with a _headache_ every last time you
>start that stuff.  :)
>
>
>
>
>
>
>>Four parallel "and" and some final horicontal (3DNow psadbw is fine for that)and
>>vertical (over the four xmm-registers) parallel adds.
>>
>>Ok it will take some cycles, anyway...
>>
>>>
>>>In any case, I believe there are plenty of viable alternatives to this kind of
>>>mobility concept that it isn't that important...  IE mobility has many forms of
>>>expression.  A rook on an open file is one such idea...



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.