已合并
add t5 config #44026
add t5 config #44026
已合并
lihui创建于 13 天前
lihui
lihui成员
13 天前

【合入来源】

如有社区issue,请关联issue链接
https://gitcode.com/Ascend/pytorch/issues/3416
请勿携带内部流程信息(需求链接、问题单、内部issue等)

【修改方案】

在npu_support.py里面针对T5网络增加dropout算子保序副作用

【资料变更】

【接口变更】

不涉及

【功能验证】

本地验证通过

【CheckList】

PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 lihui 的贡献)
lihuilihui成员
13 天前 创建了 pull request,commit 05977e38
atomgit-bot
atomgit-bot
13 天前 评论:

变更摘要

此PR将 aten.native_dropout.default 操作注册为 _EffectType.ORDERED 效果操作的代码,从 torch_npu/_inductor/dvm/decomp.py 模块级别移至 benchmarks/torchbench/npu_support.py 中的 _patch_model_24() 函数(T5模型补丁函数)内,使其由全局无条件注册变为仅在T5 benchmark场景下按需注册,避免了对其他模型的潜在副作用。

主要改动

  • native_dropout 效果注册位置迁移:将 _register_effectful_op(torch.ops.aten.native_dropout.default, _EffectType.ORDERED) 调用连同其 import 语句从 torch_npu/_inductor/dvm/decomp.py 的模块顶层移除,转而添加至 benchmarks/torchbench/npu_support.py_patch_model_24() 函数中,使该注册仅在T5模型benchmark补丁阶段生效。
  • T5模型配置补充:在 _patch_model_24() 中新增 native_dropout 的效果操作注册,确保T5模型在NPU上运行时 native_dropout 被视为有序副作用操作,与T5ForConditionalGeneration的已有补丁逻辑保持一致。
likedislike
atomgit-bot
atomgit-bot
13 天前 评论:

代码审查

审查总结

优先级 数量
P2 1

已审查文件

  • benchmarks/torchbench/npu_support.py:发现 1 个问题(P2)
  • torch_npu/_inductor/dvm/decomp.py:无独立问题(该文件的变更是移除代码,被移除的代码被移至 npu_support.py,其缺失构成了上述 P2 问题的另一面)

整体风险判断:中等风险。该变更将 native_dropout 的 ORDERED effectful 注册从全局 DVM 编译路径(decomp.py 模块顶层)移入了仅对 T5ForConditionalGeneration benchmark 生效的 model patch 中。对于所有其他模型,该注册将丢失,可能导致 Inductor 编译器对 dropout 操作进行不当优化。如果上游 PyTorch 已另行对 native_dropout 做了全局注册,则此变更为安全;否则构成功能回归,建议将注册恢复至全局路径。

类型 数量
🔴 阻塞 0
🟡 建议 1

💬 仅评论

likedislike
ascend-robotascend-robot成员
13 天前 添加了label:ascend-cla/yes
此处折叠了47条消息 查看更多
daifu1234567成员
9 天前 评论:

/lgtm

likedislike
ascend-robotascend-robot成员
9 天前 添加了label:lgtm
ascend-robotascend-robot成员
9 天前 删除了label:ci-pipeline-passed
ascend-robotascend-robot成员
9 天前 合入了pull request
ascend-robot
ascend-robot成员
9 天前 评论:
流水线 pytorch_gitcode_PR_multiVersion#13848 [ commitID:6a701235 ] 运行失败
likedislike