已合并
add t5 config #44032
lihui创建于 14 天前
add t5 config #44032
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 lihui 的贡献)ascend-robot
14 天前 评论:
14 天前 评论:
atomgit-bot
14 天前 评论:
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 上的适配配置。


atomgit-bot
14 天前 评论:
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_opcall signature (two positional args),_EffectType.ORDEREDusage, andtorch.ops.aten.native_dropout.defaultreference 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 |
💬 仅评论


14 天前 添加了label:ascend-cla/yes
此处折叠了49条消息 查看更多
3 天前 添加了label:ci-pipeline-passed
ascend-robot
3 天前 评论:
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 | ✅ | >>> |
- compile、compile_inductor、compile_torchair : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


3 天前 合入了pull request
ascend-robot
3 天前 评论:
3 天前 评论:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


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


【合入来源】
【修改方案】
在npu_support.py里面针对T5网络增加dropout算子保序副作用
【资料变更】
否
【接口变更】
不涉及
【功能验证】
本地验证通过
【CheckList】