feat: emb_fp16 选项(Embedding表转FP16,查表带宽减半);bench --emb-fp16

embedding查表是显存带宽瓶颈(profile 16%);FP16表读一半字节。按token量算应
能等比例翻译到评测。代价:embedding权重存FP16微小精度损失,须先测AUC。默认关。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
OwnerSunshine530
2026-06-15 12:26:55 +08:00
parent cb2913cda8
commit adc99b5b41
2 changed files with 7 additions and 2 deletions
+3
View File
@@ -296,6 +296,7 @@ def _parse_args():
ap.add_argument("--moe", choices=["dense", "loop"], default=None,
help="MoE实现:dense=向量化(新), loop=逐expert循环(原)")
ap.add_argument("--compile", action="store_true", help="开启 torch.compile")
ap.add_argument("--emb-fp16", action="store_true", help="Embedding表转FP16(查表带宽减半,测AUC)")
ap.add_argument("--profile", type=int, default=None, metavar="N",
help="剖析前 N 个 batch,打印按 CUDA 耗时排序的算子表(定位瓶颈)")
ap.add_argument("--rebuild", action="store_true", help="强制重建过滤缓存")
@@ -325,6 +326,8 @@ if __name__ == "__main__":
cfg["attn"] = a.attn
if a.moe is not None:
cfg["vectorize_moe"] = (a.moe == "dense")
if a.emb_fp16:
cfg["emb_fp16"] = True
if a.compile:
cfg["compile"] = True
if a.profile is not None: