vllm.models.kimi_k3.nvidia.specialized_decode.cutedsl.dsa.overlap
¶
Query overlap of a K3.1 DSA layer. The indexer path (wq_b -> DsaIndex -> scoring and top-k, under DCP the top-k merge and the local slots) needs only the normalized q_c rows of the query, so the rest of the query stage leaves the critical path:
QueryNorm q_a RMSNorm -> the q_c rows, on the main stream ahead of wq_b
(bit-identical to MlaQuery's: its scalar form below tiled_from rows,
its tiled kernel's packed FP32 pairs from there)
MlaQuery Q_B, W_UK absorption, the query rows, the MLA KV insert and, under
DCP, the q mailbox publish, on a side stream (store_qc=False,
poll=False)
QueryWait DCP: the q mailbox poll (until every rank's heads landed) after the
MlaQuery on the side stream, a few CTAs instead of MlaQuery's grid
The main stream joins the side stream just before the sparse core.
Classes:
-
QueryNorm–The q_a RMSNorm of
batchrows of the packed projection -> q_c [B, 1536] -
QueryWait–DCP: poll the gathered q mailbox (
batchtokens ofgathered= DCP x H
Functions:
-
overlap_for–The query overlap mode of
batchrows:policyis a mode or a -
side_stream–The DSA layers' query side stream of a device.
QueryNorm
¶
The q_a RMSNorm of batch rows of the packed projection -> q_c [B, 1536]
BF16, exactly as MlaQuery (heads) computes it for the same batch.
Methods:
-
kernel–One row per CTA: 8 columns per thread, MlaQuery.kernel's FMA order.
-
tiled–One row per warp: 48 columns per lane, MlaQuery.tiled's packed pairs.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/dsa/overlap.py
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 | |
kernel(args)
¶
One row per CTA: 8 columns per thread, MlaQuery.kernel's FMA order.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/dsa/overlap.py
tiled(args)
¶
One row per warp: 48 columns per lane, MlaQuery.tiled's packed pairs.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/dsa/overlap.py
QueryWait
¶
DCP: poll the gathered q mailbox (batch tokens of gathered = DCP x H
published heads in rows of q_heads, q_bytes per element) until no 16 B
chunk is the sentinel. It first waits for the MlaQuery before it, so the KV
insert is complete too when the main stream joins.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/dsa/overlap.py
overlap_for(batch, policy=None, dcp=False, wide=False, split=False)
¶
The query overlap mode of batch rows: policy is a mode or a
"rows:mode,..." table (default QUERY_OVERLAP of the topology, dcp;
wide: the split query of TP1, WIDE_MODES only; split: the split query
of fewer heads, under DCP its own table).