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
merge_sort_recursive
def merge_sort_recursive[dtype: DType, out_idx_type: DType](mut buf_keys: TileTensor[dtype, Engine=buf_keys.Engine, address_space=buf_keys.address_space, linear_idx_type=buf_keys.linear_idx_type], mut buf_ids: TileTensor[out_idx_type, Engine=buf_ids.Engine, address_space=buf_ids.address_space, linear_idx_type=buf_ids.linear_idx_type], start: Int, end: Int)
Recursive merge sort implementation.
Parameters:
- dtype (
DType): Element type ofbuf_keys(inferred). - out_idx_type (
DType): Element type ofbuf_ids(inferred).
Args:
- buf_keys (
TileTensor[dtype, Engine=buf_keys.Engine, address_space=buf_keys.address_space, linear_idx_type=buf_keys.linear_idx_type]): Rank-2 keys sorted in place in descending order, one row per batch. - buf_ids (
TileTensor[out_idx_type, Engine=buf_ids.Engine, address_space=buf_ids.address_space, linear_idx_type=buf_ids.linear_idx_type]): Rank-2 indices carried alongsidebuf_keysso each key retains its original position. - start (
Int): Inclusive start index of the contiguous range to sort within the flattened buffer. - end (
Int): Exclusive end index of the contiguous range to sort within the flattened buffer.