Page 1 of 1

Does LC0 get hardware advantage?

Posted: Fri Oct 05, 2018 7:38 am
by Uri Blass
I think that energy consumption or price is not the way to test if an hardware is faster.
Hardware advantage simply means that you can do with that hardware things faster.

Now my question is the following:

Suppose that you write a new engine to calculate exact value of perft(number of legal games with n plies from a specific position) or to solve mates(tell the user what is the distance to mate and give all solutions).

What is better hardware to do it faster GPU that lc0 use in CCCC or CPU that stockfish use there?

Re: Does LC0 get hardware advantage?

Posted: Fri Oct 05, 2018 8:25 am
by brianr
For perft it has already been done and it's not even close.
https://github.com/ankan-ban/perft_gpu

Of course, perft is only a small part of actual game performance.

Re: Does LC0 get hardware advantage? Truck vs Race Car

Posted: Fri Oct 05, 2018 9:31 am
by smatovic
If you count only FLOPS or MIPS then of course GPUs have an hardware advantage.
The question is, how to make use of this horse power for chess.

The GPU is more like a truck, and the CPU like a race car.
The truck can play out his advantage only with a certain amount of payload,
when massive parallel work has to be done.

An example for payload are the batch sizes used in LC0.

Ankan showed with his perft_gpu that GPUs can be used for 64 bit chess move
generation with incredible speeds.

My own experiments with Zeta as chess playing engine were less successful,
as soon as i add more complex code which relies on branches and syncs
i loose a lot of compute cycles.

So the challenge is still open, to create an classic chess engine that makes
use of the horse power the GPU offers, good luck.

--
Srdja

Re: Does LC0 get hardware advantage? Truck vs Race Car

Posted: Fri Oct 05, 2018 5:13 pm
by Uri Blass
smatovic wrote:
Fri Oct 05, 2018 9:31 am
If you count only FLOPS or MIPS then of course GPUs have an hardware advantage.
The question is, how to make use of this horse power for chess.

The GPU is more like a truck, and the CPU like a race car.
The truck can play out his advantage only with a certain amount of payload,
when massive parallel work has to be done.

An example for payload are the batch sizes used in LC0.

Ankan showed with his perft_gpu that GPUs can be used for 64 bit chess move
generation with incredible speeds.

My own experiments with Zeta as chess playing engine were less successful,
as soon as i add more complex code which relies on branches and syncs
i loose a lot of compute cycles.

So the challenge is still open, to create an classic chess engine that makes
use of the horse power the GPU offers, good luck.

--
Srdja
I think that for playing chess you can use massive parallel work otherwise cpu chess engines could not earn much from having many cores
so I wonder if it is not possible with gpu to emulate stockfish with many thousands of cores.

Re: Does LC0 get hardware advantage? Truck vs Race Car

Posted: Fri Oct 05, 2018 6:39 pm
by smatovic
Uri Blass wrote:
Fri Oct 05, 2018 5:13 pm

I think that for playing chess you can use massive parallel work otherwise cpu chess engines could not earn much from having many cores
so I wonder if it is not possible with gpu to emulate stockfish with many thousands of cores.
I tried to port my simple CPU engine Zeta Dva to OpenCL to run on a GPU,
with little success.

I tried various designs.

In the end i had the choice of running thousands of threads with ~10 Knps
each, or to couple 64 threads to one worker with up to ~100 Knps each and
hundreds of workers in total.

In both cases i was not able to outperform CPU engines,
but maybe some more skilled coder will find a solution.

--
Srdja

***edit***
here some numbers:

http://talkchess.com/forum3/viewtopic.php?f=7&t=63517

Re: Does LC0 get hardware advantage?

Posted: Fri Oct 05, 2018 7:38 pm
by Dann Corbit
I think that a far more interesting question than which type chess engine gets more NPS per MIP is which gets more Elo per dollar.
After all, that is the true goal.

Re: Does LC0 get hardware advantage?

Posted: Sat Oct 06, 2018 6:54 am
by megamau
Dann Corbit wrote:
Fri Oct 05, 2018 7:38 pm
I think that a far more interesting question than which type chess engine gets more NPS per MIP is which gets more Elo per dollar.
After all, that is the true goal.
You are completely correct !
Very few people care about what is "fair" for some shaky definition of "fair". Many people care what performance (elo) they can get for their effort (dollars).