Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboards

Author: Robert Hyatt

Date: 07:23:54 12/06/98

Go up one level in this thread


On December 06, 1998 at 05:55:00, Frank Phillips wrote:

>On December 05, 1998 at 21:36:46, Roberto Waldteufel wrote:
>
>>
>>On December 05, 1998 at 17:22:43, Frank Phillips wrote:
>>
>>>On a PII are programs based on bitboards inherently faster than those based  on
>>>integer arrays?
>>
>>Hi Frank,
>>
>>On the Pentium, you have two very useful assembler instructions for bitboards,
>>the bsf and bsr instructions that find the first or last 1 bit in a 32-bit
>>number. These instructions are ideally suited to bitboard operations, but they
>>used to be terribly slow. Not any more, however: on the PII and PPro processors,
>>these instructions are very fast. As long as the testing is done on CPU
>>registers (not in memory), a bsf or bsr instruction executes in either 1 or 2
>>CPU clocks (depending on pipelining efficiency). So on a PII or PPro I think
>>bitboards are a really big win, but if your program is going to be used on older
>>machines, you might think twice about using the bit scan instructions - they can
>>by more than 300 times slower in the worst case.
>>
>>Be careful how you code your bitboard routines if you try them. You will need to
>>code them in assembler, and it's quite fiddly to get right. But when you do,
>>bitboards fly on a PII. You might gain a good insight into bitboards by looking
>>at Earnst Heinz's Darkthought web site. If you are interested in implementing
>>rotated bitboards, Bob Hyatt is preparing (has prepared?) an article for ICCA
>>publication on the subject. He sent me a rough draft copy, and I found it
>>explains rotated bitboard implementation very well indeed. Whether or not
>>rotated bitboards are right for you depends on your program's data structures
>>and also on your implementation. My own experiments on a PII have shown that I
>>can generate the same information using ordinary bitboards faster than I can
>>using rotated bitboards, but the implementation I use relies very heavily on the
>>bit scan instructions, and as I said, these only became fast on the more recent
>>pentiums, and the rotated bitboards would undoubtedly be far superior on any
>>machine that did not offer this fast bit scan capability (eg pentium plain and
>>pentium MMX, also 486 has bit scans but they are slow)
>>
>>Hope this helps. Good luck!
>>
>>Roberto
>Roberto
>
>Thanks for the answer.  I was wondering whether to make the leap to bitboards
>having just ?completed? the barebones of my first program based on the integer
>array approach in TSCP.  I have no plans for the results of my rather mediocre
>efforts - just for personal interest.
>
>The problem as always is getting hold of information .
>
>Bob  is your paper available other than by subscribing to ICCA?
>
>A while ago someone praised Bob Hyatt for all the help he gives to beginners and
>others alike.  I whole heartedly endorse this and would also praise Tom Kerrigan
>for making TSCP readily available.  As someone new to both programming and chess
>programming I found it a wonderful resource, without which I would probably
>never have got started.  (Crafty is another  well documented source, but way up
>the learning curve for a complete beginner).
>
>Frank


I haven't finished this yet...  I've sent it to a couple of people in draft
form when they asked...  And will do the same for you if you are interested.
Note that it is a rough draft, reasonably complete, but not "polished" yet...




This page took 0.01 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.