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 function

filtered_topk_block

def filtered_topk_block[in_dtype: DType, RB: RowBound, so: MutOrigin, //, sig_bits: Int = _hsel_sig_bits[in_dtype](), poison: Int = Int(0)](in_scores: ImmPointer[Scalar[in_dtype], ImmutAnyOrigin], out_idxs: MutPointer[Int32, MutAnyOrigin], N: Int, K: Int, row_bounds: RB, fallback: MutPointer[UInt8, MutAnyOrigin], smem: MutPointer[UInt32, so, address_space=AddressSpace.SHARED], row: Int, tid: Int)

Selects one row with the filtered select, or flags it for the full one.

One CTA's work: tid is the thread in a block of _PTOPK_BLOCK, smem the CTA's FILTER_SMEM_BYTES of shared memory (8-byte aligned). Writes fallback[row], 1 when the row's bound did not hold and nothing else was written for it.

Parameters:

  • ​in_dtype (DType): Score dtype (inferred).
  • ​RB (RowBound): Row bound type (inferred).
  • ​so (MutOrigin): Origin of smem (inferred).
  • ​sig_bits (Int): Significant bits of a score's phi.
  • ​poison (Int): A planted fault (FILTER_POISONS), 0 for none.

Args:

Was this page helpful?