Closed
[Requirement] Keep host constant folding independent of the AICPU device switch #5438
wby50065566Add on  Sep 18Closed at  1 day ago
wby50065566
Sep 18 Create

Backgroud(背景信息)

Host-side constant folding reuses AICPU kernel sources, but it is a built-in host capability. Gating host constant-folding OBJECT creation with ENABLE_AICPU couples it to the device-side AICPU build switch and can prevent the host constant-folding library from being generated as designed.

Origin(信息来源)

PR #10680: https://gitcode.com/cann/ops-transformer/pull/10680

Benefit / Necessity(价值/作用)

  1. Keep host constant folding available independently of device-side AICPU compilation.
  2. Align the product semantics across ops-transformer, ops-nn, ops-math, and ops-cv.
  3. Provide a consistent HOSTCPU TRUE integration path for future migrated operators.

Design(设计方案)

Remove ENABLE_AICPU from the two host constant-folding CMake gates in add_modules_sources and add_modules_sources_with_soc. Keep all existing device/custom AICPU conditions unchanged.

likedislike
wby50065566
Sep 18 Comments:

/assign

likedislike
CANN-robotCANN-robotCollaborators
Sep 18 Assign hid29204727 as responsible person
周云飞
周云飞Collaborators
Oct 14 Comments:

你好,后续PR合入是否有计划

likedislike
周云飞
周云飞Collaborators
1 day ago Comments:

感谢反馈!Host 常量折叠构建与设备侧 ENABLE_AICPU 开关的解耦已通过 !14376 实现并合入主线,两套 Host 构建入口均已调整。本仓相关需求已完成,现关闭本 Issue;后续如有问题欢迎继续反馈

likedislike
周云飞周云飞Collaborators
1 day ago changed custom state from 进行中 to 已完成
周云飞周云飞Collaborators
1 day ago Close issue
周云飞
周云飞Collaborators
1 day ago Comments:

PR #14376 已合入,补充了 Host 常量折叠的注册和构建基础设施:

  • 新增 AICPU 注册包装宏,Host 构建优先使用 V2 注册,不可用时回退 V1;其他构建沿用 V1。
  • 两套 CMake 入口均支持 HOSTCPU 参数,在满足 built-in 构建条件时创建 Host AICPU OBJECT,不受设备侧 ENABLE_AICPU 开关控制。
  • 本次未为具体算子开启 Host 常量折叠,AttentionWorkerScheduler 和 FfnWorkerScheduler 保持原有注册方式。

关联 PR:PR #14376

likedislike