vllm.distributed.kv_transfer.kv_connector.v1.ssm_conv_transfer_utils ¶
Mamba conv-state sub-projection decomposition for the 3-read transfer.
With DS conv state layout (dim, state_len), sub-projections are contiguous in memory. Each D rank reads its slices via 3 separate RDMA transfers — no P-side permutation needed.
Supported model types
- Mamba2: conv = [x, B, C], temporal = (num_heads, head_dim)
- GDN (Gated Delta Net): conv = [Q, K, V] (dim(Q)==dim(K)), temporal = (num_v_heads, v_dim, k_dim)
MambaConvSplitInfo dataclass ¶
Per-rank byte sizes of the 3 conv sub-projections.
Used by both P and D sides for NIXL descriptor registration. All fields are LOCAL to this engine's TP (already divided by TP size).
DS memory layout within one page (contiguous): Mamba2: |-- x --|- B -|- C -| (B == C) GDN: |- Q -|- K -|-- V --| (dim(Q)==dim(K), V may differ)
Source code in vllm/distributed/kv_transfer/kv_connector/v1/ssm_conv_transfer_utils.py
local_conv_offsets property ¶
(byte_offset, byte_size) of each sub-projection within this engine's page.
Used by both P and D for local descriptor registration.
proj_bytes property ¶
Byte sizes of the 3 sub-projections for one rank.
remote_conv_offsets ¶
(byte_offset, byte_size) of this D rank's sub-projection slices within one P page.
Used by D side only, during remote descriptor registration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local_rank_offset | int | which slice this D rank reads. | required |
tp_ratio | int | signed TP ratio.
| required |
Source code in vllm/distributed/kv_transfer/kv_connector/v1/ssm_conv_transfer_utils.py
compute_physical_blocks_per_logical ¶
Derive _physical_blocks_per_logical_kv_block from remote metadata.
The remote engine's ratio is not sent directly in the handshake, so we reconstruct it: total mamba state per logical block / block_len.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ssm_sizes | tuple[int, ...] | (conv_state_bytes, ssm_state_bytes) from NixlAgentMetadata. | required |
block_len | int | the engine's block_len in bytes (from block_lens[0]). | required |
Source code in vllm/distributed/kv_transfer/kv_connector/v1/ssm_conv_transfer_utils.py
derive_mamba_conv_split ¶
derive_mamba_conv_split(
mamba_spec: MambaSpec, local_tp: int
) -> MambaConvSplitInfo
Derive per-rank sub-projection byte sizes from a MambaSpec.
Called once at init on both P and D. Decomposes the conv dimension into its sub-projection parts based on the model type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mamba_spec | MambaSpec | MambaSpec whose shapes are: shapes[0] = conv state: (conv_dim_local, conv_rows) in DS layout. shapes[1] = temporal state (model-specific shape). | required |
local_tp | int | this engine's tensor-parallel size. | required |
Returns:
| Type | Description |
|---|---|
MambaConvSplitInfo | MambaConvSplitInfo with per-rank sub-projection dims, conv_rows, |
MambaConvSplitInfo | conv_dtype_size, and ssm_sizes (conv_state_bytes, ssm_state_bytes). |
Source code in vllm/distributed/kv_transfer/kv_connector/v1/ssm_conv_transfer_utils.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |