Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: On Beowulf - long post (more info).

Author: Robert Hyatt

Date: 19:56:04 06/05/01

Go up one level in this thread


On June 05, 2001 at 19:58:38, Vincent Diepeveen wrote:

>On June 05, 2001 at 14:04:42, Robert Hyatt wrote:
>
>>On June 05, 2001 at 11:29:41, Vincent Diepeveen wrote:
>>
>>>On June 05, 2001 at 11:14:29, Robert Hyatt wrote:
>>>
>>>>>
>>>>>Now see what i get in beowulf. Instead of that in 2001 dudes program
>>>>>better they program things out FOR EVERY PIECE.
>>>>>
>>>>>Even blackpawns and whitepawns are written out.
>>>>>
>>>>>Man such a student i would directly ship back.
>>>>>
>>>>>   "Please make the code more general student, if you multiply a 2048 x 2048
>>>>>    array you don't write out every multiplication either!".
>>>>>
>>>>>See here below the horror which i found in moves.c from beowulf project.
>>>>>
>>>>>How do you plan to let people learn from this code?
>>>>>
>>>>>They must learn to "write everything out"??
>>>>>
>>>>>Please use a few for loops, even in bitboards you can do that,
>>>>>or have you forgotten how loops work?
>>>>
>>>>Depends on the purpose.  "unrolling" is a well-known way to speed up code.
>>>>Compact does not always equal fast.  Unrolling also eliminates some tests and
>>>>branches, which is also good.
>>>
>>>I know, where did you hear me talk about getting it faster this generator?
>>>
>>>Dann Corbitt said this project was setup to let people learn how to write
>>>their own chessprogram and to show how algorithms and implementing
>>>a chessprogram in a nice manner works.
>>>
>>>So my comment on this piece of code is that it's not written in a way
>>>where students learn from.
>>>
>>>They learn directly how to hack from this: "write everything out".
>>>
>>>In this piece of crap code i see everywhere:
>>>
>>>    if (side == WHITE)
>>>        tsq = B->WhiteKnights;
>>>    else
>>>        tsq = B->BlackKnights;
>>>
>>>Note you can eliminate these branches, which speeds code up bigtime.
>>
>>A decent compiler won't use a branch there _anyway_.  It will use a
>>conditional move.
>
>I'm no compiler expert, but it might not generate it,
>because it might not know that it's legal to access
>B->WhiteKnights as B could be NULL. That of course it could
>already deduce that B isn't NULL because it gets referenced anyway
>is a step which would surprise me if compilers take it :)
>
>Lucky we have some compiler experts here.
>
>Now when do i get a visual c++ compiler which can generate PIII code,
>mine only generates stupid 486 code which btw isn't having any
>CMOV instructions :)
>
>However those compilers that do generate a CMOV here still are
>slower as that 486 compiler. Don't ask me why. Just measure the
>speed diff :)
>
>>
>>>
>>>In a test to generate for white a few million of times a list of moves
>>>the branches will be correctly predicted, but normally spoken you get
>>>a big misprediction there as then you generate for white and next
>>>move for black, that hurts :)
>
>>Just don't do a branch.  :)
>
>>
>>>
>>>Apart from that it's very ugly to see code like that,
>>>i prefer more compact code to teach students and those who
>>>want to start their own program!
>>
>>What they see is what they will do.  I think it better to show how it
>>_should_ be done, as opposed to teaching bad habits by showing how it
>>could be done more concisely.
>
>I'm not here to reveal code of mine. All programs here get 2 times
>faster suddenly :)



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.