在 /user_4813494d/openbmb 项目中调研当前 Marlin NVFP4 kernel 的精度模式。背景:项目使用 SGLang fork + custom…
- User
在 /user_4813494d/openbmb 项目中调研当前 Marlin NVFP4 kernel 的精度模式。背景:项目使用 SGLang fork + custom sgl-kernel 的 Marlin FP4 路径做 decode。我需要搞清楚:
-
当前 Marlin 是 NVFP4 A16 还是 A8?也就是 activation 是 fp16/bf16 还是 fp8/int8。重点查:
demo-sala/sglang/python/sglang/srt/layers/quantization/下的 marlin / fp4 相关文件marlin_utils_fp4.py之类modelopt_quant.py里 hybrid Marlin 选择逻辑- sgl-kernel Marlin FP4 entry(gemm 函数签名 / dtype 参数)
docs/gemm/marlin.md和docs/quant/里的相关结论
-
是否存在 NVFP4 A8 Marlin kernel 的支持?查 sgl-kernel 上游、CUTLASS、有没有 a8 variant 的入口或 todo 注释;docs/gemm 里有没有提到 a8 的讨论或 dead-end。
-
当前 decode shape 下 Marlin 的实测速度 — 看 docs/gemm/sol_table.md / current.md / changelog.md,找最新的 Marlin 在小 M (decode) 的吞吐 vs roof。
请精读上述 docs 和关键代码文件后给我一个 300 字以内的总结:当前模式确认、a8 可行性、目前 marlin 瓶颈数字。不要列文件清单,给结论 + 关键引用(file:line)。
-
Assistant
我来系统地调研这个 Marlin NVFP4 kernel 的精度模式问题。
Assistant
现在查看关键文件:
Assistant
继续查看关键文件:
Assistant
好的,现在查看 sgl-kernel 的具体 gemm 函数签名和 FP8 支持情况:
Assistant
现在查看 sol_table 和 gptq_marlin_gemm 的函数签名:
Assistant
最后检查 marlin_utils_fp8 和查看 gptq_marlin_gemm 的具体参数:
Assistant
完美!现在我有了全面的信息。让我生成总结。
总结
当前 Marlin NVFP4 精度模式确认:
-
NVFP4 是 A16 模式(fp16/bf16 activation),不是 A8。
marlin_utils_fp4.py:149-165中gptq_marlin_gemm()调用:activation 是reshaped_x(input tensor,dtype 为 bf16),weight 是scalar_types.float4_e2m1f,output 也是 bf16——典型 W4A16 架构。- Weight scales 在 FP8-S0E5M3 格式(
nvfp4_marlin_process_scales第 109 行),global_scale 在 bf16/fp16(第 226 行)。
-
不存在 NVFP4 A8 Marlin kernel 支持。
dead-ends.md §E明确列举"native FP4 MMA / QuTLASS W4A4 替换"为 dead-end:mma.kind=mxf4nvf4要求 A+B 都必须是 FP4,硬件限制。marlin_utils_fp4.py唯一路径就是 W4A16;配对的b12x_fp4.py是 W4A4(CUTLASS),M>48 才走。- sgl-kernel 上游无 A8 变体;vLLM marlin fork 也是 W4A16 设计。
-
当前 decode 瓶颈数字(M≤48 Marlin 路径):
sol_table.md§2:gate_up M=1 理论下界 53.98µs,down_proj M=1 理论下界 26.99µs(mem-bound,AI≈3.6)。
-