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 trait

TopkSink

Where a top-k kernel writes each selected column.

The kernels hand every output slot to store, -1 padding included, so a sink can derive more than one output from a selection in the same pass.

Implemented traits​

AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassable

Required methods​

store​

def store(self, idx: Int, col: Int32)

Writes output slot idx of the flat [rows, K] output.

Args:

  • ​idx (Int): Flat output slot, row * K + rank.
  • ​col (Int32): Selected column, or -1 for a padding slot.

Was this page helpful?