llama.cpp
3090e45a - metal : reserve the top-k scratch only for short rows (#32942)

Commit
1 day ago
metal : reserve the top-k scratch only for short rows (#32942) The bitonic top-k path is only faster for short rows. On M5 and M2 Ultra it wins up to 128 columns; above that the radix path is faster. Use the radix path for ncols > 128. The radix path selects in place and needs no scratch, but the buffer type always reserved 2*4 bytes per source element, which is 8 GiB for a 524288 x 2048 score. Reserve the bitonic worst case at the 128-column threshold instead: 2*4*128*nrows, clamped to at least the output tensor size. This keeps the allocation bounded and consistent with the bitonic path. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB)
Author
Parents
Loading