Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: HyperThreading Revisited

Author: Robert Hyatt

Date: 20:56:38 11/08/02

Go up one level in this thread


On November 08, 2002 at 20:59:09, Nolan Denson wrote:

>I was in a seminar today for hyper-threading. A demonstration was put on to
>explain how it actually works. What I found out is very interesting and I am
>wondering if a chess program can be designed or with a little tweaking can take
>advantage of it.  As many of you know that hyper-threading takes advantage of
>the operating system by making the system think there are twice as many
>processor. So here is my explanation it’s a simpler way that explains the
>situation. System (A)  has 1 processor running task ... the cpu hands off the
>info to a register that executes that operation. So while the processor is
>waiting for the register to do its thing ... it’s losing valuable time by
>waiting. So with hyper-threading we throw in a second cpu, which basically
>performs the same task as the first cpu.  All seems great until you both cpu's
>are trying to send info to the same register. So then we get the big slow down
>with hyper-threading.  So how can we improve on that ??? Answer By having
>multi-tasking applications. So basically in our situation above .. the
>application is what needs to take advantage of hyper-threading ... that way both
>processor are busy ... one processor could be doing one part of the chess
>program and the other another part. So multithreading chess programs will have a
>problem and multi-tasking will see the speedup.
>
>Now what I am wondering is such a thing possible for a chess program?
>
>Can a program like crafty take some of its threads and do something else that
>doesn't use the same register's?
>

I am not sure what you mean by "same registers".  The hyper-threaded cpu has
two distinct sets of internal registers, one for each "thread".  In fact, it
has two of everything.  Flag registers.  Program counters.  Etc.  The point is
that while one "thread" is waiting on something (most common "something" is
"memory" which takes hundreds of cycles to read a word) the other thread can
run and keep the cpu busy, if it too doesn't "block" for something like a memory
read.




>Can a chess program take advantage of hyper-threading, by becoming more like a
>multitasking program that still uses multi-threads also ??


A multi-threaded program will already do this quite well.  The only problem
with Crafty (at the moment) is that "spinlocks" need a simple modification so
that the processor can determine which thread is doing useful work and which
is spinning on a lock waiting for the other to clear the lock.  Eugene has
already reported that this works pretty well.

Note that a SMT-enabled cpu looks like two cpus, but it will _not_ be as fast
as two cpus.  I have seen "best case" analysis suggesting that 1.5X is doable
for favorable applications.  Crafty seems to run about 1.3X faster in raw speed
on a SMT-enabled cpu, based on figures Eugene posted here and tests I ran on
a dual PIV/2.2ghz that I had linux on for a brief time...




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.