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
keyed_uniform
def keyed_uniform[target: StringSpan[ImmStaticOrigin]](output: TileTensor[.float32, Engine=output.Engine, address_space=output.address_space, linear_idx_type=output.linear_idx_type], seed: TileTensor[.uint64, Engine=seed.Engine, address_space=seed.address_space, linear_idx_type=seed.linear_idx_type], ctx: DeviceContext)
Draws one uniform value in [0, 1) per row, keyed off that row's seed.
random_uniform reads seed_ptr[0] and walks the flat element index as
the Philox counter, so one stream covers the whole tensor and a caller
cannot key a row independently of its neighbours. Here every row is its
own Philox key at counter 0: rows with equal seeds draw equal values, and
a row's draw never depends on how many rows share the launch or on where
it sits among them. Speculative decoding keys its accept coin per
(request, draft position) this way.
Parameters:
- βtarget (
StringSpan[ImmStaticOrigin]): The target to run on.
Args:
- βoutput (
TileTensor[.float32, Engine=output.Engine, address_space=output.address_space, linear_idx_type=output.linear_idx_type]): The drawn values, one per row. - βseed (
TileTensor[.uint64, Engine=seed.Engine, address_space=seed.address_space, linear_idx_type=seed.linear_idx_type]): The Philox seed for each row, one per output row. - βctx (
DeviceContext): The device context.
Raises:
Error: If the seed does not carry exactly one entry per output row.