vllm.models.kimi_k3.nvidia.specialized_decode.cutedsl.mla.prepared
¶
Prepared MLA core: the packed input projection feeds the query kernel, then either
tokenspeed_mla_decode (core "tokenspeed") or the KV-balanced decode at tokenspeed's
precision (core "balanced", see mla.balanced) into the BF16 latent, and
MlaValue (W_UV / gate). Under DCP (dcp: a DcpBox) the tokenspeed core
runs over the local KV shard for every DCP rank's heads between the query's q
publication and DcpValue's merge (see mla.dcp). Spec verify: q query tokens
per request (rows grouped by request, causal among them).
Classes:
-
PreparedMla–max_context(the deployment's longest sequence) bounds the split count.
Functions:
-
compile_core–CuTe kernels (query, value) of one batch of rows (
qper request); under DCP -
core_for–coreunless "auto": the balanced core for spec verify (q > 1) and from -
pad_requests–Request metadata for
batchrows: PIECEWISE graphs pad the tokens but not
PreparedMla
¶
max_context (the deployment's longest sequence) bounds the split count.
dcp: the model's DcpBox, with this layer's mailbox parity. queries:
the query lengths q (spec verify: 1 + the draft length) prepared for every batch
of rows divisible by q.
balanced: the model's BalancedMla; plans: whether this layer (the step's
first MLA layer) plans the balanced split counts for the step.
Methods:
-
plan–The balanced core's plan of this step (
lengths: this rank's), made by -
prepare_dcp–(MlaQuery's publish arguments, DcpValue's mailbox arguments, parity and
-
run–lengths/block_table: this rank's KV (the local shard under DCP); -
stock_core–tokenspeed_mla_decode or the balanced decode (with the step's plan) into
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/prepared.py
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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
plan(lengths, batch, q=1)
¶
The balanced core's plan of this step (lengths: this rank's), made by
the step's first MLA layer before its query kernel; nothing for the other
cores.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/prepared.py
prepare_dcp(batch)
¶
(MlaQuery's publish arguments, DcpValue's mailbox arguments, parity and rank) of one batch.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/prepared.py
run(projected, out, *, cache, slots, block_table, lengths, totals=None, q=1)
¶
lengths/block_table: this rank's KV (the local shard under DCP);
totals: under DCP, the requests' full lengths. q rows per request (spec
verify; slots per row). Rows of projected beyond the requests run as
empty requests (zero output).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/prepared.py
stock_core(cache, block_table, lengths, batch, q=1, totals=None)
¶
tokenspeed_mla_decode or the balanced decode (with the step's plan) into
the BF16 latent (DCP: tokenspeed or balanced for every rank's heads over the
local shard into the DcpBox rows + LSE; q > 1 masks causally in
global positions, totals). tokenspeed: a fixed split count per batch (one
CTA pair per split filling the SMs); all PDL chained between our kernels.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/prepared.py
compile_core(batch, heads, pitch, specs, device, dcp=0, sms=148, q=1, cap=64, partials='bf16')
cached
¶
CuTe kernels (query, value) of one batch of rows (q per request); under DCP
(dcp: its size, cap: the DcpBox rows) the query publishes and the value
is DcpValue (over the DcpBox's partials).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/prepared.py
core_for(batch, core='auto', q=1, dcp=False, balanced=False)
¶
core unless "auto": the balanced core for spec verify (q > 1) and from
BALANCED_Q1_BATCH rows at q = 1 where it runs (balanced; tokenspeed's even
split waits on the longest request of a mixed batch), else tokenspeed (also where
the balanced core can't run the shape, e.g. M64 tiles on SM100).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/mla/prepared.py
pad_requests(batch, block_table, lengths, totals=None)
¶
Request metadata for batch rows: PIECEWISE graphs pad the tokens but not
the requests, so missing rows become empty requests (length 0 on page 0).