[DeepSeek V4] Add W4A4 MegaMoE server flag (#35918)
This commit is contained in:
@@ -611,23 +611,21 @@ export const Playground = ({ config }) => {
|
||||
// ---- Axis: MoE Parallelism ----------------------------------------------
|
||||
// Backend single-select + EP numeric knob; either is optional. Picking the
|
||||
// "megamoe" backend reveals a Quantization sub-select (W4A8 / W4A4) in the same
|
||||
// row — W4A4 adds the FP4-activations env vars.
|
||||
// row — W4A4 adds the FP4-activations server flag.
|
||||
moe: {
|
||||
initState: () => ({ backend: null, ep: null, mmQuant: null }),
|
||||
|
||||
// Prefer --moe-a2a-backend over --moe-runner-backend when both present.
|
||||
// mmQuant is derived from the base env (FP4 activations present → W4A4).
|
||||
// mmQuant is derived from the base flag (FP4 activations present → W4A4).
|
||||
deriveFromBase: (cell, fc, h) => {
|
||||
const flags = (cell && cell.flags) || [];
|
||||
const baseEnv = (cell && cell.env) || [];
|
||||
const a2a = h.findFlagArg(flags, "--moe-a2a-backend");
|
||||
const runner = h.findFlagArg(flags, "--moe-runner-backend");
|
||||
const fp4Acts = baseEnv.some(
|
||||
(e) => e.startsWith("SGLANG_OPT_DEEPGEMM_MEGA_MOE_USE_FP4_ACTS"));
|
||||
const w4a4 = h.hasFlag(flags, "--enable-w4a4-mxfp4-megamoe");
|
||||
return {
|
||||
backend: a2a || runner || null,
|
||||
ep: h.parseIntFlagAny(flags, h.EP_HEADS),
|
||||
mmQuant: fp4Acts ? "w4a4" : "w4a8",
|
||||
mmQuant: w4a4 ? "w4a4" : "w4a8",
|
||||
};
|
||||
},
|
||||
|
||||
@@ -651,15 +649,19 @@ export const Playground = ({ config }) => {
|
||||
if (opt?.env?.length) env = [...env, ...opt.env];
|
||||
}
|
||||
// MegaMoE owns the MoE path: when the effective backend is megamoe, strip the
|
||||
// DeepEP dispatch + any prior megamoe env, then re-add the selected quant's
|
||||
// env. When the backend is explicitly switched away from megamoe, only drop
|
||||
// the megamoe quant env (leave DeepEP dispatch intact).
|
||||
// DeepEP dispatch + any prior MegaMoE quant settings, then re-add the
|
||||
// selected quant's flags/env. When the backend is explicitly switched
|
||||
// away from MegaMoE, only drop the MegaMoE quant settings (leave DeepEP
|
||||
// dispatch intact).
|
||||
const mq = fc.megamoeQuant;
|
||||
if (mq) {
|
||||
const quantKeys = [];
|
||||
const quantFlagHeads = [];
|
||||
for (const o of (mq.options || [])) {
|
||||
for (const e of (o.env || [])) quantKeys.push(e.split("=")[0]);
|
||||
for (const f of (o.flags || [])) quantFlagHeads.push(f.split(/[\s=]/)[0]);
|
||||
}
|
||||
flags = h.stripFlagsByFirstToken(flags, quantFlagHeads);
|
||||
const effBackend = value.backend !== null
|
||||
? value.backend : (derived && derived.backend);
|
||||
if (effBackend === "megamoe") {
|
||||
@@ -667,6 +669,9 @@ export const Playground = ({ config }) => {
|
||||
const quant = value.mmQuant != null
|
||||
? value.mmQuant : ((derived && derived.mmQuant) || "w4a8");
|
||||
const opt = (mq.options || []).find((o) => o.id === quant);
|
||||
if (opt?.flags?.length) {
|
||||
flags = h.insertAfter(flags, h.ANCHOR_NEAR_MOE, opt.flags);
|
||||
}
|
||||
if (opt?.env?.length) env = [...env, ...opt.env];
|
||||
} else if (value.backend !== null) {
|
||||
env = h.stripEnvByPrefix(env, quantKeys);
|
||||
|
||||
@@ -178,11 +178,8 @@ export const config = {
|
||||
{ id: "w4a8", label: "W4A8",
|
||||
env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"] },
|
||||
{ id: "w4a4", label: "W4A4",
|
||||
env: [
|
||||
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320",
|
||||
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_USE_FP4_ACTS=1",
|
||||
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_USE_MXF4_KIND=1",
|
||||
] },
|
||||
flags: ["--enable-w4a4-mxfp4-megamoe"],
|
||||
env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"] },
|
||||
],
|
||||
},
|
||||
// WideEP — the launch post's large-scale-EP claim — so the range goes past
|
||||
|
||||
@@ -258,11 +258,8 @@ sgl-eval run aime25 \\
|
||||
{ id: "w4a8", label: "W4A8",
|
||||
env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"] },
|
||||
{ id: "w4a4", label: "W4A4",
|
||||
env: [
|
||||
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320",
|
||||
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_USE_FP4_ACTS=1",
|
||||
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_USE_MXF4_KIND=1",
|
||||
] },
|
||||
flags: ["--enable-w4a4-mxfp4-megamoe"],
|
||||
env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"] },
|
||||
],
|
||||
},
|
||||
ep: { label: "EP", values: [
|
||||
|
||||
@@ -513,11 +513,8 @@ export const config = {
|
||||
{ id: "w4a8", label: "W4A8",
|
||||
env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"] },
|
||||
{ id: "w4a4", label: "W4A4",
|
||||
env: [
|
||||
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320",
|
||||
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_USE_FP4_ACTS=1",
|
||||
"SGLANG_OPT_DEEPGEMM_MEGA_MOE_USE_MXF4_KIND=1",
|
||||
] },
|
||||
flags: ["--enable-w4a4-mxfp4-megamoe"],
|
||||
env: ["SGLANG_OPT_DEEPGEMM_MEGA_MOE_NUM_MAX_TOKENS_PER_RANK=8320"] },
|
||||
],
|
||||
},
|
||||
ep: { label: "EP", values: [
|
||||
|
||||
Reference in New Issue
Block a user