Closed
[v2.10.0][Bug] FlexAttention max-autotune may lose mutation outputs in multi-template selection #4722
stonexxxAdd on  Sep 9Closed at  8 days ago
stonexxx
stonexxxCollaborators
Sep 9 Create

问题描述

v2.10.0 的 AlgorithmSelector 包含与 master 相同的 deferred multi-template 选择逻辑。FlexAttention backward 候选可能通过 mutated_inputs 写出中间结果,但当前判定不会阻止其被包装为 MultiTemplateBuffer。

MultiTemplateBuffer 不保留模板 mutation 输出,因此该路径存在 backward mutation 结果丢失及梯度错误风险。

复现范围

  • torch_npu:2.10.0
  • NPU:Ascend 950
  • 条件:TORCHINDUCTOR_MAX_AUTOTUNE=1
  • 用例:testcase_score_mask_combos_npu.py::test_score_mod_mask_mod_combo[identity-x-noop]

根因

AlgorithmSelector 的 deferred multi-template 判定没有检查候选的 mutated_inputs。

预期结果

带 mutated_inputs 的候选应禁用 deferred multi-template,并按普通 template buffer 完成选择;无 mutation 候选行为保持不变。

当前验证限制

当前 v2.10.0 环境在进入 mutation 精度断言前,被该分支已有的 autotune 配置代码生成问题阻塞:未加引号的 no 触发 NameError,所有候选失效后抛出 NoValidChoicesError。应用本修改前后均保持该失败形态,因此不声明端到端通过。

likedislike
TorchNPU-BotTorchNPU-BotCollaborators
Sep 9 Added label: triage-review
TorchNPU-Bot
TorchNPU-BotCollaborators
Sep 9 Comments:

issue待分派,添加triage-review标签

likedislike
stonexxxstonexxxCollaborators
Sep 9 Associated pull request
TorchNPU-BotTorchNPU-BotCollaborators
Sep 9 Added label: bot-triaged; Removed label: triage-review
TorchNPU-Bot
TorchNPU-BotCollaborators
Sep 9 Comments:

检测到当前 issue 已关联 PR,自动添加标签:bot-triaged

likedislike
xieanranxieanranCollaborators
Sep 10 Associated pull request
xieanranxieanranCollaborators
Sep 10 Deleted associated pull request: [2.9.0]profiler support display addtional headers && fix log
chenrayraychenrayrayCollaborators
10 days ago Added label: module: graph-mode
chenrayray
chenrayrayCollaborators
8 days ago Comments:

这条开发自提 issue 提出已超过一个月,先关闭。如仍需跟进,请重新打开。

likedislike
chenrayraychenrayrayCollaborators
8 days ago Close issue
chenrayraychenrayrayCollaborators
8 days ago changed custom state from TODO to DONE
ascend-robotascend-robotCollaborators
8 days ago Added label: resolved