vllm.models.deepseek_v41.amd.mhc
¶
The DSV4.1 delayed mHC seams on ROCm.
On gfx950, mhc_pre_delayed_overlap moves the gate projection onto a side
stream, overlapped with the next sublayer. On gfx942, mhc_pre_delayed_seam
runs AITER's mhc_fused_post_pre_delayed, which applies the previous
sublayer's post, collapses the residual with the carried pre-mix and computes
the next gates in one call, from MHC_SEAM_MIN_TOKENS tokens on seams that
have a post block and no fused norm.
Classes:
-
MHCOverlapStream–The global aux stream with the fork and join events of the overlap.
Functions:
-
mhc_pre_delayed_mxfp8–pre_delayedwhose Mega-MHC seam also writes the layer input as MXFP8. -
mhc_pre_delayed_overlap–pre_delayedwith the gate projection moved ontooverlap.stream. -
mhc_pre_delayed_seam–pre_delayedwith the seam run as one AITER call where it applies. -
supports_mhc_seam–True on gfx942 when AITER's probe accepts this shape.
MHCOverlapStream
¶
The global aux stream with the fork and join events of the overlap.
Every fork and join waits on its event before the next records it, so all layers share the two events.
Methods:
-
prepare_mega_mhc–Allocate AITER Mega-MHC's per-stream scratch on the side stream.
Source code in vllm/models/deepseek_v41/amd/mhc.py
prepare_mega_mhc(hidden_size, device)
¶
Allocate AITER Mega-MHC's per-stream scratch on the side stream.
The gates run there only inside FULL graph capture, which cannot
allocate it; sizing it for MHC_OVERLAP_MAX_TOKENS covers every
batch the overlap captures.
Source code in vllm/models/deepseek_v41/amd/mhc.py
mhc_pre_delayed_mxfp8(pre_delayed, residual, fn, hc_scale, hc_base, rms_eps, hc_pre_eps, hc_sinkhorn_eps, hc_post_mult_value, sinkhorn_repeat, pre_mix=None, x=None, norm_weight=None, norm_eps=1e-06, sublayer_out=None, post_layer_mix=None, comb_res_mix=None, fn_packed=None)
¶
pre_delayed whose Mega-MHC seam also writes the layer input as MXFP8.
The sublayer's first GEMM then reads that copy (see attach_mxfp8_input)
instead of quantizing the bf16 layer input in a separate launch. Seams
pre_delayed would not run on Mega-MHC are left to it.
Source code in vllm/models/deepseek_v41/amd/mhc.py
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 | |
mhc_pre_delayed_overlap(pre_delayed, residual, fn, hc_scale, hc_base, rms_eps, hc_pre_eps, hc_sinkhorn_eps, hc_post_mult_value, sinkhorn_repeat, pre_mix=None, x=None, norm_weight=None, norm_eps=1e-06, sublayer_out=None, post_layer_mix=None, comb_res_mix=None, fn_packed=None, *, overlap)
¶
pre_delayed with the gate projection moved onto overlap.stream.
Returns residual, post_mix, comb_mix, layer_input, next_pre_mix. Only the
residual and layer input are ready on the caller stream; call
overlap.join() before using the gates. Seams without a post block, a
carried pre-mix or a fused norm run pre_delayed on the caller stream.
Source code in vllm/models/deepseek_v41/amd/mhc.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 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 | |
mhc_pre_delayed_seam(pre_delayed, residual, fn, hc_scale, hc_base, rms_eps, hc_pre_eps, hc_sinkhorn_eps, hc_post_mult_value, sinkhorn_repeat, pre_mix=None, x=None, norm_weight=None, norm_eps=1e-06, sublayer_out=None, post_layer_mix=None, comb_res_mix=None, fn_packed=None)
¶
pre_delayed with the seam run as one AITER call where it applies.
Same arguments and returns as MHCPreDelayedOp. Layer 0 (x), seams
without a post block (Engram), and seams with a fused norm or a packed
fn (Mega-MHC) keep pre_delayed. The caller checks supports_mhc_seam
once.
Source code in vllm/models/deepseek_v41/amd/mhc.py
supports_mhc_seam(hidden_size, hc_mult)
cached
¶
True on gfx942 when AITER's probe accepts this shape.