For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
partition_work
def partition_work(task_id: Int, num_tasks: Int, work: Int, work_block_size: Int) -> IndexList[Int(2)]
Partitions work into blocks distributed across num_tasks tasks.
The work is first grouped into work_block_size-sized blocks for alignment
and load/store efficiency, then the blocks are split between tasks as
evenly as possible.
Args:
- βtask_id (
Int): The index of the task to compute the range for. - βnum_tasks (
Int): The total number of tasks sharing the work. - βwork (
Int): The total amount of work to partition. - βwork_block_size (
Int): The block size used to align the partitioning.
Returns:
IndexList[Int(2)]: A pair (offset, length) describing this task's work range.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!