vllm.model_executor.layers.fused_moe.experts.rdna3_mxfp4_moe
¶
Native RDNA3 (gfx1100) MXFP4 fused-MoE experts backend.
A modular FusedMoEExperts that drives the moe_mxfp4_gemm_rdna3 HIP kernel
(E2M1 weights + E8M0 group-32 scale, no zero point). Standard activation format:
apply receives the full hidden states + topk ids/weights and does its own
expert routing (moe_align_block_size), the two GEMMs, the activation, the
per-expert bias and the weighted reduction — so it covers both the
compressed-tensors MXFP4 MoE (no bias, SiLU) and GPT-OSS native-mxfp4 (per-expert
bias + clamped SwiGLU-OAI) by reading everything from quant_config.
Registered as Mxfp4MoeBackend.RDNA3_MXFP4 in the oracle and gated on gfx1100.
Classes:
-
RDNA3Mxfp4Experts–MXFP4 MoE experts on the native RDNA3 HIP kernel (gfx1100 only).
Functions:
-
repack_experts_rdna3–[E, N, K/2] u8 + [E, N, K/32] u8 -> [E, K/8, N] int32 + [E, K/32, N] u8.
RDNA3Mxfp4Experts
¶
Bases: FusedMoEExpertsModular
MXFP4 MoE experts on the native RDNA3 HIP kernel (gfx1100 only).
Source code in vllm/model_executor/layers/fused_moe/experts/rdna3_mxfp4_moe.py
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 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | |
_expert_bias_rows(bias, topk_ids, expert_map, dtype)
¶
Per-row expert bias, [M * top_k, N].
topk_ids are global expert ids; the bias is stored per local
expert, so under EP they have to go through expert_map first. Rows
routed to another rank map to -1: the GEMM skips them, so their bias
must be zero rather than a wrapped-around lookup.
Source code in vllm/model_executor/layers/fused_moe/experts/rdna3_mxfp4_moe.py
_select_block_size_m(num_tokens, top_k, num_experts)
¶
Pick the GEMM tile from expected occupancy (avg tokens/expert).
Batches that give each expert a few dozen rows run on the tiled WMMA kernels; smaller ones use a scalar tile sized to occupancy (bsm=1 beats bsm=4 at low concurrency).
Source code in vllm/model_executor/layers/fused_moe/experts/rdna3_mxfp4_moe.py
repack_experts_rdna3(packed, scale, deinterleave)
¶
[E, N, K/2] u8 + [E, N, K/32] u8 -> [E, K/8, N] int32 + [E, K/32, N] u8.
The kernel reads weights as [E, K/8, N] uint32 (4 consecutive packed bytes
little-endian = a uint32 of 8 E2M1 codes along K). Per-expert into
pre-allocated outputs so a multi-GB repack fits next to the loaded weights.
deinterleave splits GPT-OSS's gate/up rows ([g0,u0,...] -> [g...,u...]).