IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo module

topk_per_row

Top-k with a pick count per row, for the DeepSeek-V4 indexer.

Selection runs on the block-wide bitonic and histogram-select kernels in topk_bitonic, which pick all k elements together. The two-stage topk_gpu extracts one element per round, so at k = 512 it is a few hundred serial reductions per row. This file only supplies the output stage: a sink that turns each selected column into the (value, index) pair the graph op returns.

comptime values​

TOPK_PER_ROW_MAX_K​

comptime TOPK_PER_ROW_MAX_K = PERSISTENT_TOPK_MAX_N

Largest max_k topk_per_row_gpu accepts.

Functions​

Was this page helpful?