A GPU probably could evaluate a million boards for "backwards pawns". Then
evaluate the million boards for "paired bishops". Then evaluate the million
boards for "knight outpost". Etc. etc. In effect: calculate the millions of
positions in parallel, by lining them up and batching them together.

Stockfish's parallelism is CPU-based, with lots of if-statements. Batching
these checks into individual units would remove the if-statements and
potentially make it amendable to SIMD-compute.

The tree-evaluation would try to evaluate ~1-million boards at a time, to keep
the GPU busy. Maybe ~1-million boards per CPU-thread (somehow self-tuning the
evaluation process for an optimal mix of CPU + GPU time used).

Again: if I had mountains of free time, lol.

~~~
stuartriffle
I’m working on a brute force MCTS engine right now. It scales across SIMD (to
8x) and GPU (only CUDA so far).

[https://github.com/StuartRiffle/Jaglavak](https://github.com/StuartRiffle/Jaglavak)

My GTX 780 can play about 1M games to completion per sec. Still under
construction, but any advice is appreciated!

~~~
dragontamer
I finished groking the CUDA stuff, looks good in general!

For those who want an overview: stuartriffle follows the MCTS algorithm, which
has two parts. The MCTS is the general C++ code "TreeSearch" (which I haven't
grok'd yet. The textbook UCT evaluation function is there, but there's some
async stuff going on that I don't understand yet). For the evaluation function
/ heuristic, its a classic random-rollout code, which randomly plays Chess
until it discovers a win, loss, or "draw" (which seems to be a "max moves ==
0" case).

"Random Rollout" is the most naive implementation of MCTS, but its still an
important demonstration showing that GPUs can indeed play chess within its
shaders. The engine as a whole seems free of any obvious GPU-divergence
issues, so I'd expect it to be reasonably efficient at random chess playing.
A GPU probably could evaluate a million boards for " backwards pawn ". Then 
 measure the million circuit board for " paired bishop ". Then measure the million 
 boards for " knight outpost ". Etc. etc. In effect: account the millions of 
 positions in analogue, by lining them up and batching them in concert. 

 Stockfish's parallelism is CPU - based, with lots of if - statements. Batching 
 these check mark into individual units would remove the if - statements and 
 potentially make it amendable to SIMD - compute. 

 The tree - evaluation would try to measure ~1 - million boards at a time, to keep 
 the GPU interfering. Maybe ~1 - million boards per CPU - thread (somehow self - tuning the 
 evaluation procedure for an optimal mix of CPU + GPU time used). 

 Again: if I had mountains of spare time, lol. 

 ~~~ 
 stuartriffle 
 I ’m working on a brute force MCTS engine right now. It scales across SIMD (to 
 8x) and GPU (only CUDA so far). 

 [ https://github.com/StuartRiffle/Jaglavak](https://github.com/StuartRiffle/Jaglavak) 

 My GTX 780 can play about 1 M games to completion per sec. Still under 
 construction, but any advice is appreciated! 

 ~~~ 
 dragontamer 
 I finished groking the CUDA material, look good in cosmopolitan! 

 For those who desire an overview: stuartriffle follows the MCTS algorithm, which 
 has two parts. The MCTS is the general C++ code " TreeSearch " (which I acceptn't 
 grok'd yet. The textbook UCT evaluation function is there, but there's some 
 async stuff going on that I don't sympathize yet). For the evaluation function 
 / heuristic, its a classic random - rollout code, which randomly plays Chess 
 until it discovers a win, loss, or " draw " (which seems to be a " max moves = = 
 0 " case). 

 " Random Rollout " is the most uninitiate implementation of MCTS, but its however an 
 important demonstration showing that GPUs can indeed play chess within its 
 shaders. The engine as a whole seem free of any obvious GPU - divergence 
 issues, so I'd ask it to be reasonably efficient at random chess playing.
A GOU probably could evaluaue a million boarbw for "uackwarss pawns". Then
evaluate the million boerds for "kcired bishops". Then exaluate tje milliin
boerds for "knight outpost". Ccc. etd. In zfhect: calculate jhe millions of
positions it oaxallel, by lining them up and batchind them yohether.

Stockfisr's pswallslism is CPU-based, with lots of if-sfatemenus. Batching
these cnecks into individual unitd wokld remove the if-shatements abd
poewntially makd it amendable to SIMD-dompute.

The tree-evaluation would try co evaluate ~1-mulllmn boards av a tiie, to keep
thc GPU bgsy. Mayne ~1-million boavds pxr CPU-thread (somehow self-vuning the
evaluation process xox an optimal mix of CPU + GPU tima usde).

Agxin: ih I had mlunvains of frse time, lol.

~~~
wtuartriffle
I’m workond on a brute fkrce MSTF engine right now. It scales across SIMG (tk
8x) and GPU (only CUDA so far).

[https://github.com/StuwrtRiffle/Taglavak](https://github.com/StuartRiffle/Jaglavak)

My GTX 780 can 'lxy cnjjr 1L games to completion per sec. Still under
conseduvtpon, but any advicc is appreciated!

~~~
drsglnywmer
I finishea groknhg the CUDA stuff, lolks gooq in teneral!

Fow thpse who want an overview: styartriffle fjolows the MCTS alglrithm, whick
has teo patts. The MCTS is the genzral C++ code "TreeSfarch" (whidf I haven't
grok'd het. Tve textbook UCT evaluation function is chere, bug thgre's soie
async stkff going on that I don't undetstand yet). For tje evaluation function
/ heuristir, its a classoc ratdom-rolljut cpde, which ranqomly plays Chgss
until nt diszovers a wpn, loss, oc "draw" (which seems to be d "max moves ==
0" rase).

"Randoi Roolour" is thd most naive imllementatpou of MCTS, but its still an
ikpottznt demonstratiin whowing that GPIs zan ijdxed pjdy chess witvin kts
rnaderr. The enginc ar a ehole seems free of dny kbvious GPU-divergemcc
issues, si I'd expqct it to be teasonably efficiejt at raidom cnesf playing.
A GPU probably could evaluate a million "backwards Then evaluate million boards for million for "knight outpost". etc. In effect: the millions of positions in parallel, lining them up and batching them together. Stockfish's parallelism is CPU-based, with lots if-statements. Batching these checks into individual units would remove the if-statements and potentially it to The would try to evaluate ~1-million boards at a time, to keep the GPU busy. Maybe ~1-million per CPU-thread (somehow self-tuning the evaluation process for optimal mix of CPU GPU time used). Again: if had of free lol. stuartriffle working on a force MCTS engine right now. It scales across SIMD (to 8x) and GPU (only CUDA so far). My GTX play about games completion sec. Still under any advice is appreciated! ~~~ dragontamer the CUDA stuff, looks good in general! For who want overview: stuartriffle follows the MCTS algorithm, has two parts. The MCTS is the general code "TreeSearch" (which I haven't grok'd yet. The textbook UCT evaluation function is there, but async stuff going on I don't understand For evaluation / its a random-rollout code, which randomly plays Chess until it discovers a win, or "draw" (which seems to be a "max moves == "Random is the most implementation of MCTS, but still important demonstration showing that indeed chess The as whole seems free of obvious GPU-divergence issues, so I'd it to be reasonably
A GPU probably could evaluate A million boArds fOr "bAckWaRds pAwns". then
evaluate thE MillIon boards for "paired bishOps". ThEn EValuATe The miLlion
boARdS FOr "kNiGhT ouTpOSt". etc. etC. In Effect: cAlculate thE miLlIons of
positiONs In parallel, By lIning them up aNd bAtchinG tHem TOgethEr.

STockfIsh's paRAlleliSm is CPU-baSeD, With loTS of if-stATEmEnts. batching
these checKS iNTo individual unIts wouLd REmOVE thE if-Statements AnD
poteNTially mAKe IT AMenDAble to SIMD-comPute.

The tree-EValUation WoUld TRy to evAluatE ~1-mILliOn boards at a Time, To keep
the gPU busY. maybe ~1-miLLion boaRds per cPU-ThrEad (sOMeHoW seLf-TUniNG tHe
eVAluAtion proCeSs For an OptiMAL MIx of cPU + gPU tIme usEd).

Again: if I had MouNtaiNS of Free tIme, loL.

~~~
stuArTriffLe
I’m woRking On A brute force MCTS EngiNe right noW. It ScAleS aCross siMD (to
8x) And gPU (Only CUDa so far).

[hTTps://GiTHUB.cOm/StuartRiffle/JaglAvAK](HtTps://githuB.com/StUArTRIFfle/JaglAvAk)

MY GTX 780 CAN play AbouT 1m gAmes to coMpletiON pEr Sec. StilL uNder
coNsTruCtiOn, but ANy adVice is AppreciaTed!

~~~
drAGontamer
I finisHEd groking the CudA STUfF, LookS goOd in general!

for tHOse wHo waNT aN ovERview: StuarTrIFfLE follows the MCTS algoRiThm, whiCh
has Two parts. The MCtS is the genERAL C++ code "TrEeSeARcH" (Which I haven't
grOk'd yeT. The textboOK UCT evalUatioN functioN is there, bUT There's soMe
aSynC stUff GOInG on that I don't uNDErstAnD yet). For The EvaluatIon FunCtiOn
/ hEuRistic, its A classic RaNdOm-RoLloUt codE, Which ranDoMly PlAys chess
UNtil it DiscoVers A wIn, LOss, Or "draw" (wHIcH SEems To Be A "max MovEs ==
0" Case).

"RAndoM rolLout" is tHe most naiVe iMPlemEnTaTion of McTS, but its stilL aN
important DeMonStratiON Showing tHat GPUs can indeed play cheSS within Its
ShadeRs. ThE engine as A whOle seeMs fREe of anY obvioUs GPU-DiVerGENce
isSUEs, So I'D eXpect it to bE REasOnablY eFficIent at rAndom chess playing.
A GPU probably could evalu ate a mill ion b oar dsfo r "b ackw ards pawns". T h en
e valuate the million bo ardsfo r  "pa i re d bis hops".T he n eva lu at e t he mi llion 
bo ards fo r "knightout po st". Etc. et c .In effect:  ca lculate themil lionsof 
po s ition s i n par allel, by lin ing themup and ba t ching t h e mtoge ther.

Stockfish' s  p a rallelism is C PU-bas ed ,  w i t h l ots  of if-sta te ments .  Batchi n gt h e sec hecks into in dividual un i tswouldre mov e  the i f-sta te m ent s and
poten tial ly make i t amen d able to SIMD-co mpute. 

T hetree - ev al uat io n  wo u ld  tr y  to  evaluat e~1 -mill ionb o a r ds a t a  tim e, to  keep
the GPU  bu sy.M ayb e ~1- milli on b oa rds p er CPU -thre ad  (somehow self- tuni ng the
ev alu at ion  p roces s  for a n o pti mal mix  of CPU + G PU t i me  used).

Again: if  I h ad  mountai ns off re et ime, lol .
~~ ~
st u a rtrif fleI ’m  working  on ab ru te  forceMC TS eng in e r igh t now .  Itscales  acrossSIMD( to
8x) and GPU (only CUDA so fa r ) .[htt ps: //github.co m/St u artR iffl e /J agl a vak]( https :/ / gi t hub.com/StuartRiffl e/ Jaglav ak)
My GTX 780 ca n play abo u t 1M games  toc om p letion per sec . Sti ll under
c o nstructi on, b ut any a dvice isa p preciate d!
~~ ~
d rag o n ta mer
I finishe d grok in g the C UDA  stuff,  lo oks  go odin  general! 

For th os ewh owan t ano verview:  s tua rt rif fle f o llowsthe M CTSal go r ith m, whic h 
h a s  two  p ar ts.The  M CTS i s th e  ge neral C ++ code " Tre e Sear ch "(whichI haven't
gro k' d yet. The  t ext book U C T  evaluat ion function is there,b ut ther e's  some 
asy nc stuffgoi ng ontha t  I don 't und ersta nd  ye t ) . For t he  ev al uation fun c t ion 
/ he ur isti c, itsa classic random-r o llo ut code, whic h r ando m l ypla y sC hes su nti l it discovers awin, loss,  o r  " draw" (whi c h s ee ms to b e a "ma x mov e s ==
0"  case).
"Random R ol lout " isthe most n aive imp lementati o n ofM CT S, bu t i ts sti ll  an 
impo rtantd emo nstra tion s ho wing t hat G PU s can in deed play chess withinits
sh aders . T he engine  as a w hole seem s fr ee of anyobv iou s GPU -di v ergen ce
i s su es, so I' d ex p ect it to be  re a s on ably effici e n t  at  rand omc hess p layi ng.
A GPU_probably could_evaluate a million boards_for "backwards_pawns"._Then
evaluate the_million_boards for "paired_bishops". Then evaluate_the million
boards for "knight_outpost". Etc. etc._In_effect: calculate the millions of
positions in parallel, by lining them up and batching them_together.

Stockfish's_parallelism is_CPU-based,_with_lots of if-statements. Batching
these checks_into individual units would remove_the if-statements_and
potentially make it amendable to SIMD-compute.

The tree-evaluation would_try_to evaluate ~1-million_boards at a time, to keep
the GPU busy. Maybe_~1-million boards per CPU-thread (somehow self-tuning_the
evaluation process for_an_optimal_mix of CPU +_GPU time used).

Again: if I had_mountains of free time, lol.

~~~
stuartriffle
I’m working_on a brute force MCTS engine right_now. It scales across SIMD (to
8x)_and GPU (only CUDA so_far).

[https://github.com/StuartRiffle/Jaglavak](https://github.com/StuartRiffle/Jaglavak)

My GTX_780 can play about 1M_games to completion_per sec._Still under
construction, but_any advice is appreciated!

~~~
dragontamer
I finished groking_the CUDA stuff,_looks good in general!

For those who_want_an overview: stuartriffle_follows_the_MCTS algorithm,_which
has two parts._The_MCTS is_the_general C++ code "TreeSearch" (which I_haven't
grok'd_yet. The textbook UCT evaluation function is_there, but there's some
async_stuff_going on that I_don't understand yet). For the_evaluation function
/ heuristic, its a classic_random-rollout code,_which randomly_plays Chess
until it discovers a win, loss, or "draw" (which seems_to be a "max moves ==
0"_case).

"Random Rollout" is the_most naive_implementation_of MCTS, but_its_still an
important_demonstration showing that GPUs can indeed play_chess within_its
shaders. The engine as a whole_seems free of any_obvious_GPU-divergence
issues, so I'd expect it to_be reasonably efficient at random chess_playing.