| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
refactor(aicpu_common): 头文件源码目录整改 Co-authored-by: Ding_Jing<dingjing19@huawei.com> # message auto-generated for no-merge-commit merge: !710 merge aicpu-common-header-split into master refactor(aicpu_common): 头文件源码目录整改 Created-by: Ding_Jing Commit-by: Ding_Jing Merged-by: cann-robot Description: ## 描述 将 pkg_inc/op_common/aicpu_common/context 下 **35 个头文件**按「谁在用」拆分到两处,使对外契约面与 opbase 内部实现在源码目录上物理隔离。**头文件内容零改动,全部为 git mv 重命名。** | 分类 | 数量 | 新位置 | | --- | --- | --- | | opbase 私有 | 17 | aicpu_common/context/{common,cpu_proto}/(与对应 .cc 同级) | | 对外公开 | 18 | include/op_common/aicpu_common/context/{common,cpu_proto,cust_op,utils}/ | 公开集 18 = 15 个被 ops-cv/ops-math/ops-nn/ops-transformer 直接 include + 3 个传递依赖(cpu_kernel_register.h、device_cpu_kernel.h 经 node_def_builder.h;log_weak.h 经 log.h)。已验证该集合闭合:**没有任何公开头 include 私有头**,依赖方向单向为 私有 → 公开。 **硬约束:装包产物零变化。** 装包目的地路径一律不动,cmake/package.cmake 只改 install 的**源路径**;opbase.xml / AicpuCommonInc.xml 无需改动,下游四仓零感知。 配套构建改动(2 个文件): - aicpu_common/context/CMakeLists.txt:aicpu_context_headers 的 include 目录 4 → 8。必需——.cc 里的 include 全是裸文件名,跨目录必须显式在 path 上。 - cmake/package.cmake 三处: 1. pkg_inc/aicpu_common 装包拆为「公开侧整目录 install + 私有 17 头 install(FILES ... PERMISSIONS)」,合并回同一目的地。私有侧不能整目录装——该目录下还有 .cc/.cpp/.proto/CMakeLists.txt,以及不属于交付集、原本就不打包的 cust_op/cust_dlog_record.h。 2. aicpu_headers_src 那 8 个路径前缀改为 include/op_common/aicpu_common/context/。 3. include/op_common 整目录 install **新增** PATTERN "aicpu_common" EXCLUDE。必需——否则 18 个公开头会被扫进 $(TARGET_ENV)/include/op_common/aicpu_common/** 产生冗余副本,且 opbase.xml 里 <copy_all>true</copy_all> 会让它们进 .run 包。 ## 关联的Issue #298 ## 测试 验证环境:远端 aarch64 + CANN 9.2.0(V100R001C11B134),gcc 13.3.0。 **1. 完整 .run 编包双向比对(核心验收)** 先编改动后版本,再 git reset --hard 回基线提交重编,比对两次 CPack makeself_staging(即打进 .run 的完整文件树): $ diff -rq baseline after | grep "^Only in" (无输出:两侧文件集合完全相同) $ diff baseline.perm after.perm 差异行数: 0 **211 个文件中 208 个逐字节一致**,其余 3 个全部是构建时间戳产物(.run 自解压包自身、opp/version.info 与 share/info/opbase/version.info 的 timestamp= 行)。权限位 0 差异。 四项重点核对(在真实 .run 内容上): | 检查项 | 期望 | 实测 | | --- | --- | --- | | pkg_inc/aicpu_common/** 头文件数 | 35 | 35 ✅ | | include/aicpu/ 头文件数 | 8 | 8 ✅ | | include/op_common/ 下无 aicpu_common | 是 | 实际 log op_graph op_host op_kernel ✅ | | cust_op/ 未混入 cust_dlog_record.h | 是 | 实际只有 cust_cpu_utils.h ✅ | **2. opbase aicpu 编译** | 侧 | 目标 | 强制重编文件数 | 错误 | | --- | --- | --- | --- | | host | aicpu_context_host + aicpu_nodedef_host | 30 | 0 | | device | aicpu_context + aicpu_nodedef + aicpu_cust_log | 54 | 0 | (首次 make 报 "Built target" 未真正重编会使验证失效,已 touch 全部 .cc/.cpp 强制重编,上表为强制重编后结果——84 个源文件真实走过新的 8 条 include 路径。) **3. 下游四仓编包,全部通过** | 仓 | 产物 | | --- | --- | | ops-math | cann-910b-ops-math_9.1.0_linux-aarch64.run | | ops-nn | cann-910b-ops-nn_9.1.0_linux-aarch64.run | | ops-cv | cann-910b-ops-cv_9.1.0_linux-aarch64.run | | ops-transformer | cann-910b-ops-transformer_9.1.0_linux-aarch64.run(全量 --pkg,574 MB) | **未覆盖项(如实说明)**:改动后的 opbase 包未安装进远端 CANN(本包版本 9.0.0、远端 CANN 9.2.0,覆盖安装有降级风险),因此下游四仓构建并未真正消费本次改动的 opbase——但由上述产物零变化的结论,功能上等价。UT / example 未执行;CANN 内部 XML 装包链路未在内部构建上实测。 ## 文档更新 无。本次仅调整源码目录结构与 install 源路径,未涉及对外文档。 ## 类型标签 <!-- [x] 表示选中 --> - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:代码结构重构(源码目录按对外可见性拆分,装包产物零变化) See merge request: cann/opbase!710 | 1 天前 |