tilelang.language.ws_schedule¶
Typed warp-specialization schedule objects.
A WSSchedule is the complete description of how to transform a
straight-line kernel into a warp-specialized one. It is built inside the
kernel (after buffer allocations, so pipelines can reference the buffers
directly), attached with T.annotate_ws_schedule, and consumed by the
MaterializeWSSchedule pass.
Classes¶
Pipeline synchronization kind. |
|
A contiguous warp range with a single duty. |
|
A full/empty mbarrier pair protecting multi-versioned buffers. |
|
Base class of one step in a role's program. |
|
Reference to a tile op or child scope by its stable |
|
A pipeline synchronization point. |
|
A loop (or the root scope) with per-role instruction lists. |
|
The complete warp-specialization schedule of one kernel. |
Module Contents¶
- class tilelang.language.ws_schedule.WSSyncKind¶
Bases:
tvm_ffi.dataclasses.EnumPipeline synchronization kind.
The producer waits for the empty barrier (ACQUIRE) and signals the full barrier (COMMIT); the consumer waits for the full barrier (WAIT) and signals the empty barrier (RELEASE).
- PRODUCER_ACQUIRE: ClassVar[WSSyncKind]¶
- PRODUCER_COMMIT: ClassVar[WSSyncKind]¶
- CONSUMER_WAIT: ClassVar[WSSyncKind]¶
- CONSUMER_RELEASE: ClassVar[WSSyncKind]¶
- class tilelang.language.ws_schedule.WSRole(name, *, warps_lo, warps_hi, max_nreg=0)¶
Bases:
tvm.ir.NodeA contiguous warp range with a single duty.
- Parameters:
name (str) – Role name; keys the per-role bodies of every scope.
warps_lo (int) – First warp of the role’s range.
warps_hi (int) – One past the last warp: the role covers warps lo..hi-1.
max_nreg (int) – setmaxnreg budget for the role’s warps; 0 leaves registers untouched.
- class tilelang.language.ws_schedule.WSPipeline(name, buffers, depth)¶
Bases:
tvm.ir.NodeA full/empty mbarrier pair protecting multi-versioned buffers.
The producer waits for the empty barrier and signals the full barrier; the consumer waits for the full barrier and signals the empty barrier.
depthis the number of buffer versions; multiple buffers can share one pipeline.- Parameters:
name (str) – Pipeline name; referenced by
WSSyncinstructions.buffers (list[tirx.Buffer]) – The on-chip buffers this pipeline protects (and multi-versions).
depth (int) – The number of versions of each buffer.
- class tilelang.language.ws_schedule.WSInstr¶
Bases:
tvm.ir.NodeBase class of one step in a role’s program.
- class tilelang.language.ws_schedule.WSOpRef(id)¶
Bases:
WSInstrReference to a tile op or child scope by its stable
tl.ws_op_id.- Parameters:
id (str)
- class tilelang.language.ws_schedule.WSSync(kind, pipeline, stage=0)¶
Bases:
WSInstrA pipeline synchronization point.
Prefer the classmethod constructors:
WSSync.producer_acquire("smem", stage=0) WSSync.producer_commit("smem", stage=0) WSSync.consumer_wait("smem", stage=num_stages - 1) WSSync.consumer_release("smem", stage=num_stages - 1)
Within one role’s scope body, acquire/commit (and wait/release) of a pipeline must pair up at the same stage; entries between them execute at that stage’s iteration offset.
- Parameters:
kind (WSSyncKind)
pipeline (str)
stage (int)
- classmethod producer_acquire(pipeline, stage=0)¶
Wait for the empty barrier; binds the stage’s buffer versions.
- Parameters:
pipeline (str)
stage (int)
- Return type:
- classmethod producer_commit(pipeline, stage=0)¶
Signal the full barrier; ends the producer’s span.
- Parameters:
pipeline (str)
stage (int)
- Return type:
- classmethod consumer_wait(pipeline, stage=0)¶
Wait for the full barrier; binds the stage’s buffer versions.
- Parameters:
pipeline (str)
stage (int)
- Return type:
- class tilelang.language.ws_schedule.WSScope(id, bodies)¶
Bases:
tvm.ir.NodeA loop (or the root scope) with per-role instruction lists.
- Parameters:
id (str) – The
tl.ws_op_idof the loop this scope schedules, orWSScope.ROOTfor the kernel’s implicit root scope.bodies (dict[str, list[WSInstr | str]]) – Role name -> instruction sequence. Plain strings are shorthand for
WSOpRef.
- ROOT = 'tl.ws_scope_root'¶
The id of the kernel’s implicit root scope.
- class tilelang.language.ws_schedule.WSSchedule(num_warps, roles, pipelines, scopes)¶
Bases:
tvm.ir.NodeThe complete warp-specialization schedule of one kernel.
- Parameters:
num_warps (int) – Total warp count; overrides the kernel’s thread extent.
roles (list[WSRole])
pipelines (list[WSPipeline])
scopes (list[WSScope])