Open
fix: match MXFP8 module filters against full FQNs #200
fix: match MXFP8 module filters against full FQNs #200
Open
MuuAdd on 10 hours ago
Muu
Muu
10 hours ago

【修改说明】

_apply_modules_match 在模式匹配前把模块 FQN 截断到 layers.N 前缀。寻址完整模块路径的 pattern(如 layers.{*}.attention.wq_a)永远无法命中截断后的前缀,过滤器对所有非前缀 pattern 返回 False:quantize_ 在运行报告 MXFP8 的同时把选中模块静默留在 bf16。

改为对完整 FQN 匹配。前缀式 pattern(layers.{*})语义不变(* 本就跨点),截断还破坏了无 layers.N 段的容器路径。

【背景】

问题在 torchtitan-ascend !333(DeepSeek V4.1 MXFP8)的接入中发现:其 plan 使用全 FQN pattern,TestRealFilters 直接 exec 本仓 filters 源码,官方版 filters 下 4 例中 2 例失败(本地修复版全过),已实证该截断的静默零命中。

【验证结果】

  • 调用方测试:torchtitan-ascend !333 的 TestRealFilters 4 例在本修复下全部通过(含 dense 全 FQN 匹配、moe 容器匹配、排除 pattern 优先级)。
  • 行为不变性:前缀式 pattern(layers.{*})在修复前后命中集合一致(* 跨点匹配完整 FQN 与匹配 layers.N 前缀等价)。
  • 950DT 实机:!333 同源分支 2026-11-19/23 在 8×950DT 上完成 L1–L4 组件与 60 步端到端验证(dense 60 步 loss 平均偏差 0.78%),filters 修复在验证环境内生效。
  • diff 仅 +4/−5,git diff --check 干净。

【兼容性影响】

仅影响向 mxfp8_apply_modules 传入全 FQN pattern 的调用方——修复前这类调用静默零命中(bf16),修复后按语义命中。前缀式 pattern 行为不变。torchtitan-ascend !333 依赖本 MR 先行合入。

likedislike
Merge blocked
MuuMuu
10 hours ago Created pull request, commit 224597ca
ascend-robotascend-robotCollaborators
10 hours ago Added label: ascend-cla/yes
ascend-robot
ascend-robotCollaborators
10 hours ago Comments:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.


PR Approval Progress

⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)

Module Approval Details

module lgtm status approve status
repo-Ascend/torchao-ascend ❌ (0/2)(You can also ask: liangsongwei, wanglijun55, jishuangfeng, chengpeng25, sylvia_wei) ❌ (0/1)(You can also ask: 褚博宁, 楚浩田, chengpeng25, chujinjin, wanglijun55)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

Muuyo, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike