llama.cpp
019951ec - CUDA: one thread per row for soft_max and sum_rows on short rows (#33187)

Commit
23 hours ago
CUDA: one thread per row for soft_max and sum_rows on short rows (#33187) * CUDA: one thread per row for soft_max and sum_rows on short rows A row shorter than a warp left most of the block idle, and pooling the Hy4 flash indexer keys softmaxes and sums millions of rows of 4. With ncols <= 8 each thread now handles a whole row. On 3.4M rows of 4, soft_max goes from 1550 to 24 us and sum_rows from 1549 to 11 us. Hy4 flash decode goes from 66 to 87 t/s at 8k context, from 39 to 73 t/s at 32k and from 17 to 48 t/s at 107k. * CUDA: use fastdiv for the short row soft_max indices The one thread per row soft_max spent more time in its 64-bit row index divisions than on the row itself. On 3.4M rows of 4 without mask, soft_max goes from 23.9 to 18.2 us. * tests : cover a broadcast mask on the short row soft_max The short row cases only used a mask of the full shape, so the fastmodulo on the mask indices of dims 2 and 3 never ran on a broadcast mask.
Parents
Loading