| Files | Last commit | Last update |
|---|---|---|
feat(cost_model): 支持 Kirin9050 Cost Model 架构接入与成本规则 Co-authored-by: zhuhongyu<zhuhongyu22@h-partners.com> # message auto-generated for no-merge-commit merge: !7770 merge pr_1 into master feat(cost_model): 支持 Kirin9050 Cost Model 架构接入与成本规则 Created-by: Zhu1418539395 Commit-by: zhuhongyu Merged-by: cann-robot Description: ## 背景 Kirin9050(DAV_5101)缺少完整的 Cost Model 支持: - 没有 Kirin9050 ArchRegistry / ArchPolicy / PipeFactory 分派; - 没有可用的 opcode 表达式成本规则; - LiteNPU 静态 kernel 路径默认跳过 host control flow 和 expression 生成,导致 Cost Model 无法进入; - Pass 侧缺少统一的单 opcode 成本查询接口。 本 PR 一次性完成 Kirin9050 Cost Model 的架构接入、成本规则、LiteNPU host 路径和查询接口。 ## 主要改动 ### 1. Cost Model 架构接入 - 新增 ArchRegistry / ArchPolicy,按 soc 选择 A2A3 / A5 / Kirin9050; - PipeFactory 改为通过 ArchRegistry 创建 simulator; - INDEX_PUT 在 Kirin9050 下路由到 MTE3。 ### 2. 表达式成本引擎与 Kirin9050 规则 - 引入表达式成本引擎和 Kirin9050CostCoeffs; - 支持 ADD/SUB/MUL/CAST/DIV/COPY_IN/COPY_OUT/PAIR*/INDEX_PUT/VEC_DUP 等规则; - 支持 broadcast、CAST 模式、高精度 DIV; - 新增 index_put 连续小 COPY_IN 的 COPY_FLOOR; - VEC_DUP 支持无输入、使用输出 shape 走表达式引擎。 ### 3. Pass / 标定接口 - 保留唯一 C ABI: ```c int64_t GetCyclesForPass(const OpCostRequestC* request); - 新增 C++ 接口: int64_t GetCyclesForPassCPP(...); - 默认只返回 net 成本,不包含启动项; - 支持多输入/输出 shape、独立 dtype、validShape、opModeFlag。 4. LiteNPU Cost Model host 路径 - entry.py:accuracy_level <= 1 时进入 host Cost Model,== 2 保持 launch; - backend.cpp:LiteNPU Cost Model 生成 host control flow,跳过 device control flow; - expr_generator.cpp:Cost Model 仿真模式下启用 expression dump; - PvModelImpl.h:LiteNPU 使用 CodeGenLiteNPU; - TileOpImpl.h:补充 FedProfLeafTaskProf 编译依赖。 See merge request: cann/pypto!7770 | 4 days ago | |
feat(machine): Support host ctrlflow cache by jit Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !5741 merge dev-host-ctrl-jit into master feat(machine): Support host ctrlflow cache by jit Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 1、支持通过 jit ready_on_host_tensors 配置 npu_name: cpu_name 传入配对关系,算子 kernel 传入值依赖 tensor 对应的 cpu tensor 2、支持传入值依赖 tensor 场景下在 host 侧做 controlflow cache See merge request: cann/pypto!5741 | 2 months ago | |
feat(machine): Support for 9201 Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !6940 merge dev-adapt-next into master feat(machine): Support for 9201 Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 适配 9201 特性 See merge request: cann/pypto!6940 | 19 days ago | |
refactor(machine): Drop execute-path RUNTIME_SlotMarkNeedAlloc covered by path marking Co-authored-by: songyangyang18<songyangyang18@huawei.com> # message auto-generated for no-merge-commit merge: !6754 merge clean into master refactor(machine): Drop execute-path RUNTIME_SlotMarkNeedAlloc covered by path marking Created-by: songyangyang18 Commit-by: songyangyang18 Merged-by: cann-robot Description: ## 问题背景: Execute 图上的 NeedAlloc 标记曾用于修复非 assemble 算子(如 pypto.full), 产出的 assemble 目标漏发 RUNTIME_SlotMarkNeedAlloc 的问题。 目前,IR builder 会把所有非 assemble 生产者记录到 tensorConstructFunc_,PATH 级标记constructAssembleSlotList已经覆盖这些 slot,Execute 图上的标记因此变得冗余。 ## 删除的安全性: - 每个 PATH 只有一个 root,PATH 级标记在 PATH 入口发出,早于该 root 的 RUNTIME_RootAlloc。Execute 图标记的非参数 slot 都已被 PATH 标记过,且该标志是幂等的。 - Execute 图额外标记的只有 kernel 参数 slot。运行时 ResolveOutcastAddress 对这些 slot走外部 IO 分支,从不读取 NeedAlloc 标志,因此这些标记本身不起作用。 - 作用:参数 slot 不再计入 constructAssembleNeedAllocRuntimeSlots,totalAssembleOutcastSlot 不再为它们多预留 InnerTemporal slot。 ## 问题样例: 下面的算子,out会被错误纳入assemble outcast内存分配,去掉excute路径,恢复正常。 @pypto.frontend.jit(**_JIT) def _k_out_compute_then_assemble(src: _T, out: _T): pypto.set_vec_tile_shapes(TILE, TILE) out[:] = pypto.mul(src.view([BS, HIDDEN], [0, 0]), 2.0) for i in pypto.loop(N_ROW, name="NA_OCA", idx_name="i"): pypto.set_vec_tile_shapes(TILE, TILE) v = src.view([TILE, HIDDEN], [i * TILE, 0]) pypto.assemble(pypto.mul(v, 4.0), [i * TILE, 0], out) See merge request: cann/pypto!6754 | 2 months ago | |
fix(config|frontend): Refresh JIT options when global config changes Co-authored-by: zhaojunhan<zhaojunhan1@huawei.com> # message auto-generated for no-merge-commit merge: !7567 merge fix/jit-config-refresh into master fix(config|frontend): Refresh JIT options when global config changes Created-by: nanguag Commit-by: zhaojunhan Merged-by: cann-robot Description: ## 问题 同一个 JIT kernel 在不同静态 shape 下重新编译时,可能继续使用首次创建 KernelModule 时读取的配置: - 全局 compile_monitor_enable 从 2 改为 0 后,后续编译仍输出监控信息。 - 全局 runtime_debug_mode 按 3 → 0 → 3 切换时,dump 开关未随配置变化。 ## 修改 - 每次调用 JIT kernel 时读取当前全局配置,刷新未在 @pypto.jit 中显式指定的 compile_monitor_enable 和 runtime_debug_mode;JIT 显式参数保持更高优先级。 - 将这两个配置值纳入 KernelModule 缓存键,使配置变化后创建使用新配置的模块。 - 移除三个 dump 入口对 runtime_debug_mode 首次读取结果的静态缓存。 ## 验证 使用不同静态 shape 触发重新编译: - Host DFX 用例:compile_monitor_enable 从 2 改为 0,监控输出从 178 行降为 0 行,2/2 断言通过。 - Debug DFX 用例:runtime_debug_mode 按 3 → 0 → 3 切换,三次编译分别产生 7、0、7 个 dump 文件,3/3 断言通过。 在当前测试环境中,需设置 PTO_TILE_LIB_CODE_PATH=/home/zjh/pto-isa,以使用与 PyPTO 匹配的 PTO 头文件。 ## 性能 固定 shape、复用已编译 kernel 的测量显示:刷新配置使 Python 调用路径增加约 8 µs/次;完整 NPU 调用观察到约 15 µs/次的差值,其中包含设备调度波动。 See merge request: cann/pypto!7567 | 13 days ago | |
style(all): Apply additional clang-format corrections across codebase Co-authored-by: junjieHuang<huangjunjie38@h-partners.com> # message auto-generated for no-merge-commit merge: !4883 merge style-cpp into master style(all): Apply additional clang-format corrections across codebase Created-by: junjieHuang Commit-by: junjieHuang Merged-by: cann-robot Description: Apply additional clang-format corrections across codebase See merge request: cann/pypto!4883 | 4 months ago | |
feat(cost_model): 支持 Kirin9050 Cost Model 架构接入与成本规则 Co-authored-by: zhuhongyu<zhuhongyu22@h-partners.com> # message auto-generated for no-merge-commit merge: !7770 merge pr_1 into master feat(cost_model): 支持 Kirin9050 Cost Model 架构接入与成本规则 Created-by: Zhu1418539395 Commit-by: zhuhongyu Merged-by: cann-robot Description: ## 背景 Kirin9050(DAV_5101)缺少完整的 Cost Model 支持: - 没有 Kirin9050 ArchRegistry / ArchPolicy / PipeFactory 分派; - 没有可用的 opcode 表达式成本规则; - LiteNPU 静态 kernel 路径默认跳过 host control flow 和 expression 生成,导致 Cost Model 无法进入; - Pass 侧缺少统一的单 opcode 成本查询接口。 本 PR 一次性完成 Kirin9050 Cost Model 的架构接入、成本规则、LiteNPU host 路径和查询接口。 ## 主要改动 ### 1. Cost Model 架构接入 - 新增 ArchRegistry / ArchPolicy,按 soc 选择 A2A3 / A5 / Kirin9050; - PipeFactory 改为通过 ArchRegistry 创建 simulator; - INDEX_PUT 在 Kirin9050 下路由到 MTE3。 ### 2. 表达式成本引擎与 Kirin9050 规则 - 引入表达式成本引擎和 Kirin9050CostCoeffs; - 支持 ADD/SUB/MUL/CAST/DIV/COPY_IN/COPY_OUT/PAIR*/INDEX_PUT/VEC_DUP 等规则; - 支持 broadcast、CAST 模式、高精度 DIV; - 新增 index_put 连续小 COPY_IN 的 COPY_FLOOR; - VEC_DUP 支持无输入、使用输出 shape 走表达式引擎。 ### 3. Pass / 标定接口 - 保留唯一 C ABI: ```c int64_t GetCyclesForPass(const OpCostRequestC* request); - 新增 C++ 接口: int64_t GetCyclesForPassCPP(...); - 默认只返回 net 成本,不包含启动项; - 支持多输入/输出 shape、独立 dtype、validShape、opModeFlag。 4. LiteNPU Cost Model host 路径 - entry.py:accuracy_level <= 1 时进入 host Cost Model,== 2 保持 launch; - backend.cpp:LiteNPU Cost Model 生成 host control flow,跳过 device control flow; - expr_generator.cpp:Cost Model 仿真模式下启用 expression dump; - PvModelImpl.h:LiteNPU 使用 CodeGenLiteNPU; - TileOpImpl.h:补充 FedProfLeafTaskProf 编译依赖。 See merge request: cann/pypto!7770 | 4 days ago | |
feat(pass): Add pipeall debug, fix SeqSchedule loop, update kirin tests Co-authored-by: GBowen666<libowen58@huawei.com> # message auto-generated for no-merge-commit merge: !6958 merge master into master feat(pass): Add pipeall debug, fix SeqSchedule loop, update kirin tests Created-by: GBowen666 Commit-by: GBowen666 Merged-by: cann-robot Description: Related Issue: [[Requirement|需求建议]: 新增 enable_pipe_all 全同步调试开关,修复 SeqSchedule 死循环,适配 Kirin(LiteNPU)编译链并更新 Kirin UT 用例](https://gitcode.com/cann/pypto/issues/3585) 1、feat(pass): Add pipeall debug, fix SeqSchedule loop, update kirin tests See merge request: cann/pypto!6958 | 1 month ago | |
feat(machine): Support for 9201 Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !6940 merge dev-adapt-next into master feat(machine): Support for 9201 Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 适配 9201 特性 See merge request: cann/pypto!6940 | 19 days ago | |
fix(machine): Add value depend check for ifstmt Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !7361 merge dev-fix-host-ctrl into master fix(machine): Add value depend check for ifstmt Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 检测值依赖和 insert wait_aicore_start 的时候,增加 ifstmt 的检测 See merge request: cann/pypto!7361 | 26 days ago | |
feat(machine): Support for 9201 Co-authored-by: qq_52905393<liuzhen180@huawei.com> # message auto-generated for no-merge-commit merge: !6940 merge dev-adapt-next into master feat(machine): Support for 9201 Created-by: qq_52905393 Commit-by: qq_52905393 Merged-by: cann-robot Description: 适配 9201 特性 See merge request: cann/pypto!6940 | 19 days ago | |
fix(codegen): Propagate parallel task exceptions instead of swallowing them Co-authored-by: anyangle<anyangle@huawei.com> # message auto-generated for no-merge-commit merge: !5266 merge compile_fix into master fix(codegen): Propagate parallel task exceptions instead of swallowing them Created-by: quadrate Commit-by: anyangle Merged-by: cann-robot Description: 1. 多线程 Codegen 确定性 Kernel 编译 Related Issue:[https://gitcode.com/cann/pypto/issues/2913](https://gitcode.com/cann/pypto/issues/2913) 2. Issue 背景:GenCode 内的 ExecuteParallelCompile 编译失败抛出 COMPILE_CODE_FAILED 被吞掉,leafDict[hash] = leaf 未执行,leafDict不完整。下游 ConstructCodeInfo → RunCompileAicoreKernelStage → RunEncodeStage 继续访问不完整的 leafDict,触发 std::unordered_map::at() 越界,抛出 F00003 RuntimeError: _Map_base::at 二次异常,掩盖了真实的编译错误 根因:codeGen在并行编译遇到错误抛出异常时,只记录日志,并不传播异常和终止剩余task,导致报错在第二现场F00003 RuntimeError: _Map_base::at处 解决方法:修改 ParallelExecuteAndWait,使其在 task 失败时记录错误、提前终止剩余 task、并在所有线程 join 后重新抛出首个 COMPILE_CODE_FAILED异常 修改前:  修改后:  See merge request: cann/pypto!5266 | 3 months ago | |
feat(Machine): Add FedProf and AicpuProf for machine profiling Co-authored-by: Jie Yin<yinjie27@huawei.com> # message auto-generated for no-merge-commit merge: !6980 merge pgo-framework into master feat(Machine): Add FedProf and AicpuProf for machine profiling Created-by: yinjie27_ Commit-by: Jie Yin Merged-by: cann-robot Description: feat(Machine): Add FedProf and AicpuProf for machine profiling Rework the machine-side profiling data path around a unified host profiler (FedProf). The old free-function dump machinery is replaced by a class-owned design; profiling buffers are allocated once at device init and addressed directly through DeviceArgs, so device cores no longer rely on the sharedBuffer slot to locate their per-core prof data. Changes: - Add the FedProf singleton: owns per-core prof buffers, the AICPU launch-round prof buffer, the dump thread and JSON dumping; split into fed_prof.{h,cpp}, fed_prof_aicpu_prof.cpp and fed_prof_io_json.{h,cpp}; remove dump_device_perf.* and runtime/runner/device_perf.* - Add DeviceArgs::perCoreProfAddr / aicpuProfAddr; per-core prof slots are addressed as perCoreProfAddr + idx * FED_PROF_PER_CORE_PROF_ALIGNED_SIZE, and aicore entry/dfx/drco, the AICPU task manager, AICoreHAL and the ESL model are updated accordingly; SHAK_BUF_PER_CORE_PROF_INDEX is removed - Allocate per-core prof data as a single contiguous 512B-aligned block at device init (DeviceDfx::Init -> FedProf::PerCoreProfAllocateData), gated by DUMP_DEVICE_PERF / HostProf / runtime debug mode, idempotent and released together with the AICPU prof buffer - Add AICPU launch-round profiling (FedProfAicpuProf): dump thread, swimlane JSON and machine_perf_trace.py integration, output via KEY_AICPU_PERF_GRAPH_PATH - Reorganize device headers: add aikernel_profile.h (prof structures and sizes) and aikernel_launch.h (KernelArgs/KernelSharedBuffer/TaskEntry/ParallelDevTask moved out of aicpu_common.h); rename aicpu_perf.h to aikernel_profile_aicpu.h and update the CMake install list - Update UT/ST cases, the ESL model hook and launcher call sites to the new interfaces Commits: - feat(Machine): Add FedProf as the profiler - feat(Machine): Add AicpuProf for profiling - feat(Machine): Normalize AicpuProf - feat(Machine): Normalize profiling allocation See merge request: cann/pypto!6980 | 1 month ago | |
style(all): Apply additional clang-format corrections across codebase Co-authored-by: junjieHuang<huangjunjie38@h-partners.com> # message auto-generated for no-merge-commit merge: !4883 merge style-cpp into master style(all): Apply additional clang-format corrections across codebase Created-by: junjieHuang Commit-by: junjieHuang Merged-by: cann-robot Description: Apply additional clang-format corrections across codebase See merge request: cann/pypto!4883 | 4 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 4 days ago | ||
| 2 months ago | ||
| 19 days ago | ||
| 2 months ago | ||
| 13 days ago | ||
| 4 months ago | ||
| 4 days ago | ||
| 1 month ago | ||
| 19 days ago | ||
| 26 days ago | ||
| 19 days ago | ||
| 3 months ago | ||
| 1 month ago | ||
| 4 months ago |