已合并
add t5 config #44032
add t5 config #44032
已合并
lihui创建于 14 天前
lihui
lihui成员
14 天前

【合入来源】

如有社区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成员
14 天前 创建了 pull request,commit 443d897b
atomgit-bot
atomgit-bot
14 天前 评论:

变更摘要

此 PR 在 benchmarks/torchbench/npu_support.py_patch_model_24() 函数中新增了对 torch.ops.aten.native_dropout.default 操作的副作用注册,将其标记为 _EffectType.ORDERED 类型。该改动主要服务于 T5 模型在 NPU 设备上的适配,确保 native_dropout 操作按顺序执行而不会被编译器重排序,从而保证 dropout 随机行为在 NPU 上的正确性。

主要改动

  • 注册 native_dropout 为有序副作用操作:在 _patch_model_24() 中调用 _register_effectful_op,将 torch.ops.aten.native_dropout.default 注册为 _EffectType.ORDERED 类型,防止该操作被编译器或运行时进行乱序优化。
  • 引入 torch._higher_order_ops.effects 内部 API:从该模块导入 _EffectType 枚举和 _register_effectful_op 函数,用于声明算子执行顺序约束。
  • 扩充 T5 模型的 NPU 补丁配置:该代码添加在已有的 T5 补丁逻辑之后,作为 _patch_model_24 补丁函数的一部分,进一步完善 T5 模型在 NPU 上的适配配置。
likedislike
atomgit-bot
atomgit-bot
14 天前 评论:

代码审查

Now let me do the final sweep as required:

  • Boundary values: No new numeric thresholds or limits introduced — N/A.
  • Hot-path costs: This is one-time initialization code, not in any hot path — N/A.
  • Co-located secondary defects: Re-examined lines 633-641 — the _register_effectful_op call signature (two positional args), _EffectType.ORDERED usage, and torch.ops.aten.native_dropout.default reference all look semantically correct. No transposed arguments, no reversed comparisons, no off-by-one issues at this location.

关闭总结

审查文件清单:

  • benchmarks/torchbench/npu_support.py — 审查完毕,发现 1 个问题。

按严重度统计:

优先级 数量
P0 0
P1 0
P2 1
P3 0

总体风险评估:中低风险。 变更本身的逻辑(将 native_dropout 注册为 ORDERED 效果操作)在语义上是合理的,但新增的内部 API 导入缺少异常保护,与同函数内已有代码的防御模式不一致。在 PyTorch 版本升级导致内部模块变更时,T5ForConditionalGeneration 基准测试会崩溃,建议添加 try/except 保护。

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

💬 仅评论

likedislike
ascend-robotascend-robot成员
14 天前 添加了label:ascend-cla/yes
此处折叠了49条消息 查看更多
ascend-robotascend-robot成员
3 天前 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
3 天前 评论:
流水线 PR-pipeline_pytorch#61745 [ commitID:e7c484d8 ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
阶段 任务名 状态 详情
编译构建 Build_X86 >>>
Build_ARM >>>
Build_LibTorch_x86 >>>
Build_LibTorch_ARM >>>
Build_X86_torchair 🛑 >>>
Build_ARM_torchair 🛑 >>>
patch_test 🛑 >>>
恶意代码检查 Antipoison >>>
编码安全与规范检查 codecheck_pre-commit >>>
check_error >>>
lintrunner >>>
开源片段检查 SCA >>>
开发者测试 UT_ARM_A3_Part_01 🛑 >>>
UT_ARM_A3_Part_02 🛑 >>>
UT_ARM_A2_Part_01 >>>
UT_ARM_A2_Part_02 >>>
UT_ARM_A2_Part_03 >>>
UT_inductor_Part_01 🛑 >>>
UT_inductor_Part_02 🛑 >>>
UT_inductor_Part_03 🛑 >>>
UT_inductor_Part_04 🛑 >>>
UT_DIST_ARM_Part_01 🛑 >>>
UT_DIST_ARM_Part_02 🛑 >>>
UT_DIST_ARM_Part_03 🛑 >>>
UT_DIST_ARM_Part_04 🛑 >>>
UT_ARM_A2_Select_Part_01 >>>
UT_ARM_A2_Select_Part_02 >>>
流水线 PR-pipeline_pytorch >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员[wujinyuan1, huangjingwei, liangsongwei, yashi999, culechan, Dring, wuyouqi1, L1919_snow, qq_52711437, WhiteNight12, nomiz, xiu_21, ffmh, wanglijun55, hss-shuai, husichao, smallsilly, lanshaozuishuai, jimmyisme1, lzy0920232, alpha-junh, Sunshine_Youngster, wei_zhuoyi, zhangyihuiben, zyw-hw, zzzkeke, rmch, yangch0324, LucciC, AACAES, renyujin, wjlflyer, senzhen-town, pengjingyou, qsc97, limuan, yule100, xiaoqi-zhou, kuhn7, chenxingying, hanye02, zichun_ye, anyrenwei, kkjocker, wangzili121, Lu_G, yvjc, puddingfjz, HandsoemLemon, bigprestigee1, huawuyi, zhenyu10, dairenjie, du-jin-hang, zou-jieyu, adelaideliu, TrHan, wanlinan, Windwindzzz, pengqihw, kisnwang, yuheng_wang, honghao_wang, jizewei, zhangguoguang, sunyu-xuan, chenrayray, hbhu_bin, liujunzhu, c_34, LiNuoh, maoyuanpeng1, zzhongmin, zhaoyu65, bellatan, jiabaolin, zhuofanshen, wencaiwen, lu_zhuge, caoshuyang, molly12, lyx324521, LQ1206, gitcode-chenjiao, cai-weiwei1989, CHDong, ogqin, yuanlipingGit, xuqinglin1, lqz2, zouwei1, chaoluoa, paradox325, jackzhang1116, yaoyao, akh, yujiacheng, dengjie0116, Hubert11111, Shine_Ws, wslhj555, longqiand, OYtao666, JiaqingQiang, luyyyy, Kingbelial, zhanghaiyu0101, wenxp1018, yanliu-luoluo, ksun_sekiro, liyong328, wgzheng, tangky, vivi_is_coding, aoiaoisola, weixin_44494597, wangmengmengwang65667, hid57809721, qq_35468730, comeonup, C547032, gcw_m5OQChA4, yao_yao_ling_xian, cnnbwcy, szqfes_12, cora_19, cann_lilin, can, shawnylee233, fanglanyue0916, hhz0, LiNuohang, taohuoquan, Jesse, WSs_321]评论有效
  • compile、compile_inductor、compile_torchair : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
ascend-robotascend-robot成员
3 天前 合入了pull request
ascend-robot
ascend-robot成员
3 天前 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
ascend-robot
ascend-robot成员
3 天前 评论:
流水线 pytorch_gitcode_PR_multiVersion#14143 [ commitID:e7c484d8 ] 已完成
likedislike