Skip to main content

build_program_priority

Function build_program_priority 

Source
pub fn build_program_priority(
    workgroup_size_x: u32,
    opcodes: &[OpcodeHandler],
) -> Program
Expand description

Build a priority-aware megakernel IR.

Unlike build_program_sharded where each lane owns exactly one slot, the priority variant has workers scan across priority-partitioned ring regions, claiming the highest-priority PUBLISHED slot available. This ensures latency-sensitive work (CRITICAL, HIGH) is processed before background tasks (LOW, IDLE).

The control buffer is extended with PRIORITY_OFFSETS_BASE..+6 words that the host sets to define partition boundaries. The host can dynamically resize partitions by updating these offsets between batches.