已关闭
[Bug] 修复 DeepSeek PD ratio 编译路径中的 FX 动态 shape 拓扑错误 #412
lutean创建于 10 天前关闭于 2 天前
kai1949
10 天前 评论:
10 天前 评论:
/label add triaged
👋 您好,欢迎向 MindStudio-Modeling 提交 Issue!
我们已收到您的反馈,感谢你对开源社区的支持。🎉
📅处理时效: 维护团队将在8小时内 查看并回复您的问题(工作日)。
🔍自助查询: 在等待期间,建议您先查阅以下资料,可能已有解决方案:
📖 MindStudio-Modeling官方文档
📝 贡献者指南
请确保 Issue 描述清晰,包含复现步骤和日志,这将帮助我们更快定位问题。谢谢!


10 天前 添加了label:bug
10 天前 添加了label:triaged
jia_ya_nan
10 天前 评论:
10 天前 评论:
/label add resolved


10 天前 添加了label:resolved
ascend-robot
3 天前 评论:
3 天前 评论:
您好,当前Issue标记为resolved且有一段时间未进一步更新,因此我们将其标记为'stale'(闲置)状态。若您认为这是误操作,可通过添加任意评论来去除'stale'标签。标记为stale的Issue在4天内无更新活动将自动关闭。


3 天前 添加了label:stale
Problem
test_deepseek_model_pd_ratio_with_output_validationcan fail during compilation withBackendCompilerFailed. The immediate symptom is that generated FX code evaluatesview_default_1usingpow_2beforepow_2is defined.The failure is unrelated to whether
PeepHolePassis enabled. This Issue is scoped tothe general FX graph-ordering invariant required by the compiler rewrite pipeline.
Reproduction
Run the regression case:
On an affected revision, compilation may raise:
Expected
Compiler graph rewrite passes preserve FX topological order: symbolic shape-expression
nodes must be emitted before any
vieworreshapenode that consumes them. TheDeepSeek PD-ratio output-validation regression should compile successfully.
Actual
AOT Autograd can produce a graph whose symbolic shape calculation appears after a
viewconsuming it. Subsequent rewrite passes can retain or rebuild this invalid order.Generated code then references the symbolic expression before assignment, causing
BackendCompilerFailed.Root Cause
CompilerBackend.compile()entered rewrite passes without normalizing the AOT FX graph.LiftCombineQuantPasscan rebuild view nodes, then runs dead-code elimination; thegraph needs to be topologically restored and linted before that boundary.
Proposed Fix
stable_topo_sort(gm)andgm.graph.lint()before compiler graph rewrites.LiftCombineQuantPassrebuilds views, callstable_topo_sort(gm)and lintbefore dead-code elimination.
view(..., [-1, operator.pow(x, 2)]), assertingpowprecedesviewand graph lint passes before and after the pass.Acceptance Criteria
Related Pull Request
Evidence
masteris limited to 3 files and+59/-2.related rewrite tests (24 passed), and the DeepSeek PD-ratio regression passed.