task_scheduling.task_manager#
TaskManager for the Task Scheduling (TS) framework.
Compile-time abstraction: The entire TS framework (TaskManager, Task, MemoryResource, pipeline acquire/release/commit) is traced away during DSL compilation. The resulting PTX is a single monolithic loop — identical to what a hand-coded bare-metal kernel would produce. There is NO runtime task dispatch and NO framework overhead in the generated GPU code.
TaskManager owns the full list of tasks and the resource dependency graph.
Construction prints the schedule table and runs validation checks. It then
provides two entry points called from the kernel:
setup_resources_and_tasks()- materialises and initializes pipelines and barriers for every resource (callsresource.create()).run()- executes all tasks (callstask.run()for each).
- class cutlass.experimental.task_scheduling.task_manager.TaskManager(
- tasks: List[Task],
- resource_dependency_graph: Dict[MemoryResource, List[MemoryResource]],
- dma_consumer_release_labels: Dict[Tuple[MemoryResource, MemoryResource], Set[str]] | None = None,
- skip_validation: bool = False,
- smem_allocator: SmemAllocator | None = None,
- tmem_allocator: TmemAllocator | None = None,
- tmem_ptr_i32: Any | None = None,
- verbose: bool = True,
- smem_capacity_bytes: int | None = None,
- tmem_capacity_columns: int | None = None,
- exhaustive_deadlock_race_check: bool = True,
- assume_pdl_wait_completed: bool = False,
Bases:
objectOrchestrates the execution of all tasks and their shared resources.
- resources#
De-duplicated union of every task’s
src_resourcesanddst_resources, preserving first-seen order.- Type:
List[MemoryResource]
Notes
Kernel entry points:
setup_resources_and_tasks()- materialises and initializes pipelines and barriers by callingresource.create()on each resource. Must be called once beforerun().run()- executes every task by callingtask.run(). Validation has already run during construction viaprint_and_verify().
- __init__(
- tasks: List[Task],
- resource_dependency_graph: Dict[MemoryResource, List[MemoryResource]],
- dma_consumer_release_labels: Dict[Tuple[MemoryResource, MemoryResource], Set[str]] | None = None,
- skip_validation: bool = False,
- smem_allocator: SmemAllocator | None = None,
- tmem_allocator: TmemAllocator | None = None,
- tmem_ptr_i32: Any | None = None,
- verbose: bool = True,
- smem_capacity_bytes: int | None = None,
- tmem_capacity_columns: int | None = None,
- exhaustive_deadlock_race_check: bool = True,
- assume_pdl_wait_completed: bool = False,
- Parameters:
tasks (List[Task]) – All tasks in execution order.
resource_dependency_graph (Dict[MemoryResource, List[MemoryResource]]) –
Explicit dataflow dependency graph. Each key is a downstream resource whose producer work depends on the consumer work of the upstream resources listed in the value.
For example, in a pipeline
GmemAb --> SmemAb --> TmemC --> GmemD:resource_dependency_graph = { smem_ab: [gmem_ab], tmem_c: [smem_ab], gmem_d: [tmem_c], }
The manager verifies that every declared edge
(upstream --> downstream)is backed by a task whosesrc_resourcescontain the upstream resource and whosedst_resourcescontain the downstream resource.dma_consumer_release_labels (Dict[Tuple[MemoryResource, MemoryResource], Set[str]], optional) – Edge-specific named consumer-release labels for DMA ordering validation. Use this when one upstream resource feeds multiple downstream DMA producers through different named consumer work functions. Keys are
(upstream, downstream)resource pairs.skip_validation (bool, optional) – When
True, verification checks still run but failures are emitted as warnings instead of raising exceptions. Use this when domains are runtime values (not Pythonint), since the deadlock simulation falls back todomain=1and may report false-positive deadlocks. For accurate verification, prefer validate-only mode with realisticintdomains. Default False.smem_allocator (cutlass.experimental.task_scheduling.memory.SmemAllocator or None, optional) – Unified SMEM allocator with pre-computed layout. When set,
setup_resources_and_tasks()callssmem_allocator.allocate()and the resultingsmem_baseis threaded throughResourceContext/StageInfoto all resources.tmem_allocator (cutlass.experimental.task_scheduling.memory.TmemAllocator or None, optional) – TMEM column allocator with pre-computed layout. When set, a usage report is printed during
print_and_verify().tmem_ptr_i32 (array or None, optional) – Shared-memory
Int32scalar written bynvvm.tcgen05_alloc. When set, it is included in theResourceContextso resources can derive TMEM addresses.verbose (bool, optional) – When
False, suppresses informational output (schedule tables, register budgets, aliasing notes). Errors and warnings are always emitted. DefaultTrue.smem_capacity_bytes (int or None, optional) – Maximum SMEM bytes per CTA (data + barriers). When
None, defaults to(228 − 1) × 1024 = 232448 B(SM100/SM90). Override for other architectures.tmem_capacity_columns (int or None, optional) – Maximum TMEM columns per SM. When
None, defaults to512(SM100). Override for other architectures.exhaustive_deadlock_race_check (bool, optional) – When
True, run the exhaustive BFS interleaving checker (check_all_interleavings) that explores all valid schedule interleavings to detect deadlocks, aliasing race conditions, and PDL launch-before-wait ordering violations. Significantly more expensive than the structural checks. PassFalseto opt out for performance-sensitive paths (e.g. FMHA). DefaultTrue.assume_pdl_wait_completed (bool, optional) – Treat PDL wait as already executed before the TS schedule. This is for kernels that emit
griddepcontrol.waitbefore a PDL-dependent access that happens outside TS.
- property smem_allocator: SmemAllocator | None#
The SMEM allocator (if configured).
- print_and_verify() None#
Print the full schedule table and run all verification checks.
When
skip_validation=Truewas passed to the constructor, each check still runs but failures are emitted as warnings instead of raising.False-positive caveat: when task
domainordomain_startis a runtime value (not a Pythonint), the deadlock simulation falls back todomain=1anddomain_start=0. This can produce false-positive deadlock reports for schedules that require more iterations to balance (e.g.domain_start > 0). For accurate verification, use validate-only mode with realistic Pythonintdomains anddomain_start.
- setup_resources_and_tasks() None#
Materialise and initialize pipelines and barriers for every resource.
When an
SmemAllocatoris configured, emits a singlecutlass.Array(..., space=cutlass.AddressSpace.smem)for all declared data SMEM and stores the base pointer for later use byrun().Then calls
resource.create()on each unique resource (allocates SMEM mbarriers, instantiates the pipeline object, initializes barriers). Must be called exactly once beforerun().This is a plain Python method (not
@cute.jit) so that_is_setupis assigned at Python level and never auto-promoted to a staged Boolean by the DSL tracer.
- run() None#
Execute all tasks.
Each
task.run()call gates on the current warp index, so every warp enters this method but only the warps assigned to a given task execute its schedule body.When an
SmemAllocatorortmem_ptr_i32is configured, builds aResourceContextand passes it to every task’sinit_variablesandrun_body.This is a plain Python method (not
@cute.jit) so that the_is_setupassertion runs at Python level against a plain bool, avoiding staged-Boolean and early-exit issues.- Raises:
AssertionError – If
setup_resources_and_tasks()has not been called.