For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo module
topk_fi
Implements a float-integer packed top-K kernel that jointly tracks values and indices in a single register.
Structsβ
- β
ValueCount: A struct that holds a value and a count, used for block reductions.
Functionsβ
- β
apply_min_p_mask_kernel: Zero out probabilities below the per-row min_p threshold. - β
device_sampling_from_prob: Device-level sampling from probability distribution with atomic operations. - β
get_min_max_value: Compute the minimum and maximum values from input data using block reduction. - β
topk_mask_logits: Masks logits to keep only the top-k largest values per row. - β
topk_sampling_from_prob: Top-K sampling from probability distribution. - β
topk_softmax_sample: Samples token indices from top-K logits using softmax probabilities. - β
topk_softmax_sample_kernel: Samples a token index from the top-k logits using softmax probabilities in a single kernel. - β
topk_topp_sampling_from_prob: Joint top-k + top-p sampling from probability distribution. - β
TopKMaskLogitsKernel: Masks logits to retain only the top-k values per row, setting the rest to negative infinity. - β
TopKSamplingFromProbKernel: Kernel for top-k sampling from probability distribution. - β
TopKTopPSamplingFromProbKernel: Kernel for joint top-k + top-p sampling from probability distribution.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!