mstar.engine.resources.kv.config#
What a model declares about a KV cache: its shape, its spec, its step.
Kept free of the manager and its kernels so a submodule can declare a step without pulling FlashInfer in behind it.
Classes
|
|
|
|
|
|
|
|
|
- class mstar.engine.resources.kv.config.KVConfig(num_layers: int, num_kv_heads: int, head_dim: int, max_seq_len: int, max_num_pages: int = 2048, page_size: int = 128, num_qo_heads: int = None, layout: mstar.engine.resources.kv.config.KVLayout = <KVLayout.NHD: 'NHD'>, cpu_offload_pages: int = 0)[source]#
Bases:
object- Parameters:
- shard(num_shards)[source]#
Narrow the head counts to one rank’s slice.
Idempotent because one KVConfig is shared by the KV resource and the attention resources planned against it, and each shards on construction.
num_shardsis the instance world size (tp * sp): Ulysses SP all-to-alls heads, so attention runs at head-degree tp*sp.- Parameters:
num_shards (int)
- Return type:
None
- class mstar.engine.resources.kv.config.KVReqConfig(needed_labels: list[str] | None = None, needed_labels_per_node: dict[str, list[str]] = <factory>, needed_labels_per_node_walk: dict[tuple[str, str], list[str]] = <factory>)[source]#
Bases:
ResourceReqConfig- Parameters:
- class mstar.engine.resources.kv.config.KVSpec(resource_key: str, nodes: set[str], config: mstar.engine.resources.kv.config.KVConfig)[source]#
Bases:
NodeResourceSpec
- class mstar.engine.resources.kv.config.KVStep(segments: tuple[mstar.engine.resources.step.Segment, ...] | None = None, commit: bool = True, combined_labels: dict[tuple[str, ...], str] = <factory>, pre_forks: tuple[tuple[str, str], ...] = (), post_forks: tuple[tuple[str, str], ...] = ())[source]#
Bases:
ResourceStep- Parameters: