vllm.models.deepseek_v41.nvidia.specialized_decode.ampere.attention
¶
The DeepSeek-V4.1 attention layer on SM80.
DeepSeek-V4.1 attends each query token to two key sets: the last
sliding_window tokens of its request (the SWA cache, 528-byte MXFP8
records) and the index_topk compressed tokens its indexer selected (the
compressed cache, 288-byte NVFP4 records here). On SM90 and SM100 FlashMLA
runs that sparse MLA; on SM80 this layer does, with the same records:
- the SWA records are written by the stock fused Q/KV kernel, which runs on SM80;
- the compressor writes its NVFP4 records with
AmpereCompressor; forward_mqaattends decode and prefill tokens alike, each over its own window and selected compressed keys, and writes the output already inverse-RoPE'd, so_o_projis a BF16 groupedwo_aandwo_b.
The metadata is the stock one, minus FlashMLA's tile scheduler and DeepGEMM's paged-logits schedule: the SWA and indexer builders here plan neither. Prefill context parallelism is not supported.
Classes:
-
AmpereCompressor–The compressor, writing its 288-byte NVFP4 records on SM80.
-
AmpereSWABackend–The SWA cache backend of the SM80 layer.
-
AmpereSWAMetadataBuilder–SWA metadata without FlashMLA's tile-scheduler plans.
-
AmpereSparseMLABackend–The compressed-cache backend of the SM80 layer: FlashMLA's metadata
-
DeepseekV41AmpereAttention–DeepSeek-V4.1 attention on SM80 (A100).
AmpereCompressor
¶
Bases: DeepseekCompressor
The compressor, writing its 288-byte NVFP4 records on SM80.
Methods:
-
insert_cache–Publish the group-boundary latents as NVFP4 compressed records.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/ampere/attention.py
insert_cache(latent, positions, rotary_emb)
¶
Publish the group-boundary latents as NVFP4 compressed records.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/ampere/attention.py
AmpereSWABackend
¶
Bases: DeepseekSparseSWAFlashMLABackend
The SWA cache backend of the SM80 layer.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/ampere/attention.py
AmpereSWAMetadataBuilder
¶
Bases: DeepseekSparseSWAFlashMLAMetadataBuilder
SWA metadata without FlashMLA's tile-scheduler plans.
Methods:
-
build_tile_scheduler–No plans: the base builds none for a step without decode tokens.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/ampere/attention.py
build_tile_scheduler(num_decode_tokens)
¶
No plans: the base builds none for a step without decode tokens.
AmpereSparseMLABackend
¶
Bases: DeepseekV4FlashMLABackend
The compressed-cache backend of the SM80 layer: FlashMLA's metadata and paging, with the NVFP4 compressed record.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/ampere/attention.py
DeepseekV41AmpereAttention
¶
Bases: DeepseekV4Attention
DeepSeek-V4.1 attention on SM80 (A100).
Methods:
-
forward_mqa–Sparse MLA of every token over its window and selected keys.
-
get_padded_num_q_heads–No padding: the kernel takes any head count.
Attributes:
-
packed_kv_cache_dtype(CacheDType) –The NVFP4 compressed record, as on SM100's mega attention.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/ampere/attention.py
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 | |
packed_kv_cache_dtype
property
¶
The NVFP4 compressed record, as on SM100's mega attention.
_indexer_cache_cls()
¶
_indexer_cls(k_cache)
¶
The indexer with SM80 query quantization and logits.
_o_proj(attn_out, positions)
¶
wo_a per head group as a BF16 batched GEMM, then wo_b.
forward_mqa already applied the inverse RoPE. wo_a is the
MXFP8 emulation kernel's BF16 weight [groups * o_lora_rank, K].
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/ampere/attention.py
forward_mqa(q, kv, positions, output)
¶
Sparse MLA of every token over its window and selected keys.
Source code in vllm/models/deepseek_v41/nvidia/specialized_decode/ampere/attention.py
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 | |