vllm_omni.config.composable_parallel.spec ¶
Core declarative types for parallel-strategy specification.
A :class:StrategySpec declares one parallelism scheme: the mesh axis it sizes (kind + degree), how a batch is routed across that axis, and how per-worker results are aggregated back. A stack of specs (one per axis) fully describes a stage's parallel layout in a runtime-agnostic, data-only form that can be translated into concrete engine sizing.
The mesh-axis kinds below enumerate every parallelism dimension the contract can describe. Only a subset is wired end-to-end today (see translator.py):
- Wired (translatable now):
tp,dp,pp,ep,stage_replica. - Reserved (declared in the type system but not yet translatable — the translator raises
AxisTranslationErrorfor them):sp_ulysses,sp_ring,cfg,vae_pp,hsdp,stage_pp,cp.
Reserved kinds fail fast at translation time rather than silently doing nothing, so declaring one is an explicit "not yet" rather than a no-op.
HOOK_CATEGORY_ORDER module-attribute ¶
HOOK_CATEGORY_ORDER: dict[HookCategory, int] = {
"linear": 0,
"attention_pre": 1,
"attention_post": 2,
"ffn_pre": 3,
"ffn_post": 4,
"moe_dispatch": 5,
"other": 6,
}
HookCategory module-attribute ¶
HookCategory = Literal[
"linear",
"attention_pre",
"attention_post",
"ffn_pre",
"ffn_post",
"moe_dispatch",
"other",
]
MESH_AXIS_KINDS module-attribute ¶
MESH_AXIS_KINDS: tuple[str, ...] = tuple(
(k.value) for k in MeshAxisKind
)
KernelSpec dataclass ¶
L3 kernel slot referenced by StrategySpec; resolved by the kernel registry.
LayerHookSpec dataclass ¶
L2 hook slot referenced by StrategySpec; resolved by the model walker.
MeshAxisKind ¶
Enumerates every parallelism dimension the strategy contract can describe.
Subclassing str keeps existing string comparisons and dict keys working (MeshAxisKind.TP == "tp" and both hash the same), while making the type refactor-safe: a typo'd kind is an AttributeError on the enum rather than a silently-wrong bare string.
MeshAxisSpec dataclass ¶
Declares one axis of a process mesh (kind + size).
SpecMergeConflictError ¶
Bases: ValueError
Raised when merged hook/kernel specs have conflicting declarations.
StrategySpec dataclass ¶
Declarative contract for one parallelism scheme (data + hook/kernel slots).
layer_hook_specs class-attribute instance-attribute ¶
layer_hook_specs: tuple[LayerHookSpec, ...] = ()