已合并
新增 TF plugin 编译机制 #1209
zhaowenrui创建于 20 天前
新增 TF plugin 编译机制 #1209
已合并
zhaowenrui创建于 20 天前
zhaowenrui
zhaowenrui成员
20 天前

描述

新增 ops-cv TensorFlow plugin 编译机制:

  • 增加 optf_plugin_cv target 及 --tfplugin 独立构建入口。
  • --pkg 内置包构建额外携带 liboptf_plugin_cv.so,对齐 ops-math/ops-nn 的 TF plugin 包装方式。
  • TF plugin object target 使用生成的 ge_ir.proto header 初始化,并通过 common/src/framework/cv_stub_tf_plugin.cpp 保持目标可构建。
  • 保留 add_tf_plugin_sources() 作为单算子目录显式接入入口。
  • 暂不默认自动收集各算子目录下 framework/*_tf_plugin.cpp,因为 cv 仓现有部分 TF plugin 文件依赖非公开 GE 头文件;后续文件整改后可打开 ENABLE_AUTO_TF_PLUGIN_SOURCES

关联的Issue

#706

测试

已完成:

  • bash -n build.sh scripts/build_conf.sh scripts/build_options.sh scripts/build_lib.sh
  • bash build.sh --tfplugin --ccache=off
    • Built target optf_plugin_cv_obj
    • Built target optf_plugin_cv
    • 生成 build/liboptf_plugin_cv.so
  • 确认 stub 编译进 TF plugin object:
    • build/CMakeFiles/optf_plugin_cv_obj.dir/common/src/framework/cv_stub_tf_plugin.cpp.o
  • /home/developer/.local/bin/pre-commit run --files <本 PR 修改文件>

回归结论:

  • --tfplugin 独立构建通过。
  • ENABLE_JIT 未参与 TF plugin 库目标选择,未改变现有 --jit 语义。
  • ENABLE_TEST=TRUE、非 installed CANN package 场景下 TF plugin CMake 入口直接返回,不引入 UT 路径。

注意事项:

  • 其他现有 *_tf_plugin.cpp 若仍依赖非公开 GE 头文件,需要由对应组件后续整改后再纳入自动收集。

文档更新

无。

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhaowenrui 的贡献)
zhaowenruizhaowenrui成员
20 天前 创建了 pull request,commit cee0e332
zhaowenruizhaowenrui成员
20 天前 修改了pull request 的描述
zhaowenruizhaowenrui成员
20 天前 virtual merging failed, update merge request[project_id: 7657293, iid: 1209, target_commit_sha: cee0e33217335133b6fbac2ebf224d83d84c2b27], message: Conflict detected
zhaowenruizhaowenrui成员
20 天前 强制推送  1 个提交:92078e29-feat: add tf plugin build mechanism
zhaowenruizhaowenrui成员
20 天前 virtual merging failed, update merge request[project_id: 7657293, iid: 1209, target_commit_sha: cee0e33217335133b6fbac2ebf224d83d84c2b27], message: Conflict detected
此处折叠了67条消息 查看更多
CANN-robotCANN-robot成员
14 天前 添加了label:approved
TangPC
TangPC成员
14 天前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
14 天前 添加了label:lgtm
CANN-robotCANN-robot成员
14 天前 关闭了关联的issue
CANN-robotCANN-robot成员
14 天前 合入了pull request