...try and fail.
It is nearly impossible to implement a parallel LIFO stack on a GPU considering that threads inside a SIMD Unit are again divided into Warps/Wavefronts.
..fail and error.
fixed an bug and now i am able to distribute work by use of a LIFO Stack across threads within an SIMD Unit of a GPU.
But still don't have an idea how to handle AlphaBeta values, any suggestions?
Here is the LIFO scheme i use in pseudo code
Code: Select all
// while there are boards in stack do 0-n in parallel
while(board_stack_top > 0) {
// every process gets an index for computation
index = board_stack_top - process_id;
movecounter[process_id] = 0;
if (index > 0) {
board = board_stack[index-1];
moves[] = genMoves(board);
moves.sort;
movecounter[process_id] = moves.count;
// decrease top
atomic_decrease(board_stack_top);
}
// sync all processes in a SIMD Unit
SYNC;
// get index for stack copy
moveindex = board_stack_top;
for(i=0;i<process_id;i++) {
moveindex+= movecoutner[i];
}
// copy boards to shared stack
moves.each do |move, i| {
domove(board, move);
board_stack[moveindex+i] = board;
undomove(board, move);
}
// increase top
atomic_add(board_stack_top, moves.count);
// sync all processes in a SIMD Unit
SYNC;
}
Srdja