Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question for Gerd: reduce rbb lookup tables

Author: Russell Reagan

Date: 16:06:02 07/14/03

Go up one level in this thread


On July 14, 2003 at 17:50:04, Bas Hamstra wrote:

>plain old 512k. It seems that is overdone...

You can do a lot better than 2x (or even 4x), if you want. I currently use 16KB
tables. Something like this (from memory):

Bitboard rank_attacks[64][8]; // [6-bit rank state][rank position]
Bitboard file_attacks[64][8];
Bitboard diag_a1h8_attacks[64][8];
Bitboard diag_a8h1_attacks[64][8];

It requires some extra work to compute the attack tables (a shift and maybe an
and or something). I'm at work at the moment, or else I'd post the attack
generation routines. I'm sure it could be optimized further because I put the
routines together rather hackishly (adding things here and there until it
worked).

But, you asked about a version without any extra CPU work, and I think the best
you can do there is 128KB tables. You could minimize the rank table to store
8-bit values instead of 64-bit values, but the value ends up being promoted
anyway, and I believe that isn't 100% "free" to convert from 8-bit values to
64-bit values.

Also, you could minimize the diag_* tables further since you really don't need
the 6-bits for all diagonals, or the 8 diagonal positions for all diagonals.

So in the end I think you could get them quite small if you wanted, at a minimal
cost of one or two extra bitwise ops. The good news is, there is certainly a lot
of room for optimization over 512KB tables, and with Opteron you can get a
bigger 1MB cache which will help even more. Fun times :)



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.