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 function
filtered_topk_launch
def filtered_topk_launch[in_dtype: DType, RB: RowBound, //, poison: Int = Int(0)](ctx: DeviceContext, in_scores: ImmPointer[Scalar[in_dtype], ImmutAnyOrigin], out_idxs: MutPointer[Int32, MutAnyOrigin], N: Int, K: Int, rows: Int, row_bounds: RB, fallback: MutPointer[UInt8, MutAnyOrigin])
Runs the filtered select's two launches, with the caller's flags.
Every row takes the filtered launch; the rows it flags in fallback
([rows] bytes) take the full select in the second. Callers go through
filtered_topk_block_split, which decides when this pays; tests call it
directly to read the flags.
Parameters:
- in_dtype (
DType): Score dtype (inferred). - RB (
RowBound): Row bound type (inferred). - poison (
Int): A planted fault (FILTER_POISONS), 0 for none.
Args:
- ctx (
DeviceContext): Device context. - in_scores (
ImmPointer[Scalar[in_dtype], ImmutAnyOrigin]): Row-major scores[rows, N], 16-byte aligned rows. - out_idxs (
MutPointer[Int32, MutAnyOrigin]): Row-major output[rows, K]. - N (
Int): Score columns per row, the row stride. - K (
Int): Columns selected per row, at mostPERSISTENT_TOPK_MAX_N. - rows (
Int): Score rows. - row_bounds (
RB): Per-row live column counts and output sinks. - fallback (
MutPointer[UInt8, MutAnyOrigin]): One flag per row, written by the first launch.