| Files | Last commit | Last update |
|---|---|---|
fix(codegen): Bind local buffers before skipping VIEW/RESHAPE ops Co-authored-by: anyangle<anyangle@huawei.com> # message auto-generated for no-merge-commit merge: !6280 merge codegen_master into master fix(codegen): Bind local buffers before skipping VIEW/RESHAPE ops Created-by: quadrate Commit-by: anyangle Merged-by: cann-robot Description: 问题背景: codegen对SKIP_OPCODE_FOR_CODEGEN中的op会直接continue,连GenAllocForLocalBuffer一并跳过。Mix拆leaf子图后,C,V共用同一memId的UB时,needAlloc被打在被skip的RESHAPE/VIEW输出上,codegen未bind;后续COPY_OUT读的是VIEW后的新tensor(未带needAlloc),导致codegen报SYMBOL_NOT_FOUND。 解决方案: 在 CodeGenCloudNPU::GenFuncBody / CodeGenLiteNPU::GenFuncBody 中,将 GenAllocForLocalBuffer(op, symbolMgr) 移到 SKIP_OPCODE_FOR_CODEGEN 判断之前: - skip op:仍不 GenOpCode,但会消费 in/out 上的 needAlloc 完成 bind(同一 AllocKey 二次调用 reuse,安全) - 非 skip op:行为与原来一致 See merge request: cann/pypto!6280 | 2 months ago | |
feat(codegen): Support aicore print Co-authored-by: anyangle<anyangle@huawei.com> # message auto-generated for no-merge-commit merge: !5545 merge aicore_print into master feat(codegen): Support aicore print Created-by: quadrate Commit-by: anyangle Merged-by: cann-robot Description: ### 目标 为 PyPTO AICore 代码提供 CANN asc_printf / asc_dump 的薄封装(aicore_asc_*),并在 **leaf CCE codegen** 与 **entry kernel 编译** 两条路径自动注入编译开关与头文件路径,使调试 print / dump 与 AscendC 共用同一套 ASC debug ring。 --- ### 新增文件 | 文件 | 作用 | |------|------| | framework/src/interface/machine/device/tilefwk/aicore_asc_printf.h | 封装 __asc_aicore::printf,提供 PYPTO_AICORE_PRINTF / PYPTO_AICORE_PRINTF_WITH_CORE | | framework/src/interface/machine/device/tilefwk/aicore_asc_dump.h | 封装 GM / UB / L1 / L0C 指针 dump,提供 PYPTO_AICORE_DUMP_* 宏 | | framework/src/interface/machine/device/tilefwk/aicore_asc_debug.h | 总头文件,聚合 printf + dump | --- ### 修改文件 | 文件 | 改动 | |------|------| | framework/src/codegen/npu/codegen_npu.cpp | GenInclude 固定插入 #include "tilefwk/aicore_asc_debug.h" | | framework/src/codegen/npu/cloudnpu/codegen_cloudnpu.cpp/.h | 新增 BuildIncludes,自动注入 ASC 编译 flag | | framework/src/interface/machine/device/tilefwk/aicore_entry.h | include aicore_asc_debug.h | | framework/src/machine/compile/aicore_compiler.cpp | 新增 BuildAscPrintfCompileFlags(),entry 编译路径注入 ASC flag | --- ### 核心设计 #### 1. Print 封装(aicore_asc_printf.h) - 底层调用 __asc_aicore::printf,输出格式:[core=%u][t=%lu] <用户 fmt> - include 前临时定义 __NPU_DEVICE__,跳过 CANN print_common_head(),避免打印编译期时间戳 - PYPTO_AICORE_PRINTF_CORE_ID() 规则: - entry(__MIX__ + __AIV__):get_block_idx() * get_subblockdim() + get_subblockid() + get_block_num() - leaf(仅 __AIV__):get_block_idx() - 未定义 __ENABLE_ASC_PRINTF__ 时,宏展开为 ((void)0),零运行时开销 #### 2. Dump 封装(aicore_asc_dump.h) - 基于裸指针,适配 PyPTO 无 AscendC Tensor 的编程模型 - 显式调用 asc_dump_gm / asc_dump_ubuf / asc_dump_l1buf / asc_dump_cbuf,兼容旧版 CANN - UB 指针须通过 ( __ubuf__ T*)(uint64_t)ptr 中转,禁止 float* 直接转 __ubuf__ #### 3. 编译注入(两条路径) | 路径 | 入口 | 行为 | |------|------|------| | Leaf CCE | CodeGenCloudNPU::BuildIncludes | 检测 $ASCEND_HOME_PATH/asc/include 存在时,追加 -D__ENABLE_ASC_PRINTF__ -I.../asc/include -I.../asc | | Entry kernel | aicore_compiler.cpp::BuildAscPrintfCompileFlags | 同上,使用 -isystem 注入;启用 ASC 时 warning 降为 -Wall(不用 -Werror,避免 CANN 头文件告警) | | Codegen 头 | CodeGenNPU::GenInclude | 固定 #include "tilefwk/aicore_asc_debug.h" | | Entry 头 | aicore_entry.h | 同上 include | #### 4. 其他细节 - entry 编译命令缓冲区从 **2K 扩至 4K**(-isystem 绝对路径较长,防止 snprintf 截断) - 保留 master 侧已有能力:RunBishengQuiet、requiresSimt / SIMT 编译选项 - 启用条件:**检测到 ASC 工具链即自动开启**,非 tile_fwk_config.json 配置项 --- ### 使用示例 ```cpp #include "tilefwk/aicore_asc_debug.h" // entry:推荐显式传 blockIdx,与调度对齐 PYPTO_AICORE_PRINTF_WITH_CORE(ctx->blockIdx, "taskId=%u\n", taskId); // leaf:简单打印 PYPTO_AICORE_PRINTF("before TAdd\n"); // UB dump(须 uint64_t 中转) PYPTO_AICORE_DUMP_UBUF((__ubuf__ float*)(uint64_t)ubPtr, 3, 16); // GM dump PYPTO_AICORE_DUMP_GM((__gm__ float*)gmPtr, 1, 16); See merge request: cann/pypto!5545 | 2 months ago | |
feat(codegen): Move setting paramLocation in static mode to liteNPU Co-authored-by: Bee.Hujun<Bee.hujun@huawei.com> # message auto-generated for no-merge-commit merge: !3364 merge codegen/move_gmIdx_in_static_mode into master feat(codegen): Move setting paramLocation in static mode to liteNPU Created-by: cam_bxh Commit-by: Bee.Hujun Merged-by: cann-robot Description: 1. Move setting paramLocation in static mode to liteNPU See merge request: cann/pypto!3364 | 6 months ago | |
feat(codegen): Move setting paramLocation in static mode to liteNPU Co-authored-by: Bee.Hujun<Bee.hujun@huawei.com> # message auto-generated for no-merge-commit merge: !3364 merge codegen/move_gmIdx_in_static_mode into master feat(codegen): Move setting paramLocation in static mode to liteNPU Created-by: cam_bxh Commit-by: Bee.Hujun Merged-by: cann-robot Description: 1. Move setting paramLocation in static mode to liteNPU See merge request: cann/pypto!3364 | 6 months ago |
| Files | Last commit | Last update |
|---|---|---|
| 2 months ago | ||
| 2 months ago | ||
| 6 months ago | ||
| 6 months ago |