vllm.models.glm5next.nvidia.specialized_decode.dense_mlp
¶
The dense (first first_k_dense_replace) layers' MLP of a few decode tokens
as two CuTe kernels, in place of input quant, DeepGEMM gate_up, SwiGLU, quant and
DeepGEMM down.
A CTA owns a few 16-row tiles over the whole K, one warp per (tile, 512 of K): one m16n8k32 FP8 mma.sync per 32 K with the tokens as the eight B columns. A lane always reads the same 16 bytes of a row (and of a token), so its A and B fragments come from plain 16-byte loads: within each 64-K step lane (g, q) holds K 16q..16q+15 of rows g and g + 8, and the two mmas of the step take its first and last eight bytes. Any K order is fine as long as A and B agree.
The CTA's weights stream into shared memory (cp.async, L2 evict-first) and,
for the first in_regs steps, into registers before the PDL wait, so a whole
layer's weights are in flight at launch. After the wait the tiles' warps of a K
slice split its tokens and quantize them once for the CTA (FP8 per 128 with the
stock scale rule): every CTA reads and quantizes the whole input, so fewer,
larger CTAs (one per SM) keep that from growing with the tokens. Each 128-K
group's four mmas sum in FP32 and take the weight and activation scales, and the
warps' partial sums meet in shared memory.
The gate_up CTA owns gate rows 8c..8c+7 (A rows g) and the matching up rows (A rows g + 8), so its epilogue writes the clamped SwiGLU directly, rounding like stock: BF16 gate/up, then a BF16 product. The down kernel's input is that BF16 activation.
Classes:
-
DenseMlp–FP8 block-scaled gate_up with the clamped SwiGLU, then the down projection
DenseMlp
¶
FP8 block-scaled gate_up with the clamped SwiGLU, then the down projection
of a TP shard of Glm5NextMLP (output still TP-partial).
Methods:
-
prepare–Compiles for these token counts before graph capture.
Source code in vllm/models/glm5next/nvidia/specialized_decode/dense_mlp.py
prepare(tokens)
¶
Compiles for these token counts before graph capture.
_MmaGemv
¶
BF16 [tokens, rows] = FP8-quantized BF16 [tokens, k] input times the FP8
[rows, k] weight; with swiglu the clamped SwiGLU [tokens, rows / 2] of the
gate (first half) and up (second half) rows.
Methods:
-
epilogue–Tile
cta's outputs from its warps' partial sums.
Source code in vllm/models/glm5next/nvidia/specialized_decode/dense_mlp.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 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 | |
_slot(staged, warp, h, step)
¶
Shared words of step step, half h of the warp's weights.
_summed(partial, src, i)
¶
Partial sum i of lane src, over the tile's warps.
Source code in vllm/models/glm5next/nvidia/specialized_decode/dense_mlp.py
epilogue(partial, out, cta, tid)
¶
Tile cta's outputs from its warps' partial sums.