| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 年前 | ||
feat: Align ACLGraph RNG capture state Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !41461 merge pta_support_generator_per_capture_20260709_master into master feat: Align ACLGraph RNG capture state Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 > 关联 issue: #2823 (https://gitcode.com/Ascend/pytorch/issues/2823) - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. 在 AclInterface 中新增 aclmdlRIGetId 动态加载封装 TryAclmdlRIGetId;在 NPUGraphsUtils 中新增 capture id 查询工具,优先使用 CANN 返回的 modelRI id,运行时不支持时回退 modelRI 地址。 2. NPUGraph 记录 CaptureId_t,并将 _currently_capturing_graphs 从 aclmdlRI key 切换为 capture id key;capture_begin/capture_end/reset/replay 以及 allocator filter 均按 capture id 处理。 3. NPUGeneratorState 新增 per-capture NPUGeneratorCaptureState map,按 capture id 保存 seed/offset tensor 和 graph 内 offset;删除 generator 侧 registered_graphs_,graph reset 时按 capture id 清理状态。 4. 新增 ACLGraph RNG 测试,覆盖两个 graph 在不同 stream replay 的 eager 对齐,以及 graph reset 后 recapture 不复用旧 capture state。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及客户面可见接口变更。内部 C++ helper 新增 TryAclmdlRIGetId、captureStatusMayInitCtx、isStreamCapturingMayInitCtx、captureIdMayInitCtx、currentStreamCaptureIdMayInitCtx、currentStreamCaptureId、captureIdFromModelRI;NPUGeneratorState capture lifecycle 方法改为传入 CaptureId_t。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 已验证: - python test/npu/test_aclgraph_rng_state.py -v - python test/npu/test_aclgraph_rng_state.py TestAclgraphRngState.test_graph_rng_concurrent_replay_on_different_streams -v - python test/npu/test_aclgraph_rng_state.py TestAclgraphRngState.test_graph_rng_reset_recapture -v 新增 test_graph_rng_concurrent_replay_on_different_streams 和 test_graph_rng_reset_recapture 用例覆盖本次改动。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41461 | 2 天前 | |
[fix] support memory reuse in launch_host_func_pending Co-authored-by: Chukun Wang<wangchukun@huawei.com> # message auto-generated for no-merge-commit merge: !36074 merge master into master [fix] support memory reuse in launch_host_func_pending Created-by: kita-ikuyo Commit-by: Chukun Wang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> https://gitcode.com/Ascend/pytorch/issues/2009 - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) launch_host_func_pending由直接传递Tensor改为传递tensor地址,由callback thread根据地址做h2h拷贝,拷贝结束后原始tensor的pinned memory可以被释放并复用。回调线程/python线程使用被拷贝的tensor值做后续print/save,并在print/save结束后释放内存,以节省运行时host内存使用。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 验证ok,修改前整网出现host oom,修改后解决。  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36074 | 2 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
fix: fix task queue aclgraph bug Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !32803 merge Pynative_fix_task_queue_aclgraph_bug_add_wait_stream_status_20260327_master into master fix: fix task queue aclgraph bug Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. **NPUCachingAllocator.h/cpp**:新增 hasCapturesUnderway(device) 接口,用于查询当前设备是否有正在进行的 ACLGraph capture。在 DeviceCachingAllocator 中加锁读取 captures_underway 容器是否为空;在 NpuCachingAllocator 顶层类中实现 override 并转发到对应 device allocator;在头文件中新增 inline 辅助函数 hasCapturesUnderway(device) 供外部调用。 2. **NPUEvent.cpp**:在 NPUEvent::block() 函数中,LaunchWaitEventTask 之后增加判断:若当前设备处于 ACLGraph capture 状态(hasCapturesUnderway 返回 true),则调用 emptyAllNPUStream() 刷新 task queue。修复了多流场景下(主流与旁路流通过 wait_stream 交互时)capture replay 结果不正确的问题。 3. **test/npu/test_aclgraph_multi_stream.py**:新增多流 ACLGraph 正确性测试,覆盖两种场景:shared-expert 旁路流 fork/join 模式、并行分支 fork/join 模式,验证 replay 后数值结果与 eager 模式一致。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 新增内部接口 NPUCachingAllocator::hasCapturesUnderway(c10::DeviceIndex device),为 NPU allocator 虚函数扩展,不属于对外客户面 API,不涉及跨仓接口变更。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 新增测试文件 test/npu/test_aclgraph_multi_stream.py,包含以下用例: - test_shared_expert_stream_capture_replay:验证 shared-expert 旁路流模式下 capture/replay 数值正确性 - test_parallel_branch_capture_replay:验证并行分支 fork-join 模式下 capture/replay 数值正确性 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!32803 | 3 个月前 | |
feat: [ACLGRAPH]support pin memory Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !34382 merge pta_add_pin_memory_pool_20260408_master into master feat: [ACLGRAPH]support pin memory Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 本次改动让 ACLGraph 捕获期间也能正常使用 pin_memory(pinned host memory),将 host allocator 接入 NPUGraph 的 mempool 私有池机制,避免 capture 期间申请到的 pinned 内存被错误回收。 1. torch_npu/csrc/core/npu/CachingHostAllocator.cpp: - NPUCachingHostAllocatorImpl 实现基类 CachingHostAllocator 的 get_current_stream() 与 stream_is_capturing() 虚接口:返回当前 NPU stream,并通过 AclmdlRICaptureGetInfo 判断该 stream 是否处于 capture 状态,使基类能正确识别 NPU 的 capture 语义。 - NPUCachingHostAllocator 重写 begin_allocate_to_pool / end_allocate_to_pool / release_pool 接口,转发到内部 impl,与设备侧 NPUCachingAllocator 的私有池接口一一对应。 2. torch_npu/csrc/core/npu/NPUGraph.cpp: - capture_begin 增加约束:当 pin_memory_expandable_segments=True 时禁止开启 ACLGraph capture。原因是 NPUExpandableHostAllocatorImpl 重写了 allocate/free/empty_cache/record_event,不与基类 CachingHostAllocator 的私有池机制对接,会导致 capture 期间分配的 pinned block 在回放时被错误回收,引发数据损坏;通过 TORCH_CHECK 显式报错,提示用户调整 PYTORCH_NPU_ALLOC_CONF。 - 在调用 NPUCachingAllocator::beginAllocateToPool 之外,同步调用 host allocator 的 begin_allocate_to_pool,将 host pinned 内存也注册到同一个 mempool_id_ 私有池中;filter 通过 NPUStream::stream(false) 取出底层 aclrtStream 后复用同一份判断逻辑,避免触发 PTA 任务队列的 flush。 - capture_end / reset 配套调用 host allocator 的 end_allocate_to_pool / release_pool,与设备侧池的生命周期保持一致。 3. torch_npu/npu/graphs.py:graph 上下文管理器进入时,在 torch.npu.empty_cache() 之后追加一次 torch_npu.npu.host_empty_cache(),避免上一次 capture 残留的 pinned cache 影响本次 capture 的内存可见性。 4. test/npu/test_aclgraph_pin_memory.py:新增 ACLGraph + pin_memory 集成测试用例,覆盖 capture/replay 期间 pin_memory 申请/释放的正确性,以及 pin_memory_expandable_segments=True 与 capture 互斥时的报错路径。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及对外公开接口的变更。新增的 get_current_stream / stream_is_capturing / begin_allocate_to_pool / end_allocate_to_pool / release_pool 都是 PTA 内部 host allocator 对 PyTorch 基类 CachingHostAllocator 的虚函数实现/重写,不会改变面向用户的 Python API 行为。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 新增 test/npu/test_aclgraph_pin_memory.py 用例,覆盖以下场景: - ACLGraph capture 期间申请 pin_memory tensor,capture 结束后 replay,结果与 eager 一致。 - 多次 capture/replay,pinned 内存释放后能被同一私有池复用,无内存泄漏。 - pin_memory_expandable_segments=True 时调用 capture_begin 应触发 TORCH_CHECK 报错,提示用户调整 PYTORCH_NPU_ALLOC_CONF。 - 通过 python test/npu/test_aclgraph_pin_memory.py 在本地 NPU 环境运行通过。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34382 | 2 个月前 | |
feat: Align ACLGraph RNG capture state Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !41461 merge pta_support_generator_per_capture_20260709_master into master feat: Align ACLGraph RNG capture state Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 > 关联 issue: #2823 (https://gitcode.com/Ascend/pytorch/issues/2823) - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. 在 AclInterface 中新增 aclmdlRIGetId 动态加载封装 TryAclmdlRIGetId;在 NPUGraphsUtils 中新增 capture id 查询工具,优先使用 CANN 返回的 modelRI id,运行时不支持时回退 modelRI 地址。 2. NPUGraph 记录 CaptureId_t,并将 _currently_capturing_graphs 从 aclmdlRI key 切换为 capture id key;capture_begin/capture_end/reset/replay 以及 allocator filter 均按 capture id 处理。 3. NPUGeneratorState 新增 per-capture NPUGeneratorCaptureState map,按 capture id 保存 seed/offset tensor 和 graph 内 offset;删除 generator 侧 registered_graphs_,graph reset 时按 capture id 清理状态。 4. 新增 ACLGraph RNG 测试,覆盖两个 graph 在不同 stream replay 的 eager 对齐,以及 graph reset 后 recapture 不复用旧 capture state。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及客户面可见接口变更。内部 C++ helper 新增 TryAclmdlRIGetId、captureStatusMayInitCtx、isStreamCapturingMayInitCtx、captureIdMayInitCtx、currentStreamCaptureIdMayInitCtx、currentStreamCaptureId、captureIdFromModelRI;NPUGeneratorState capture lifecycle 方法改为传入 CaptureId_t。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 已验证: - python test/npu/test_aclgraph_rng_state.py -v - python test/npu/test_aclgraph_rng_state.py TestAclgraphRngState.test_graph_rng_concurrent_replay_on_different_streams -v - python test/npu/test_aclgraph_rng_state.py TestAclgraphRngState.test_graph_rng_reset_recapture -v 新增 test_graph_rng_concurrent_replay_on_different_streams 和 test_graph_rng_reset_recapture 用例覆盖本次改动。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41461 | 2 天前 | |
【feat】新增第三批sk_options并更新autofusion commit id Co-authored-by: wangkai<wangkai579@huawei.com> # message auto-generated for no-merge-commit merge: !36330 merge master_sk2 into master 【feat】新增第三批sk_options并更新autofusion commit id Created-by: mihudan Commit-by: wangkai Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 issue链接: https://gitcode.com/Ascend/pytorch/issues/2004 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图  已增加测试用例,出包 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36330 | 1 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
[bugfix][master]fix aclgraph testcase Co-authored-by: y30062407<handsome0324@163.com> # message auto-generated for no-merge-commit merge: !36473 merge master_wtd into master [bugfix][master]fix aclgraph testcase Created-by: yangch0324 Commit-by: y30062407 Merged-by: ascend-robot Description: # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 **问题根因:** test_npu_fused_infer_attention_score_v2 测试用例中,softmax_lse 输出张量的预分配 shape 与算子实际输出 shape 不匹配。 具体而言: - 测试代码中 softmax_lse 被硬编码分配为 torch.empty(1, dtype=torch.float16, device="npu"),shape 为 (1,) - 但 npu_fused_infer_attention_score_v2 在 return_softmax_lse=False 时,算子实际返回的 softmax_lse shape 为 (0,)(空张量,因为不需要计算 softmax LSE) - 执行 self.assertEqual(softmax_lse.cpu(), res_src[1].cpu()) 时,assertEqual 先比较 shape,发现 torch.Size([1]) != torch.Size([0]),导致断言失败 **对比 v1 的正确做法:** v1 测试(如 test_ifa_update)使用 torch.empty_like(res_src[1], dtype=torch.float16, device="npu") 来分配 softmax_lse,自动匹配 res_src[1] 的实际 shape,不存在此问题。 **修改内容:** 将 v2 相关测试中所有硬编码的 torch.empty(1, ...) 改为 torch.empty_like(res_src[1], ...),与 v1 做法保持一致,共涉及 4 处: 1. test_npu_fused_infer_attention_score_v2(第228行):torch.empty(1,...) → torch.empty_like(res_src[1],...) 2. test_ifa_v2_update_with_auto_dispatch_capture(第163行):torch.empty(1,...) → torch.empty_like(res_src[1],...) 3. test_ifa_v2_update_with_non_out_and_auto_dispatch_capture(第192行):torch.empty(1,...) → torch.empty_like(res_src[1],...) 4. test_npu_fused_infer_attention_score_v2_no_reset(第408行):torch.empty(1,...) → torch.empty_like(res_src[1],...) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 **测试场景:** NPU ACL Graph Update 相关测试用例 **测试方法:** 执行修改后的测试用例,验证 softmax_lse 的 shape 与 res_src[1] 一致,断言不再报错 bash pytest test/npu/test_aclgraph_update.py::TestIFAAclgraphUpdate::test_npu_fused_infer_attention_score_v2 -v **验证点:** - test_npu_fused_infer_attention_score_v2:return_softmax_lse=False 时 softmax_lse shape 为 (0,),与 res_src[1] 一致,断言通过 - test_ifa_v2_update_with_auto_dispatch_capture:同上 - test_ifa_v2_update_with_non_out_and_auto_dispatch_capture:同上 - test_npu_fused_infer_attention_score_v2_no_reset:同上(当前被 skip,取消 skip 后也应通过)  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36473 | 2 个月前 | |
feat: Add ACLGraph update plans Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !38052 merge Pynative_refactor_aclgraph_update_20260519_master into master feat: Add ACLGraph update plans Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 > 关联 issue: #2338 (https://gitcode.com/Ascend/pytorch/issues/2338) - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. 新增 torch_npu._inductor.aclgraph_update_plan 模块,在 Inductor codegen 阶段生成 ACLGraph update plan,并在运行期根据 callable 属性解析 new_inputs 到 FA 类算子 actual sequence 参数的映射。 2. 在 NPU Python wrapper、MLIR/DVM wrapper、graph partition 子图 wrapper 中挂载 plan,支持 graph partition 开关下分别写入 call 或 partition_x 函数属性。 3. 在 _graph_tree record/replay 路径消费 update plan,record 后校验 plan 与真实 capture record 的顺序、算子名和可更新 key,replay 前解析为 CPU update input。 4. 将 IFA/IFA v2/FA3 等 npugraph handler 的 actual sequence 更新点改为 UPDATE_SPECS 声明式描述,并由 base handler 统一更新 args/kwargs。 5. 补充 plan 构建、plan 解析、handler 注册、wrapper emit、npugraphify callable 属性保持等单元测试,替换旧的集中测试文件。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及对外资料变更。 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及客户面可见 API 变更;新增 torch_npu._inductor.aclgraph_update_plan 为内部编译与 ACLGraph 运行期协同模块。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 已补充并验证以下单测: 1. test/npu/test_aclgraph_update_plan.py 覆盖 plan 构建、输入映射、常量解析、非法 plan 校验。 2. test/npu/test_npugraph_handler.py 覆盖 IFA/IFA v2 handler 的 UPDATE_SPECS 注册。 3. test/_inductor/test_aclgraph_update_plan_compile.py 覆盖 wrapper/graph partition emit、MLIR/DVM wrapper、npugraphify callable 属性保持等非设备单测。 4. 多版本迁移后已在 v2.7.1、v2.9.0、v2.10.0、v2.11.0、v2.12.0、master 分支通过静态检查和不涉及设备的单测验证。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!38052 | 1 个月前 | |
RNG lazy generator registration (port of pytorch#176753 + #176754) Co-authored-by: y30062407<handsome0324@163.com> # message auto-generated for no-merge-commit merge: !41608 merge master_rng into master RNG lazy generator registration (port of pytorch#176753 + #176754) Created-by: yangch0324 Commit-by: y30062407 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 将 PyTorch 社区 PR (惰性 generator 注册) https://github.com/pytorch/pytorch/pull/176753 (线程安全加固)https://github.com/pytorch/pytorch/pull/176754 移植到 torch_npu,实现 RNG 算子在 ACLGraph 中的自动注册、per-capture 状态隔离和并发安全。 依赖前置 PR https://gitcode.com/Ascend/pytorch/pull/41460 https://gitcode.com/Ascend/pytorch/pull/41461(per-capture RNG 状态基础设施)。 1. 合并 get_capture_state 与 init_capture_state 为单方法 前置 PR 定义了两个方法:get_capture_state(capture_id) 仅查询(未找到返回 nullptr),init_capture_state(capture_id) 创建并插入。本 PR 将二者合并为 get_capture_state(capture_id, create_if_not_found = false): - create_if_not_found = false:等价于旧 get_capture_state,仅查询 - create_if_not_found = true:首次调用时自动创建 NPUGeneratorCaptureState、分配 GPU tensor(seed + offset 各 1 个 int64)、插入 capture_states_ map GPU tensor 分配使用 NPUStreamGuard(getDefaultNPUStream()) 确保内存落在默认池而非图的捕获池,避免图内存泄漏检测误报。capture_states_ 的插入采用双重检查加锁(double-checked locking):先在持锁时判断不存在,释放锁后执行 GPU 分配,再持锁做二次检查后插入。 2. RNG 调用方改为惰性创建 increase()、set_philox_offset_per_thread()、philox_offset_per_thread()、philox_cuda_state() 四个方法原来在 capture_id 存在时调用 get_capture_state(id) 然后 TORCH_CHECK 非空——若用户未事先调用 register_generator_state() 则崩溃。改为调用 get_capture_state(id, true),首次 RNG 操作自动触发注册,无需用户干预。 3. 删除显式注册链路 - 删除 NPUGeneratorImpl::register_graph() — Generator → NPUGraph 的桥接方法 - 删除 NPUGraph::register_generator_state(const at::Generator&) — 旧的 C++ 层 Generator 重载 - capture_begin() 中删除 gen->register_graph(this) 和 gen->set_secondary_stream_capture_state(false) — 不再预先注册 default generator - capture_begin() 中删除 init_capture_state(capture_id_) 循环 — 不再为已注册 generator 预创建 capture state 上述四步删除后,generator 注册完全由首次 RNG 算子的惰性调用自动完成。 4. Python 绑定弃用 Graph.cpp 中 register_generator_state 的 Python 绑定改为 no-op,调用时输出 TORCH_WARN_DEPRECATION 提醒用户删除调用。Generator 状态在 RNG 算子首次执行时自动注册,旧 API 成为安全空操作。 5. replay_prologue 三步加锁协议 同一 generator 被多个 graph 引用时,不同 graph 可能在不同线程并发 replay。为保证 seed_ 和 philox_offset_per_thread_ 的读写原子性,replay_prologue() 采用三步加锁: - Step 1(持锁):在 capture_states_mutex_ 保护下快照 seed_、philox_offset_per_thread_,查找 capture_state - Step 2(释放锁):执行 capture_state->setup_for_replay()——GPU tensor fill 操作,不应持锁等待 GPU - Step 3(持锁):更新 philox_offset_per_thread_ += wholegraph_increment 6. get_capture_state 中 seed_ 锁内快照 在持锁时读取 seed_ 到局部变量 seed_for_init,释放锁后用快照值初始化 CaptureState。防止与 set_current_seed() 的线程竞争导致 GPU tensor 中的 seed 与 generator 当前 seed 不一致。 上下游组件关系 用户代码 │ no longer needs register_generator_state() ▼ Python API (graph.py) │ capture_begin() → no generator registration │ replay() → replay_prologue(capture_id_, inc) ▼ NPUGraph (C++ 核心) │ captured_generator_states_[state] = whole_graph_increment │ 全局 _currently_capturing_graphs[capture_id] = this ▼ NPUGeneratorState │ capture_states_: hash_map<CaptureId, CaptureState> │ ├── get_capture_state(id, true) → 惰性创建 ★NEW │ ├── capture_epilogue(id) → finalize() 返回总偏移 │ ├── replay_prologue(id, inc) → 三步加锁 ★NEW │ └── remove_capture_state(id) → 图销毁时清理 ▼ NPUGeneratorCaptureState (per-capture) │ seed_extragraph_ / offset_extragraph_ (GPU tensors) │ initialize / increase / finalize / setup_for_replay ▼ RNG Kernel (Dropout, Rand, etc.) │ philox_npu_state(increment) → get_capture_state(id, true) │ → 返回 PhiloxNpuState(seed_ptr, offset_ptr, offset) │ → kernel 通过指针读取 GPU tensor 中的最新值 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41608 | 5 小时前 | |
[fix]multi_stream_lazy_reclaim coredump error Co-authored-by: xuyun15<xuyun15@huawei.com> # message auto-generated for no-merge-commit merge: !42341 merge fix_multi_stream_lazy_reclaim_master into master [fix]multi_stream_lazy_reclaim coredump error Created-by: xuyun15 Commit-by: xuyun15 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 选取issue中方案2作为解决方案 ### 方案2:将 sum > kLazyQuerySize 的 process_events 移到 get_free_block 之前(推荐) 将 sum > kLazyQuerySize 触发的 process_events() 移到 get_free_block 之前,保持与原生 PyTorch 相同的安全时序。同时引入 reaped 变量避免 process_events() 的冗余二次调用。 #### 2.1 process_events() 二次调用问题分析 方案2将 process_events() 的调用拆分为两段: 1. **第一段**:sum > kLazyQuerySize 时在 get_free_block 之前调用 2. **第二段**:!block_found 时在 get_free_block 之后调用 当 sum > kLazyQuerySize 且 get_free_block() 仍然失败时,两段都会触发 process_events(),导致**同一轮 malloc() 中 process_events() 被调用两次**。 # 【资料变更】 不涉及:当前pr不涉及,但是后续会持续跟踪搜集用户诉求,逐步补齐对应的资料和用例 # 【接口变更】 不涉及 # 【功能验证】 修复前:  修复后:  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!42341 | 1 天前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
Support allocator trace tracker in NPU caching allocator Co-authored-by: zzhongmin<zhongmin23@huawei.com> # message auto-generated for no-merge-commit merge: !38686 merge master_tratra into master Support allocator trace tracker in NPU caching allocator Created-by: zzhongmin Commit-by: zzhongmin Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 将 NPU Caching Allocator 对齐到上游 CUDA 实现,补齐 Allocator Trace Tracker 回调机制,并将 mempool 关联方式从间接反查改为直接存储。 1. 新增 AllocatorTraceTracker 回调机制(NPUCachingAllocator.h + .cpp) - 新增 AllocatorTraceTracker 类型、虚方法、trace_trackers_ 成员、公共接口层转发及便捷函数,与 CUDA 接口对齐 2. record_trace 支持 tracker 回调分发(NPUCachingAllocator.cpp) - 入口条件改为 !record_history && trace_trackers_.empty(),构造 TraceEntry 后遍历 trace_trackers_ 调用回调 3. TraceEntry 新增 mempool_ 字段(NPUCachingAllocator.h) - 构造函数新增 MempoolId_t mempool = {0, 0} 参数,新增 MempoolId_t mempool_ 成员 4. PrivatePool 改为直接存储 mempool ID(NPUCachingAllocator.cpp) - 新增 id 成员,构造函数接受 MempoolId_t id - 新增 BlockPool::owner_MempoolId() 方法 - 新增 create_or_incref_pool / get_private_pool,重构 beginAllocateToPool / endAllocateToPool 5. 所有 record_trace 调用点补齐 mempool_id 参数(NPUCachingAllocator.cpp) - 8 处调用点传入 block->pool->owner_MempoolId() 6. NPUWorkspaceAllocator 补齐 TraceEntry 构造参数(NPUWorkspaceAllocator.cpp) - 3 处构造补齐 MempoolId_t{0, 0} 7. NPUPluggableAllocator 补齐接口(NPUPluggableAllocator.h + .cpp) - 新增 attachAllocatorTraceTracker override,TORCH_CHECK(false) 拒绝调用 8. 新增测试 - C++ 扩展注册回调统计 SEGMENT_ALLOC/FREE 事件,Python 测试验证两种场景下回调正确触发 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 test/npu/test_allocator_trace_tracker.py # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!38686 | 1 个月前 | |
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35539 merge code_check_lintrunner into master fix: lintrunner --all-files --take NEWLINE -a Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 文件必须以 LF 换行符结尾,不允许 CRLF(DOS 换行),执行: lintrunner --all-files --take NEWLINE -a # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35539 | 2 个月前 | |
[master]fix aoe ut Co-authored-by: DaiFu<daifu2@huawei.com> # message auto-generated for no-merge-commit merge: !27470 merge 2512AoeUt into master [master]fix aoe ut Created-by: daifu1234567 Commit-by: DaiFu Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug **What does this PR do / why do we need it**: 需要走aclop才会有aoe的dump图,现在conv2d需要切aclnn,所以用例并不会保存aoe图。 **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!27470 | 7 个月前 | |
fix ut Co-authored-by: DaiFu<daifu2@huawei.com> # message auto-generated for no-merge-commit merge: merge master into master fix ut Created-by: daifu1234567 Commit-by: DaiFu Merged-by: ascend-robot Description: fix test_binary_cross_with_logits_float16 by setting random seed See merge request: Ascend/pytorch!25307 | 9 个月前 | |
Revert "fix: fix aclnn npu_format_cast to respect allow_internal_format=False" Co-authored-by: wangzili<wangzili14@huawei.com> # message auto-generated for no-merge-commit merge: !39267 merge master into master Revert "fix: fix aclnn npu_format_cast to respect allow_internal_format=False" Created-by: wangzili121 Commit-by: wangzili Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 回退 fix aclnn npu_format_cast to respect allow_internal_format=False,删除 npu_format_cast 的 aclnn 路径中对 allow_internal_format 的处理 # 【资料变更】 当前PR不涉及,相应资料已在op-plugin仓呈现 # 【接口变更】 不涉及 # 【功能验证】 UT通过 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39267 | 28 天前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
| 2 年前 | ||
| 1 年前 | ||
[master][Fix] Fix static check errors detected by TABS Co-authored-by: thickhair<zp2165064878@163.com> # message auto-generated for no-merge-commit merge: !37810 merge TABS_fix into master [master][Fix] Fix static check errors detected by TABS Created-by: thickhair Commit-by: thickhair Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1865 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!37810 | 1 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
[feat] support custom segment_size for expandable_segments Co-authored-by: XDaoHong<xudaohong@huawei.com> # message auto-generated for no-merge-commit merge: !26375 merge master into master [feat] support custom segment_size for expandable_segments Created-by: XDaoHong Commit-by: XDaoHong Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > feature **What does this PR do / why do we need it**: 虚拟内存管理场景,增加segment_size环境变量,优化集合通信zerocopy内存映射性能 **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!26375 | 8 个月前 | |
add set_deterministic_level Co-authored-by: SCh-zx<1325467101@qq.com> # message auto-generated for no-merge-commit merge: !30390 merge master into master add set_deterministic_level Created-by: SCh_zx Commit-by: SCh-zx Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > /kind feature **What does this PR do / why do we need it**: 新增接口用于配置强一致性 **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!30390 | 5 个月前 | |
| 2 年前 | ||
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
feat(inductor): dispatcher-free _empty_strided_npu fast-path allocation Co-authored-by: liuyutong_bury<liuyutong25@huawei.com> # message auto-generated for no-merge-commit merge: !41734 merge feat/empty-strided-npu-fastpath into master feat(inductor): dispatcher-free _empty_strided_npu fast-path allocation Created-by: liuyutong_bury Commit-by: liuyutong_bury Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> https://gitcode.com/Ascend/pytorch/issues/2888 - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 Add a torch_npu._C._empty_strided_npu binding that mirrors upstream's _empty_strided_ (CUDA/XPU/MTIA) fast path for inductor-generated wrappers, bypassing the operator dispatcher. - InitNpuBindings.cpp: THPModule_empty_strided_npu METH_VARARGS stub that parses the (sizes, strides, dtype) 3-tuple directly and calls the native factory; registered in TorchNpuMethods. - TensorFactories.{h,cpp}: TORCH_NPU_API empty_strided_npu — inlines the essential empty_strided steps (storage byte-size from size/stride, single allocate, set sizes/strides, one SetDesc) without empty({0})'s RECORD_FUNCTION / NPURecordFunction guard / 0-byte resize round-trip. at::empty_strided(device='npu') is dispatched (~2us/alloc). Inductor backward graphs allocate many buffers per step, so this host overhead dominates; the fast path removes it while keeping the NPU storage-descriptor setup. # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 #### 基础功能测试 | 测试用例 | 状态 | 验证功能 | |---------|------|---------| | test/npu/test_tensor.py::TestTensor::test_empty_strided | ✅ PASSED | 基本empty_strided功能、各种shape/stride组合、空tensor处理、storage大小计算正确性 | #### API兼容性测试 | 测试用例 | 状态 | 验证功能 | |---------|------|---------| | test/npu/test_npu.py::TestNpu::test_function_torch_empty_strided | ✅ PASSED | torch.empty_strided API、不同dtype支持 | | test/test_tensor_creation_ops.py::TestTensorCreationPRIVATEUSE1::test_empty_strided_npu | ✅ PASSED | 通用tensor创建、跨设备一致性 | #### 新增测试用例验证 新增 test/npu/test_empty_strided_npu.py 测试文件,包含9个测试用例全面验证 _empty_strided_npu fast path 功能。 **测试覆盖:** - 基础功能、空tensor、多dtype支持 (float32/16, int32/8, uint8, bool) - 复杂stride模式、广播stride - 确定性计算场景torch.empty_strided一致性验证、Storage大小计算正确性 - new_empty_strided API集成、@Dtypes装饰器测试 **测试结果:** 9/9 passed ✅ **文件信息:** - 路径: test/npu/test_empty_strided_npu.py - 行数: 200行 - 运行: pytest test/npu/test_empty_strided_npu.py -v 该测试套件确保了inductor NPU内存分配fast path的功能正确性和兼容性。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41734 | 6 天前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35539 merge code_check_lintrunner into master fix: lintrunner --all-files --take NEWLINE -a Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 文件必须以 LF 换行符结尾,不允许 CRLF(DOS 换行),执行: lintrunner --all-files --take NEWLINE -a # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35539 | 2 个月前 | |
TORCH MAIN SYNC: switch to release candidate of torch 2.12 update Co-authored-by: chansinging<chenxingying2@huawei.com> Co-authored-by: Chansinging<1183520536@qq.com> # message auto-generated for no-merge-commit merge: !35103 merge main_sync_0509 into master TORCH MAIN SYNC: switch to release candidate of torch 2.12 update Created-by: chansinging Commit-by: Chansinging;chansinging Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 同步社区演进,例行更新 lintrunner规避,见[issue](https://gitcode.com/Ascend/pytorch/issues/1865) # 【修改方案】 出包参考社区改动,https://github.com/pytorch/pytorch/pull/177570/ # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 本地A3服务器和ci流水线已跑通测试  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35103 | 2 个月前 | |
| 2 年前 | ||
[feat]mempool基本结构对齐pytorch Co-authored-by: LiNuohang<linuohang@huawei.com> # message auto-generated for no-merge-commit merge: !39284 merge mempool-core into master [feat]mempool基本结构对齐pytorch Created-by: LiNuohang Commit-by: LiNuohang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 核心改动:将 MemPool 对自定义分配器的所有权从 thread-local 全局状态(MemPoolContext)改为由 PrivatePool 内部持有 shared_ptr<NPUAllocator>。 具体变更: PrivatePool 新增 allocator_ 成员,分配/释放路径不再依赖全局状态,改为 pool->owner_PrivatePool->allocator()->raw_alloc/raw_delete 删除 MemPoolContext 类及其 thread-local 全局变量 MemPool API变更:allocator() 改为 use_count(),构造函数接收 shared_ptr 而非裸指针 API 重命名:_npu_endAllocateCurrentStreamToPool → _npu_endAllocateToPool 测试重构:将 mempool 测试集中到 test_npu_allocator.py,新增 alloc/free 配对验证和 allocator 先于 tensor 删除的回归测试 # 【资料变更】 删除 MemPoolContext 类及其 thread-local 全局变量 MemPool API变更:allocator() 改为 use_count(),构造函数接收 shared_ptr 而非裸指针 重命名:_npu_endAllocateCurrentStreamToPool → _npu_endAllocateToPool # 【接口变更】 删除 MemPoolContext 类及其 thread-local 全局变量 MemPool API变更:allocator() 改为 use_count(),构造函数接收 shared_ptr 而非裸指针 重命名:_npu_endAllocateCurrentStreamToPool → _npu_endAllocateToPool # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39284 | 21 天前 | |
[sync] PR-35335: [feat]: A5 only supports INF_NAN mode Co-authored-by: weixin_47897441<wuyouqi1@h-partners.com> Co-authored-by: wanglijun55<wanglijun54@huawei.com> # message auto-generated for no-merge-commit merge: !35524 merge sync-pr35335-v2.7.1-infnan-to-master into master [sync] PR-35335: [feat]: A5 only supports INF_NAN mode Created-by: ascend-ds-bot Commit-by: weixin_47897441;wanglijun55 Merged-by: ascend-robot Description: ### 1. Origin pull request: https://gitcode.com/Ascend/pytorch/merge_requests/35335 ### 2. Original pull request related issue(s): https://gitcode.com/Ascend/pytorch/issues/1918 ### 3. Original pull request related commit(s): | Sha | Datetime | Message | |---|---|---| |[92382e10](https://gitcode.com/Ascend/pytorch/commit/92382e10973ba5780721b079332366383ec841ff)|2026-05-12 21:49:33 +0800 CST|modify ut<br>| |[1352140c](https://gitcode.com/Ascend/pytorch/commit/1352140cad591b7fc472db91eb726d1b553bd65e)|2026-05-11 20:54:16 +0800 CST|fix(npu): Ascend950 only supports INF_NAN mode, bypass env var checks<br><br>Ascend950 does not support saturation mode. When users set<br>INF_NAN_MODE_ENABLE=0 or INF_NAN_MODE_FORCE_DISABLE=1 on Ascend950,<br>the code incorrectly falls into saturation mode path, causing<br>RuntimeError: SET StreamOverflowSwitch Failed.<br><br>Add early return in IsSupportInfNan() for Ascend950 to always return<br>true, making both env vars ineffective on this device.<br><br>Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com><br>| See merge request: Ascend/pytorch!35524 | 2 个月前 | |
[master][feature][bugfix]support IPC 64k and HDK xx.xx.xx.b version Co-authored-by: Dring<17737727613@163.com> # message auto-generated for no-merge-commit merge: !41738 merge master into master [master][feature][bugfix]support IPC 64k and HDK xx.xx.xx.b version Created-by: Dring Commit-by: Dring Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> https://gitcode.com/Ascend/pytorch/issues/2919 - [✓ ] 需求 - [✕ ] 问题单 - [✕ ] issue/工单 - [✕ ] 重构优化 - [✕ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 64k pagesize,新版本HDK已支持,去除4k校验限制。同时增加HDK b版本判断分支。 版本排序语义:b-build < T版本 < RC版本 < 正式release |版本 |release |关键项 |数值| |--|--|--|--| |26.1.0 |0| (0+1)*10000| 2702010000| |26.1.0.T1| -1 |(1+1)*100| 2702000200| |26.1.0.b083| -1(不设)| +83(patch)| 2702000083| 验证:2702000083 < 2702000200 < 2702010000 → b083 < T1 < 正式版 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 64k页机器 ut验证:   4k页机器 ut验证:  driver版本验证 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [✓ ] 代码注释完备,正确记录错误日志 - [✕ ] 代码实现进行了返回值、空指针等校验 - [ ✓] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [✓ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41738 | 3 天前 | |
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35539 merge code_check_lintrunner into master fix: lintrunner --all-files --take NEWLINE -a Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 文件必须以 LF 换行符结尾,不允许 CRLF(DOS 换行),执行: lintrunner --all-files --take NEWLINE -a # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35539 | 2 个月前 | |
[sync] PR-34231: [feat] support PYTORCH_NPU_ALLOC_CONF: large_segment_size_mb Co-authored-by: ffmh<fengminghao2@huawei.com> # message auto-generated for no-merge-commit merge: !35297 merge sync-pr34231-v2.11.0_device_alloc_conf-to-master into master [sync] PR-34231: [feat] support PYTORCH_NPU_ALLOC_CONF: large_segment_size_mb Created-by: ascend-ds-bot Commit-by: ffmh Merged-by: ascend-robot Description: ### 1. Origin pull request: https://gitcode.com/Ascend/pytorch/merge_requests/34231 ### 2. Original pull request related issue(s): https://gitcode.com/Ascend/pytorch/issues/1837 https://gitcode.com/Ascend/pytorch/issues/1795 ### 3. Original pull request related commit(s): | Sha | Datetime | Message | |---|---|---| |[cb41caf6](https://gitcode.com/Ascend/pytorch/commit/cb41caf629213b22c6dbbd5fcc4a881f35401436)|2026-05-08 15:14:02 +0800 CST|fix test case<br>| |[c29273d9](https://gitcode.com/Ascend/pytorch/commit/c29273d9a602ca3a7cb8a739ff063a5139b06ff1)|2026-05-08 10:52:28 +0800 CST|fix lint<br>| |[22920c40](https://gitcode.com/Ascend/pytorch/commit/22920c404be36851784cc76d9f55b41e930315f0)|2026-05-08 10:06:46 +0800 CST|remove redundant code<br>| |[773d5eef](https://gitcode.com/Ascend/pytorch/commit/773d5eefc12a23164b17722c3628ddcf681eca96)|2026-04-23 19:24:35 +0800 CST|support PYTORCH_NPU_ALLOC_CONF: large_segment_size_mb<br>| See merge request: Ascend/pytorch!35297 | 2 个月前 | |
[feat] support environment variable LD_PRELOAD Co-authored-by: liujunzhu<liujunzhu@huawei.com> # message auto-generated for no-merge-commit merge: !34275 merge master into master [feat] support environment variable LD_PRELOAD Created-by: liujunzhu Commit-by: liujunzhu Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 用户自实现 aclrtMallocAlign32 等 ACL 符号并打包成 .so,通过 LD_PRELOAD 注入 torch_npu 进程,期望拦截对 ACL 函数的调用,但实际未被调用。 根因:torch_npu 中部分 ACL 函数(如 aclrtMallocAlign32、aclrtFreePhysical)通过 FunctionLoader::Get() 使用 dlsym(handle, name) 查找符号,该方式限定在 handle 对应的库中查找,不搜索 LD_PRELOAD 预加载的库,导致覆盖失效。而直接链接调用的 ACL 符号(如 aclrtFree)走 PLT 全局符号解析,天然支持 LD_PRELOAD。 修改方案: 1. 修改 FunctionLoader::Get() 方法,当 LD_PRELOAD 环境变量非空时,优先通过 dlsym(RTLD_DEFAULT, name) 在全局符号表中查找函数,使 LD_PRELOAD 注入的同名符号可被命中;未命中时回落原有 dlopen + dlsym(handle) 路径。 2. 以 LD_PRELOAD 非空作为门控条件,未设置时完全走旧路径,行为与修改前一致。 3. 仅修改 torch_npu/csrc/core/npu/register/FunctionLoader.cpp,不新增头文件、不改变调用方。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 测试场景:通过 LD_PRELOAD 注入自定义 aclrtMallocAlign32 实现,验证 FunctionLoader 路径的符号可被覆盖。 测试方法:子进程隔离测试,每个用例在独立子进程中设置不同 LD_PRELOAD 环境变量。 | 测试用例 | 验证内容 | |---------|---------| | 无 LD_PRELOAD | 行为与修改前一致,hook 不被调用 | | LD_PRELOAD 设置 hook so | aclrtMallocAlign32 被 hook 拦截 | | LD_PRELOAD 设置不含 ACL 符号的 so | 正确回落到原始库,功能不受影响 | | LD_PRELOAD 多 so | 先加载的 hook 优先命中 | 新增测试文件:test/npu/test_ld_preload_acl_hook.py。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34275 | 2 个月前 | |
| 2 年前 | ||
| 2 年前 | ||
AI assist developer for python dt third batch for master Co-authored-by: deepSeekya<chenzhihan6@huawei.com> # message auto-generated for no-merge-commit merge: !26524 merge master into master AI assist developer for python dt third batch for master Created-by: deepSeekya Commit-by: deepSeekya Merged-by: ascend-robot Description: 【合入说明】 AI辅助研发python dt测试用例生成。 【合入来源】 AI辅助研发需求 dt测试文件覆盖率提升。 See merge request: Ascend/pytorch!26524 | 8 个月前 | |
[feat] add ~mempool() with emptyCache Co-authored-by: xuyun15<xuyun15@huawei.com> # message auto-generated for no-merge-commit merge: !39193 merge releaseMemPool_master into master [feat] add ~mempool() with emptyCache Created-by: xuyun15 Commit-by: xuyun15 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [x] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 **目标模块 / Feature:** MemPool 析构与指定池内存释放 该改动的核心目标是:**实现 MemPool 对象析构时自动释放其关联的内存池资源**,解决 MemPool 缺少析构函数导致的内存泄漏问题。 ### 1. feature 核心工作机制 该改动实现了 MemPool 的 RAII 析构机制: - **MemPool 构造时**:记录当前设备索引 device_,生成唯一池 ID id_ - **MemPool 析构时**:调用 releasePool(device_, id_) 减少引用计数并标记可释放,再调用 emptyCache(id_) 精确释放该池的缓存内存 - **emptyCache 扩展**:新增 mempool_id 参数,支持只释放指定池的缓存,避免影响其他池 - **synchronize_and_free_events 扩展**:新增 pool 过滤参数,支持只同步特定池的事件,减少不必要的同步开销 - **graph_pool_handle 静态化**:将池 ID 生成逻辑提取为静态方法,避免创建临时 MemPool 对象:该步骤目的是保证修改前后graph行为一致,且与社区行为一致。如果NPUGraph中仍然使用临时MemPool,会由于新增的析构函数导致多次releasePool,这样导致TORCH_INTERNAL_ASSERT(it != graph_pools.end());报错 ### 2. 核心调用路径 MemPool::~MemPool() → NPUCachingAllocator::releasePool(device_, id_) // 引用计数管理 → DeviceCachingAllocator::releasePool(mempool_id) → use_count-- → 插入 graph_pools_freeable → NPUCachingAllocator::emptyCache(id_) // 缓存释放 → NPUCachingAllocator::emptyCache(check_error, free_physical, mempool_id) → DeviceCachingAllocator::emptyCache(..., mempool_id) → release_cached_blocks(..., mempool_id) → synchronize_and_free_events(..., pool) // 只同步该池事件 → release_blocks(small_blocks/large_blocks) // 释放该池缓存块 → graph_pools.erase (若 npuMalloc_count==0) ### 3. 核心数据结构 - MemPool:新增 device_ 成员(c10::DeviceIndex),新增析构函数、device() 方法、graph_pool_handle() 静态方法 - MempoolId_t:std::pair<CaptureId_t, CaptureId_t>,{0,0} 表示"未指定池" - PrivatePool:持有 use_count(图引用计数)和 npuMalloc_count(未释放分配数) - graph_pools_freeable:ska::flat_hash_map<MempoolId_t, PrivatePool*>,记录可释放的池 ### 4. 推荐阅读顺序 1. torch_npu/csrc/core/npu/NPUCachingAllocator.h:563-603 — MemPool 类定义,理解新增接口 2. torch_npu/csrc/core/npu/NPUCachingAllocator.cpp:3997-4022 — MemPool 析构函数、device()、graph_pool_handle() 实现 3. torch_npu/csrc/core/npu/NPUCachingAllocator.cpp:2181-2212 — releasePool 引用计数管理 4. torch_npu/csrc/core/npu/NPUCachingAllocator.cpp:1643-1665 — emptyCache 设备级实现 5. torch_npu/csrc/core/npu/NPUCachingAllocator.cpp:2810-2848 — release_cached_blocks 指定池释放 6. torch_npu/csrc/core/npu/NPUCachingAllocator.cpp:3000-3048 — synchronize_and_free_events 池过滤 7. torch_npu/csrc/core/npu/NPUGraph.cpp:42-47 — graph_pool_handle() 改用静态方法 8. test/npu/test_mempool_destructor.py — 测试用例 ### 5. 可能存在的API一致性以及ABI兼容性问题 1. **vtable 布局变化**:NPUAllocator 基类新增虚函数 emptyCache(bool, bool, MempoolId_t),所有继承该基类的第三方代码需重新编译 2. **MemPool 类大小变化**:新增 device_ 成员改变了 sizeof(MemPool),直接操作 MemPool 对象的已编译代码需重新编译 3. **Python 绑定不完整(涉及到api,当前需求暂不做该步骤,后续社区一致性需求补齐)**:新增的 device() 和 graph_pool_handle() 方法未绑定到 Python,Python 用户无法调用 4. **NPUPluggableAllocator 不支持(cuda带mempool_id的行为与不带mempool_id行为一致,所以暂时无需支持)**:带 mempool_id 的 emptyCache 仅打印警告,使用可插拔分配器时 MemPool 析构不会释放内存 5. **Python 侧 empty_cache 未暴露 mempool_id(涉及到api,当前需求暂不做该步骤,后续社区一致性需求补齐)**:torch.npu.empty_cache() 仍只调用无参版本,用户无法从 Python 手动释放指定池的缓存 ### 6、注意特性: 1、torch_npu/csrc/npu/MemPool.cpp : 参考cuda,pyblind过程初始化npu。解决mempool初始化未识别device的问题 2、torch_npu/csrc/core/npu/NPUCachingAllocator.cpp: 参考cuda,新增createOrIncrefPool 3、torch_npu/npu/memory.py :参考cuda,新增torch_npu._C._npu_releasePool(device_index, pool.id),解决第2点会带来use_count+1的问题 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 新增ut,库上为去掉print的版本: 优化前:  优化后:  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39193 | 24 天前 | |
【feat】mstx support push and pop Co-authored-by: mei-feiyao<meifeiyao@h-partners.com> # message auto-generated for no-merge-commit merge: !36205 merge rangem into master 【feat】mstx support push and pop Created-by: mei-feiyao Commit-by: mei-feiyao Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\https://gitcode.com/Ascend/pytorch/issues/2033 > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 对齐社区nvtx模块,补全接口,包括如下: 1、range_push、range_pop:线程粒度的打range点接口,内部走mstx库实现打点,用户可通过torch_npu.profiler接口配置mstx=True或者msproftx=True(待废弃)的方式采集tx打点数据; 2、annotate类:用户可通过with torch_npu.npu.mstx.annotate(message="xxxx", stream=xxxx, domain="tttt")的方式或者@torch_npu.npu.mstx.annotate(message="xxxx", stream=xxxx, domain="tttt")装饰器的方式对目标代码段或者目标函数进行打点,内部会在开始和结束的阶段分别调用range_push和range_pop # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 是。涉及新增接口,已联系资料同学补充资料 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 本需求只涉及新增接口,不涉及已有接口变更 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 1、UT测试验证新增接口; 2、模型代码增加调用新增的打点接口,并通过profiler采集打点数据,观察打点数据正常 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!36205 | 2 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
[feature] aclgraph support PYTORCH_NO_NPU_MEMORY_CACHING=1 master Co-authored-by: yurongkun<yurongkun@huawei.com> # message auto-generated for no-merge-commit merge: !35070 merge no_cache_master into master [feature] aclgraph support PYTORCH_NO_NPU_MEMORY_CACHING=1 master Created-by: yurongkun Commit-by: yurongkun Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > aclgraph支持PYTORCH_NO_NPU_MEMORY_CACHING 1)裸调capture时,打开PYTORCH_NO_NPU_MEMORY_CACHING不会报错,正常运行。 2)如果当前内存池无其他图持有且图内对象无依赖内存池时,释放该内存池给驱动 # 【资料变更】 > 不涉及 # 【接口变更】 > 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 新增UT看护,并运行多种场景用例。无运行报错 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35070 | 2 个月前 | |
Align NPU mixed-dtype async host-device copy behavior with CUDA Co-authored-by: zzhongmin<zhongmin23@huawei.com> # message auto-generated for no-merge-commit merge: !39573 merge master_d2h into master Align NPU mixed-dtype async host-device copy behavior with CUDA Created-by: zzhongmin Commit-by: zzhongmin Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1. 对齐 CUDA Copy.cu 的 mixed-dtype 异步 Host/Device 拷贝策略,调整 NPU OpApi 路径。 当 non_blocking=True 且 Host/Device dtype 不一致时,将可由 aclnnCast 支持的 dtype 转换前移到 NPU Device 侧完成,避免因 CPU 侧 dtype cast 产生非 pinned 临时 Tensor,导致 H2D/D2H 退化为同步拷贝。non_blocking=False 与同 dtype fast path 保持原有逻辑。 - torch_npu/csrc/aten/ops/op_api/CopyKernelOpApi.cpp - H2D:先申请源 dtype 的 NPU temporary,将 pinned/已注册 CPU 数据按源 dtype 执行同 dtype H2D 拷贝,再通过 aclnnCast 转为目标 dtype 并写回目标 Tensor。 - D2H:先在 NPU 侧通过 custom_ops::_npu_dtype_cast 转为目标 dtype,再执行同 dtype D2H 拷贝到 CPU 目标。 - D2H cast 前补充 NpuUtils::check_match(&src) 判断;当 NPU 源 Tensor 是非连续 view 或 metadata 不满足 OpApi 要求时,先通过 NpuUtils::format_contiguous(src) 规范化输入,避免 aclnnCast 直接处理不匹配的 view。 - 新增 cast_dtype_out_baseformat_opapi,封装 aclnnCast out 路径,用于 H2D mixed-dtype async 路径中将 NPU temporary 转换并写入目标 Tensor。 - 新增 should_fallback_to_cpu_cast:在 A2 及之后产品上,对 aclnnCast 不支持的 dtype 组合保留原 CPU cast 路径,避免 unsupported dtype 走设备侧 cast 失败。 2. 补充 Tensor.copy_ mixed-dtype 功能、异步行为与 fallback 测试。 - test/test_copy_.py - 覆盖 pinned CPU → NPU、NPU → pinned CPU 的 mixed-dtype copy_(non_blocking=True)。 - 覆盖 int32 -> float32、int64 -> float32、float16 -> float32、float32 -> float16、complex64 <-> complex128 等基础转换组合。 - 扩展同步/异步结果一致性用例,覆盖 bool、int8、int16、uint16、int64、float16、bfloat16、float32、complex dtype,并包含负数、边界值、小数和复数数据。 - 通过 gate_stream 上的矩阵乘任务阻塞 copy_stream,再使用 done_event.query() 验证 copy_ 返回时没有同步等待异步拷贝完成。 - 补充非连续 NPU 目标、非连续 CPU pinned 目标、非连续 NPU 源、broadcast 源、带 storage offset 的 pinned CPU slice,以及连续 mixed-dtype 异步拷贝下 temporary 生命周期测试。 - 非连续 NPU 源用例覆盖 D2H mixed-dtype 场景,验证 _npu_dtype_cast 前的 format_contiguous 保护逻辑。 - 补充 float8_e5m2、float8_e4m3fn、complex32 等 aclnnCast unsupported dtype 的 CPU cast fallback 正确性测试。 - 保留 non_blocking=False 的 H2D/D2H mixed-dtype 结果正确性回归测试。 - mixed-dtype 相关用例限定在 Ascend910B、Ascend910_93、Ascend950 上执行。 3. 补充 Tensor.to mixed-dtype 跨设备测试。 - test/npu/test_npu.py - 新增 test_to_non_blocking_different_dtype,覆盖 CPU ↔ NPU、non_blocking=True/False 的跨设备 dtype 转换。 - 验证 int32 -> float32 转换结果正确性。 - 验证 D2H 且 non_blocking=True 时输出 Tensor 保持 pinned-memory 属性。 - 用例限定在 Ascend910B、Ascend910_93、Ascend950 上执行。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39573 | 16 天前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
feat: Add ACLGraph update plans Co-authored-by: luochao60<luochao60@huawei.com> # message auto-generated for no-merge-commit merge: !38052 merge Pynative_refactor_aclgraph_update_20260519_master into master feat: Add ACLGraph update plans Created-by: luochao60 Commit-by: luochao60 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > (如有)请关联需求文档/issue链接 > 关联 issue: #2338 (https://gitcode.com/Ascend/pytorch/issues/2338) - [ ] 需求 - [x] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列 > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 1. 新增 torch_npu._inductor.aclgraph_update_plan 模块,在 Inductor codegen 阶段生成 ACLGraph update plan,并在运行期根据 callable 属性解析 new_inputs 到 FA 类算子 actual sequence 参数的映射。 2. 在 NPU Python wrapper、MLIR/DVM wrapper、graph partition 子图 wrapper 中挂载 plan,支持 graph partition 开关下分别写入 call 或 partition_x 函数属性。 3. 在 _graph_tree record/replay 路径消费 update plan,record 后校验 plan 与真实 capture record 的顺序、算子名和可更新 key,replay 前解析为 CPU update input。 4. 将 IFA/IFA v2/FA3 等 npugraph handler 的 actual sequence 更新点改为 UPDATE_SPECS 声明式描述,并由 base handler 统一更新 args/kwargs。 5. 补充 plan 构建、plan 解析、handler 注册、wrapper emit、npugraphify callable 属性保持等单元测试,替换旧的集中测试文件。 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写"不涉及" 不涉及对外资料变更。 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写"不涉及" 不涉及客户面可见 API 变更;新增 torch_npu._inductor.aclgraph_update_plan 为内部编译与 ACLGraph 运行期协同模块。 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤 > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 已补充并验证以下单测: 1. test/npu/test_aclgraph_update_plan.py 覆盖 plan 构建、输入映射、常量解析、非法 plan 校验。 2. test/npu/test_npugraph_handler.py 覆盖 IFA/IFA v2 handler 的 UPDATE_SPECS 注册。 3. test/_inductor/test_aclgraph_update_plan_compile.py 覆盖 wrapper/graph partition emit、MLIR/DVM wrapper、npugraphify callable 属性保持等非设备单测。 4. 多版本迁移后已在 v2.7.1、v2.9.0、v2.10.0、v2.11.0、v2.12.0、master 分支通过静态检查和不涉及设备的单测验证。 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!38052 | 1 个月前 | |
support torch.npu.npurt Co-authored-by: bellatan<tanmei2@huawei.com> # message auto-generated for no-merge-commit merge: !39329 merge torch_npurt into master support torch.npu.npurt Created-by: bellatan Commit-by: bellatan Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 实现方案描述:https://gitcode.com/Ascend/pytorch/issues/2504 # 【资料变更】 新增接口 torch.npu.npurt() # 【接口变更】 新增接口 torch.npu.npurt() # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39329 | 21 天前 | |
| 2 年前 | ||
add test for TORCH_ACL_INIT_CONFIG_PATH Co-authored-by: huangyunlong2022<huangyunlong4@h-partners.com> # message auto-generated for no-merge-commit merge: !39912 merge 2.13aclj into master add test for TORCH_ACL_INIT_CONFIG_PATH Created-by: huangyunlong2022 Commit-by: huangyunlong2022 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 为自定义配置acl.json路径添加校验 对自定义配置acl.json路径校验报错时添加修复提示 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39912 | 20 天前 | |
| 2 年前 | ||
[sync] PR-34238: [feat] support PYTORCH_NPU_ALLOC_CONF: per_process_memory_fraction Co-authored-by: ffmh<fengminghao2@huawei.com> # message auto-generated for no-merge-commit merge: !35472 merge sync-pr34238-v2.11.0_device_alloc_conf_ppmf-to-master into master [sync] PR-34238: [feat] support PYTORCH_NPU_ALLOC_CONF: per_process_memory_fraction Created-by: ascend-ds-bot Commit-by: ffmh Merged-by: ascend-robot Description: ### 1. Origin pull request: https://gitcode.com/Ascend/pytorch/merge_requests/34238 ### 2. Original pull request related issue(s): https://gitcode.com/Ascend/pytorch/issues/1796 https://gitcode.com/Ascend/pytorch/issues/1837 ### 3. Original pull request related commit(s): | Sha | Datetime | Message | |---|---|---| |[2192500c](https://gitcode.com/Ascend/pytorch/commit/2192500c7c6cea10d297beab3943881d7e50333d)|2026-05-09 18:25:18 +0800 CST|fix test case<br>| |[12dd3694](https://gitcode.com/Ascend/pytorch/commit/12dd36948537a5e5457be1d9d5313c37e8914363)|2026-05-09 18:25:17 +0800 CST|refactor allowed_memory_maximum according to cuda caching allocator<br>| |[92c06b95](https://gitcode.com/Ascend/pytorch/commit/92c06b95e74b7e4109d7251f24486895df7e094c)|2026-05-09 18:25:17 +0800 CST|support PYTORCH_NPU_ALLOC_CONF: per_process_memory_fraction<br>| See merge request: Ascend/pytorch!35472 | 2 个月前 | |
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35539 merge code_check_lintrunner into master fix: lintrunner --all-files --take NEWLINE -a Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 文件必须以 LF 换行符结尾,不允许 CRLF(DOS 换行),执行: lintrunner --all-files --take NEWLINE -a # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35539 | 2 个月前 | |
| 11 个月前 | ||
adapt pytorch2.13 for_inductor Co-authored-by: TonyYA<pangjiayi@huawei.com> Co-authored-by: zhoupeng<zp2165064878@163.com> # message auto-generated for no-merge-commit merge: !41858 merge pta_master0714 into master adapt pytorch2.13 for_inductor Created-by: TonyYA Commit-by: TonyYA;zhoupeng Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 https://gitcode.com/Ascend/pytorch/issues/3056 - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1、本次修改将2.10的inductor代码(截至7.11最后一笔)同步到master(2.13)分支 2、针对社区接口变动及参数调整做适配修改 3、整体架构保持与2.10 inductor一致,未做架构级别重构调整 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 端到端模型验证表格 https://onebox.huawei.com/v/6d6647cf5de9b3f8a5118370ddb7a875?type=1&sheet=master%E5%88%86%E6%94%AF%E6%A8%A1%E5%9E%8B%E6%B5%8B%E8%AF%95 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!41858 | 3 天前 | |
| 2 年前 | ||
[feat] Add disable_tensor_unsafe_check option to restart_device Co-authored-by: LiNuohang<linuohang@huawei.com> # message auto-generated for no-merge-commit merge: !35732 merge biaozang-m into master [feat] Add disable_tensor_unsafe_check option to restart_device Created-by: LiNuohang Commit-by: LiNuohang Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 需求背景: 推理场景,不需要更新权重数据,因此发生uce故障时,存在只做流恢复,不需要做数据标脏和恢复的场景。当前快恢流恢复和数据标脏通过同一个配置项rebuild_all_resources控制,导致该场景无法使用,需要为数据标脏单独增加配置项。 当前现状: 当前快恢流恢复和数据标脏通过同一个配置项rebuild_all_resources控制 具体设计方案: 描述:restart_device接口增加disable_tensor_unsafe_check开关,用于单独控制是否对数据做标脏处理 为保证兼容性,默认为False,且仅在rebuild_all_resource为True时生效,即: rebuild_all_resources = True, disable_tensor_unsafe_check = True, 不做数据标脏 rebuild_all_resources = True, disable_tensor_unsafe_check= False, 做数据标脏 rebuild_all_resources = False, disable_tensor_unsafe_check= True, 不做数据标脏 rebuild_all_resources = False, disable_tensor_unsafe_check= False, 不做数据标脏 # 【资料变更】 restart_device接口增加disable_tensor_unsafe_check开关 # 【接口变更】 restart_device接口增加disable_tensor_unsafe_check开关 # 【功能验证】 已新增UT # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35732 | 2 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
round_size pad 32 byte Co-authored-by: zhaoyu<nanzhaogang@qq.com> # message auto-generated for no-merge-commit merge: !28316 merge ascend-master into master round_size pad 32 byte Created-by: zhaoyu65 Commit-by: zhaoyu Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > /kind bug **What does this PR do / why do we need it**: round_size增加32byte,避免aclnn算子内存问题 **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!28316 | 6 个月前 | |
add record_stream sanitizer Co-authored-by: bellatan<tanmei2@huawei.com> Co-authored-by: hb_hubin<hubin79@huawei.com> # message auto-generated for no-merge-commit merge: !34841 merge record_stream_sanitizer into master add record_stream sanitizer Created-by: bellatan Commit-by: bellatan;hb_hubin Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 本地验证 1. test/npu/test_sanitizer.py  2. test/npu/test_sanitizer_record_stream.py  3. test/test_npu_sanitizer.py  4. test/test_sanitizer_pluggable_allocator.py  5. ci结果 ·UT_ARM_A2_Part_01:test/test_npu_sanitizer.py,pass  ·UT_ARM_A2_Part_02:test/npu/test_sanitizer.py,pass;test/test_sanitizer_pluggable_allocator.py pass  ·UT_ARM_A2_Part_03:test/npu/test_sanitizer_record_stream.py,pass  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34841 | 2 个月前 | |
add record_stream sanitizer Co-authored-by: bellatan<tanmei2@huawei.com> Co-authored-by: hb_hubin<hubin79@huawei.com> # message auto-generated for no-merge-commit merge: !34841 merge record_stream_sanitizer into master add record_stream sanitizer Created-by: bellatan Commit-by: bellatan;hb_hubin Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 本地验证 1. test/npu/test_sanitizer.py  2. test/npu/test_sanitizer_record_stream.py  3. test/test_npu_sanitizer.py  4. test/test_sanitizer_pluggable_allocator.py  5. ci结果 ·UT_ARM_A2_Part_01:test/test_npu_sanitizer.py,pass  ·UT_ARM_A2_Part_02:test/npu/test_sanitizer.py,pass;test/test_sanitizer_pluggable_allocator.py pass  ·UT_ARM_A2_Part_03:test/npu/test_sanitizer_record_stream.py,pass  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!34841 | 2 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
| 11 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
compat(v2.13): reintroduce csrc compat module for upstream 2.13 Co-authored-by: chz34<chenhaozhe1@huawei.com> # message auto-generated for no-merge-commit merge: !39206 merge compat/2.13_ori into master compat(v2.13): reintroduce csrc compat module for upstream 2.13 Created-by: c_34 Commit-by: chz34 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> pytorch 上游重构修改,将 shared_ptr<Node> 重构为 intrusive_ptr<Node>,主线适配上游main分支编译报错 https://github.com/pytorch/pytorch/pull/181782 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 https://gitcode.com/Ascend/pytorch/issues/1812 https://gitcode.com/Ascend/pytorch/issues/2497 https://gitcode.com/Ascend/pytorch/issues/2508 - [x] 重构优化 https://gitcode.com/Ascend/pytorch/issues/1688 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) compat(v2.13): reintroduce csrc compat module for upstream 2.13 C++ side (torch_npu/csrc/_compat/): - version.h: TORCH_NPU_VERSION_GE(MAJOR, MINOR) macro plus TORCH_NPU_MIN_SUPPORTED constants kept in sync with the Python side. - autograd.h: torch_npu::compat::GradFnPtr<T> alias and make_grad_fn<Op>(args...) wrap the Node smart pointer migration from std::shared_ptr+deleteNode (<=2.12) to c10::intrusive_ptr+make_intrusive (>=2.13, pytorch#181782). SavedForPtr covers SavedVariable::unpack's parameter type change. Hand-written C++ updated to use the alias: - VariableFallbackKernel.cpp, VariableTypeManual.cpp (grad_fn locals) - reducer.hpp (grad_accumulators_ and hooks_ element types) - torchnpugen/autograd/templates/Functions.h (unpack_list/unpack_opt_list saved_for parameter) Python side (torch_npu/_compat/utils.py): - make_config_entry(config, *, name) wraps _ConfigEntry which gained a required name parameter in PyTorch 2.12. _dynamo.patch_inductor_wrapper uses the helper instead of branching inline. torchgen's packaged emit_body and gen_autograd_functions were updated upstream alongside pytorch#181782, so no codegen post-processing is needed -- only the hand-written sources need the compat aliases. # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” 不涉及 # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” 不涉及 # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 基于现有用例 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39206 | 27 天前 | |
lazy_init Co-authored-by: 1479518308<cuiduo1@huawei.com> # message auto-generated for no-merge-commit merge: !39542 merge master into master lazy_init Created-by: cuiduo Commit-by: 1479518308 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [ ] issue/工单 - [x] 重构优化 - [ ] 资料更新 # 【修改方案】 > 在import阶段dynamo相关的patch改到compile阶段执行,具体可看关联rfc文档 # 【资料变更】 > 不涉及 # 【接口变更】 > 不涉及 # 【功能验证】 > ci验证通过 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39542 | 17 天前 | |
AI assist developer for python dt third batch for master Co-authored-by: deepSeekya<chenzhihan6@huawei.com> # message auto-generated for no-merge-commit merge: !26524 merge master into master AI assist developer for python dt third batch for master Created-by: deepSeekya Commit-by: deepSeekya Merged-by: ascend-robot Description: 【合入说明】 AI辅助研发python dt测试用例生成。 【合入来源】 AI辅助研发需求 dt测试文件覆盖率提升。 See merge request: Ascend/pytorch!26524 | 8 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
Update LocalScalarDenseNpu and include ATen/Dispatch_v2.h to support more data types. Co-authored-by: wangzhenwu7<5ge@live.com> # message auto-generated for no-merge-commit merge: !27195 merge master into master Update LocalScalarDenseNpu and include ATen/Dispatch_v2.h to support more data types. Created-by: wangzhenwu Commit-by: wangzhenwu7 Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > /kind feature **What does this PR do / why do we need it**: **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!27195 | 7 个月前 | |
[Fix] Fix static check errors detected by SPACES Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35981 merge master_lintrunner into master [Fix] Fix static check errors detected by SPACES Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 检测和删除代码中的行尾空白字符 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35981 | 2 个月前 | |
| 2 年前 | ||
AI assist developer for python DT master Co-authored-by: deepSeekya<chenzhihan6@huawei.com> # message auto-generated for no-merge-commit merge: !26305 merge master into master AI assist developer for python DT master Created-by: deepSeekya Commit-by: deepSeekya Merged-by: ascend-robot Description: 【合入说明】 AI辅助研发python dt测试用例生成。 【合入来源】 AI辅助研发需求 dt测试文件覆盖率提升。 See merge request: Ascend/pytorch!26305 | 8 个月前 | |
| 2 年前 | ||
| 1 年前 | ||
_add_deterministic_patch Co-authored-by: huangyunlong2022<huangyunlong4@h-partners.com> # message auto-generated for no-merge-commit merge: !42280 merge 2.14fill into master _add_deterministic_patch Created-by: huangyunlong2022 Commit-by: huangyunlong2022 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) 为了兼容性,新增TORCH_NPU_FILL_UNINITIALIZED_MEMORY开关用语控制npu的填充,默认关闭 为了用户使用方便,patch torch.utils.deterministic.fill_uninitialized_memory,在进行设置时,同步设置npu的填充逻辑 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!42280 | 1 天前 | |
support torch.npu.npurt Co-authored-by: bellatan<tanmei2@huawei.com> # message auto-generated for no-merge-commit merge: !39329 merge torch_npurt into master support torch.npu.npurt Created-by: bellatan Commit-by: bellatan Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [x] 需求 - [ ] 问题单 - [ ] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 实现方案描述:https://gitcode.com/Ascend/pytorch/issues/2504 # 【资料变更】 新增接口 torch.npu.npurt() # 【接口变更】 新增接口 torch.npu.npurt() # 【功能验证】  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!39329 | 21 天前 | |
| 1 年前 | ||
pta supports to create nested tensor Co-authored-by: chenshuai<chenshuai81@huawei.com> # message auto-generated for no-merge-commit merge: !29723 merge nestedTensor into master pta supports to create nested tensor Created-by: culechan Commit-by: chenshuai Merged-by: ascend-robot Description: <!-- Thanks for sending a pull request! --> **What type of PR is this?** > Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line: > > /kind bug > /kind task > /kind feature **What does this PR do / why do we need it**: **Which issue(s) this PR fixes**: <!-- *Automatically closes linked issue when PR is merged. Usage: Fixes #<issue number>, or Fixes (paste link of issue). --> Fixes # **Special notes for your reviewers**: See merge request: Ascend/pytorch!29723 | 5 个月前 | |
| 2 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 年前 | ||
| 2 天前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 3 个月前 | ||
| 2 个月前 | ||
| 2 天前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 5 小时前 | ||
| 1 天前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 7 个月前 | ||
| 9 个月前 | ||
| 28 天前 | ||
| 2 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 8 个月前 | ||
| 5 个月前 | ||
| 2 年前 | ||
| 2 个月前 | ||
| 6 天前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 年前 | ||
| 21 天前 | ||
| 2 个月前 | ||
| 3 天前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 24 天前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 16 天前 | ||
| 2 个月前 | ||
| 1 个月前 | ||
| 21 天前 | ||
| 2 年前 | ||
| 20 天前 | ||
| 2 年前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 11 个月前 | ||
| 3 天前 | ||
| 2 年前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 6 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 11 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 27 天前 | ||
| 17 天前 | ||
| 8 个月前 | ||
| 2 个月前 | ||
| 7 个月前 | ||
| 2 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 天前 | ||
| 21 天前 | ||
| 1 年前 | ||
| 5 个月前 | ||
| 2 年前 |