| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix(operation): Make Round Behave Consistently With AscendC. Co-authored-by: Creeeeper<liuyizhe6@huawei.com> # message auto-generated for no-merge-commit merge: !5889 merge fix-round into master fix(operation): Make Round Behave Consistently With AscendC. Created-by: Creeeeper Commit-by: Creeeeper Merged-by: cann-robot Description: ## 描述 Round算子与AscendC对齐: 1. 移除对int16数据类型的支持。 2. 输入为整数类型时decimals参数仅支持默认值0。 ## 测试 完成冒烟测试 ## 关联Issue [#3211](https://gitcode.com/cann/pypto/issues/3211) ## 类型标签 - [x] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [ ] 其他,请描述: See merge request: cann/pypto!5889 | 2 个月前 | |
feat(pypto_pro): support phase param in pl.move for Acc->Vec unit_flag sync Co-authored-by: m0_55221889<chenliwen12@huawei.com> # message auto-generated for no-merge-commit merge: !5493 merge feat/move-uni-flag-support into master feat(pypto_pro): support phase param in pl.move for Acc->Vec unit_flag sync Created-by: m0_55221889 Commit-by: m0_55221889 Merged-by: cann-robot Description: # PR: move 指令支持 phase 参数(unit_flag 硬件握手) ## 背景 pl.move() 搬运累加器数据时,此前依赖软件 mutex(get_buf/rls_buf)与 matmul 生产者同步。软件 mutex 占用指令槽,阻碍 cube 与 L0C 排空背靠背执行。 matmul(AccPhase)和 store(STPhase)已支持通过 phase 参数启用 unit_flag 硬件握手替代软件 mutex。move 作为 L0C 的消费者(与 store 同角色),此前缺失此能力。 ## 改动内容 为 pl.move() 添加 phase: Optional[STPhase] 参数,使累加器搬运路径启用硬件 unit_flag 握手。覆盖从 IR op 注册到 backend codegen 的全链路,以及测试和文档。 **功能层(5 文件)**: - IR op 注册 .set_attr<int>("phase") - DSL API 添加 phase 参数 + 3 项校验(类型/路径/offset 互斥),与 store 校验对齐 - IR builder 打包 phase kwarg → auto_mutex phase-skip 元组添加 "move" 跳过 Acc tile 软件 mutex - backend codegen 调用 GetSTPhaseCCE 发射 TMOV<STPhase::Final, ...> 模板参数。 **测试(2 文件)**: 3 个 C++ UT 验证 codegen 模板参数 1 个 Python ST 在 Ascend950 验证 matmul(phase)+move(phase) 链路精度与无死锁。 **文档(1 文件)**: phase.md 补充 move 作为消费者使用 STPhase 的用法、路径限制、配对规则。 ## 硬件机制 unit_flag 是 Cube(M pipe,写 L0C)与 Fixpipe(FIX pipe,L0C→UB 排空)之间的硬件握手位,编码在 TMOV 的 Xt[33:32] 寄存器位。启用后硬件自动同步 cube 写入与 fixpipe 读取,无需软件 mutex 占用指令槽。 调用链: pl.move(vec, acc, phase=pl.STPhase.Final) → IR: block.move {phase=STPhase.Final} → auto_mutex: 跳过 Acc tile 的 get_buf/rls_buf → codegen: TMOV<STPhase::Final, DstType, SrcType, ...>(dst, src) → TMovCcToUb<Phase=STPhase::Final> → copy_matrix_cc_to_ub(unitFlagCtrl=0x3) → Xt[33:32] = 0b11 → 硬件握手 ## 设计决策 | 决策 | 理由 | |---|---| | 复用 STPhase 枚举(不新建 MovePhase) | move 是 L0C 消费者,与 store 同角色;硬件 TMOV/TSTORE 共用同一 STPhase 枚举 | | 仅限 Acc→Vec 路径 | unit_flag 是 fixpipe(L0C→UB)特有机制;Mat→Left/Right 走 MTE1 pipe,无 unit_flag | | phase + fp_tile 不互斥 | 硬件 TMOV_FP 支持 STPhase(pto_instr.hpp line 1374),ReluPreMode 有默认值 | | phase + offset 互斥 | offset 触发 TEXTRACT(L0C→L1,不走 fixpipe),phase 会被静默丢弃导致 auto_mutex 跳过但无硬件同步 → 死锁 | ## 验证 ### C++ UT BackendCCEBlockOutOps 全套 78/78 PASSED(含 3 个新 phase UT)。 ### Python ST | 测试 | 结果 | |---|---| | test_move_phase.py(Ascend950PR 真机) | PASSED (23.46s),精度通过,无死锁 | | move 回归(test_cube_datacopy_api_basic + test_scale_move_dtype + test_doc_memory_movement) | 57/57 PASSED | ### A/B 测试 diff 分析 测试 case: python TILE = 128 K_SIZE = 256 @pl.jit(auto_mutex=True) def move_phase_kernel( a: pl.Tensor[[pl.DYNAMIC, pl.DYNAMIC], pl.DT_FP16], b: pl.Tensor[[K_SIZE, TILE], pl.DT_FP16], out: pl.Tensor[[TILE, TILE], pl.DT_FP32], ): a_l1 = pl.make_tile_group( type=pl.TileType(shape=[TILE, TILE], dtype=pl.DT_FP16, target_memory=pl.MemorySpace.Mat), addrs=0x00000, mutex_ids=[0, 1]) b_l1 = pl.make_tile_group( type=pl.TileType(shape=[TILE, TILE], dtype=pl.DT_FP16, target_memory=pl.MemorySpace.Mat), addrs=0x20000, mutex_ids=[2, 3]) a_l0a = pl.make_tile_group( type=pl.TileType(shape=[TILE, TILE], dtype=pl.DT_FP16, target_memory=pl.MemorySpace.Left), addrs=0x0000, mutex_ids=[4, 5]) b_l0b = pl.make_tile_group( type=pl.TileType(shape=[TILE, TILE], dtype=pl.DT_FP16, target_memory=pl.MemorySpace.Right), addrs=0x0000, mutex_ids=[6, 7]) c_l0c = pl.make_tile_group( type=pl.TileType(shape=[TILE, TILE], dtype=pl.DT_FP32, target_memory=pl.MemorySpace.Acc, fractal=1024), addrs=0x0000, mutex_ids=[8]) vec_tile_group = pl.make_tile_group( type=pl.TileType(shape=[TILE, TILE], dtype=pl.DT_FP32, target_memory=pl.MemorySpace.Vec), addrs=0x0000, mutex_ids=[9]) mat_res = vec_tile_group.current() with pl.section_cube(): pl.system.set_mm_layout_transform(enabled=True) ac = c_l0c.current() for k in pl.range(0, K_SIZE, TILE): cur_a = a_l1.next() cur_b = b_l1.next() al = a_l0a.next() br = b_l0b.next() pl.load(cur_a, a, [0, k]) pl.load(cur_b, b, [k, 0]) pl.move(al, cur_a) pl.move(br, cur_b) if k == 0: pl.matmul(ac, al, br, phase=pl.AccPhase.Partial) else: pl.matmul_acc(ac, ac, al, br, phase=pl.AccPhase.Final) # diff: pl.move(mat_res, ac, acc_to_vec_mode=pl.AccToVecMode.SingleModeVec0, phase=pl.STPhase.Final) pl.move(mat_res, ac, acc_to_vec_mode=pl.AccToVecMode.SingleModeVec0) pl.system.set_cross_core(pipe=pl.PipeType.FIX, event_id=0) pl.system.set_mm_layout_transform(enabled=False) with pl.section_vector(): sub_id = pl.get_subblock_idx() pl.system.wait_cross_core(pipe=pl.PipeType.MTE3, event_id=0) if sub_id == 0: pl.store(out, mat_res, [0, 0]) pl.system.bar_all() matmul 测试 kernel 除 move 调用有无 phase=STPhase.Final 外完全相同,生成的 kernel.cpp 仅有 3 行有效差异,可以说明改动生效:  ## 用法示例 python @pl.jit(auto_mutex=True) def kernel(a, b, out): with pl.section_cube(): ac = c_l0c.current() for k in pl.range(0, K, TILE): pl.move(al, a_l1.next()) pl.move(br, b_l1.next()) if k == 0: pl.matmul(ac, al, br, phase=pl.AccPhase.Partial) else: pl.matmul_acc(ac, ac, al, br, phase=pl.AccPhase.Final) # move 启用 unit_flag 硬件握手,替代软件 mutex pl.move(vec_tile, ac, phase=pl.STPhase.Final) with pl.section_vector(): pl.store(out, vec_tile, [0, 0]) See merge request: cann/pypto!5493 | 2 个月前 | |
feat(machine): Enable launch early start Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !5932 merge dev-launch-early into master feat(machine): Enable launch early start Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 1、当前在未配置提前发射开关时,会根据芯片型号判断:(1)A5 芯片不执行提前发射;(2)其余芯片开启提前发射 2、需要修改根据是否存在值依赖和是否配置 ready on host tensor 来判断是否执行提前发射:如果没有值依赖或者配置了 ready on host tensor 配置项,则进行提前发射,否在不开启提前发射。 See merge request: cann/pypto!5932 | 2 个月前 | |
fix(docs): Adjust the directory structure Co-authored-by: lyz0328<liyanzhen@huawei.com> # message auto-generated for no-merge-commit merge: !5952 merge master into master fix(docs): Adjust the directory structure Created-by: lyz0328 Commit-by: lyz0328 Merged-by: cann-robot Description: Pro文档合入PyPTO现有文档体系 See merge request: cann/pypto!5952 | 2 个月前 | |
Initial commit | 10 个月前 | |
fix the incompatibility between pytest_forked 1.7.5 and torch_npu Co-authored-by: chen_chenn<chenchen167@huawei.com> # message auto-generated for no-merge-commit merge: !5843 merge master into master fix the incompatibility between pytest_forked 1.7.5 and torch_npu Created-by: chen_chenn Commit-by: chen_chenn Merged-by: cann-robot Description: 修复python3 -m pytest "$TARGET" -v --durations=0 -s --capture=no --rootdir=/tmp/devx_workspace --forked 报错 python/tests/st/frontend/test_function_kernel.py::test_add_with_kwargs_check_stable FAILED msg = (f"NPU call failed lazily at initialization with error: {str(e)}\n\n" raise RuntimeError( "Cannot re-initialize NPU in forked subprocess. To use NPU with " E RuntimeError: Cannot re-initialize NPU in forked subprocess. To use NPU with multiprocessing, you must use the 'spawn' start method /usr/local/lib/python3.11/site-packages/torch_npu/npu/__init__.py:269: RuntimeError FAILED python/tests/st/frontend/test_function_kernel.py::test_add_with_kwargs_check_stable ============================== 1 failed in 0.52s =============================== See merge request: cann/pypto!5843 | 2 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 10 个月前 | ||
| 2 个月前 |