Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Mixing 0x88 and bitboards

Author: Robert Hyatt

Date: 16:46:20 06/25/02

Go up one level in this thread


On June 25, 2002 at 17:28:10, Russell Reagan wrote:

>On June 25, 2002 at 17:04:43, Robert Hyatt wrote:
>
>>What about more commonly:  Is the black pawn on e6 passed.  Now you have
>>to check 12 squares...  d2/e2/f2, d3/e3/f3, d4/e4/f4, d5/e5/f5.
>>
>>Bitmaps:  two loads one and.  No compare.  Just a branch not zero.
>>
>>traditional...  12 loads 12 compares.
>
>Better would be (I think) to maintain a list of pieces, and check if there are
>any opposite colored pawns on the d, e, or f file. Assuming that you have a
>piece list and a pawn list, and that each remains "sorted" (pawns on a file are
>in lower indexes, pawns on h files are in higher indexes) you could probably
>create some system that would allow you to only test a few of the pawns.
>
>Of course, this still isn't faster than bitboards, but it's better than 12 loads
>and 12 tests (I think). And as another poster said, you could use pawn
>hashtables to compute this.
>
>And as for the original testing if there is a pawn on E6, don't you keep a
>64-square array anyway along with your bitboards? If so, is there anything that
>a classical approach can do more efficiently than a bitboard approach? Edge
>detection and attack detection seem to be two of 0x88's typical strong points,
>but I don't see how they would be faster than bitboards. Or is this a matter of
>the hardware you use? Ex. 32-bit hardware, it might be close...64-bit hardware,
>bitboards faster for everything...?
>
>Russell


The issue is this:  how many instructions to do task x?  For bitboards, the
instruction count on a 32 bit machine jumps by a factor of two unless shifts
are being done where it goes up even further.  On 64 bit machines, of course,
those penalties don't apply.  For some things, an offset approach works just
fine. IE I used one on the Cray because using the vector hardware offered yet
another performance boost.

I've never said that bitmaps are better, just because.  I have said that on
32 bit machines, it seems to be a "break-even" process.  But once they are
moved to 64 bit machines, they are more than "break-even".  The thing about
bitmaps is that they allow a lot of "bit-parallel" work.  IE the "is it passed"
trick above.  Or "is the king in the square of the pawn?"  Or any of a large
number of other questions that require multiple questions that can be answered
by ANDing/ORing/XORing/etc so that a single boolean operation answers several
questions in parallel.  That is where bitmaps really shine.  But the trick
becomes "how can I define masks that answer these questions?"  it takes time
to get into this mode of thinking.  And by time, I don't mean a few weeks or
a few months.  It is a long-term learning process.  From experience.



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.