Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Beowulf hot spots shown pictorially

Author: Dieter Buerssner

Date: 16:05:33 06/20/02

Go up one level in this thread


On June 20, 2002 at 18:21:47, Dann Corbit wrote:

>The hot spot is quiesce, which has as its stumbling blocks the long long shift
>right routine and hashprobe.  Hashprobe is held up by long long modulo.

A 64 bit modulo certainly is extremely expensive, and when needed very often a
"don't do it" for a chess engine. For the assembler programmer it might be no
problem at all on x86 architecture, when she knows, that the result fits in 32
bits - just a div. For the high level programmer, this is (without specific
support of the compiler) impossible to achieve. I would guess (without looking
at the Beowulf source), that the 64 bit modulo is needed for the index
calculation in the hash table. When you accept, that you will never need more
than 2^32 entries in the HTs, you may be able to easily avoid this costly thing.

So, instead of using:

extern unsigned long long hash_signature;

....

  size_t hash_index;
  hash_index = hash_signature%number_of_entries_in_ht;

you could use something like

  hash_index = ((unsigned long)hash_signature)%number_of_entries_in_ht;

or

  hash_index = ((unsigned long)(hash_signature>>32))%number_of_entries_in_ht;

Depending on the compiler and optimization switches used, the cast in the last
line would not be necessary. Both instructions should on the x86 architecture
translate to a "simple" div. In the WB-forum, I also have shown another "trick",
to get rid of all "div" instructions, by using multiply of 32bitx32bit=64bit,
and using the hight 32bits of the result as the index into the hash table.

Regards,
Dieter





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.