Do bitboards save time or just space efficient.

Discussion of chess software programming and technical issues.

Moderator: Ras

diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: Do bitboards save time or just space efficient.

Post by diep »

Do you have an estimate of the time saved vs. pre-computed byte tables? I spent 2 years developing and redeveloping my engine. It looks like another year here. It never ends.
Oh well my 32 bits move generator you can use for free. I had posted it once here. Though that'll be 15 years ago or so.

Just rewrite it to 32 bits unsigned ints and you good to go.

just give an email if you want. Can have a look where i had put the code i posted (as some arrays here are in dutch in my engine though most in english names).

The move generator won't be the problem there. It's about what you do in evaluation anyway that's the slow part.
Yet how to vectorize all that?

Bitboards versus classical 32 bits datastructure is not really the issue - how to vectorize things fast and then convert back the AVX instructions back to the normal registers - how fast are those 'converting instructions' anyway in AVX? Probably duck slow.

If you need to keep the information inside the AVX registers you cannot easily do 'if then else' type stuff in your engine of course.
That's a big issue...

So speedwise i wouldn't waste too much time there right now. First get it make good moves :)

So the vectorization issue let's show it more clear. If in evaluation you can have a certain complex pattern:

if( pattern ) {
then now we execute this code X
}
else {
either skip or we execute code Y
}

So it's possible to skip lost of code X if the pattern is not there. It's a big speedup to not execute all instructions that form X.
With vectorisation forget about doing that.

X itself in Diep's evaluation function exists again out of many many chess specific patterns.

How to do a complex evaluation function vectorized is a big mystery to me.

SSE2 you still could use in Diep in some cases a handful of instructions here or there. AVX that's so so many integers. That's 8 integers of 32 bits.
That's really a lot.

The wise thing here is write code that is easy to write bugfree!