已合并
【fix】: InternalAllocator::Free实现从.h文件移到.cc文件 #4014
luanchaowei创建于 7月15日
【fix】: InternalAllocator::Free实现从.h文件移到.cc文件 #4014
已合并
luanchaowei创建于 7月15日
luanchaowei成员
7月15日

Pull Request

描述

libhybrid_executor.so存在未定义符号aclrtFree问题修改

变更类型

请选择本次引入的变更类型:

关联的Issue

如何测试

描述测试此变更的步骤和前提条件:
1.安装cann包后进入cann安装目录x86_64-linux/devlib/linux/x86_64执行ldd -r libhybrid_executor.so |grep "undefined symbol" |grep -i " acl" |grep -v "acl.so"
2.预期不会存在undefined symbol: aclrtFree

核对清单

其他信息

在此添加任何其他关于本次 PR 的说明。

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 luanchaowei 的贡献)
Lluanchaowei成员
7月15日 添加了label:enhancement
Lluanchaowei成员
7月15日 创建了 pull request,commit 0affdb24
atomgit-bot
atomgit-bot
7月15日 评论:

变更摘要

本次变更将 InternalAllocator::Free 方法的实现从头文件 stream_resource.h 的内联定义移动到源文件 stream_resource.cc 中,以解决 libhybrid_executor.so 动态库中出现 aclrtFree 未定义符号(undefined symbol)的链接问题。当 Free 以内联形式定义在头文件中时,使用该头文件的其他编译单元可能无法正确解析对外部 RT 库中 aclrtFree 符号的依赖,从而导致运行时符号缺失。

主要改动

  • InternalAllocator::Free 实现位置迁移:将 Free 方法的实现从 stream_resource.h 的内联函数体移至 stream_resource.cc,使符号依赖限定在 .cc 编译单元内部,避免因头文件内联展开导致 aclrtFree 符号在不同 .so 中产生未定义引用。
  • 头文件声明精简stream_resource.hInternalAllocator::Free 从带完整实现的 override 内联函数改为纯虚函数声明 void Free(MemBlock *block) override;,不再在头文件中直接调用 aclrtFree
likedislike
atomgit-bot
atomgit-bot
7月15日 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
7月15日 添加了label:cann-cla/yes
此处折叠了43条消息 查看更多
tangqunzhang成员
7月15日 评论:

/lgtm

likedislike
tangqunzhang成员
7月15日 评论:

【MR评价】评价分数:3,
评价意见:
编码规范遵守度:无编码规范问题;
代码设计:不涉及代码设计;
DT质量:基本逻辑DT测试覆盖充足;

likedislike
yangyongqiang
yangyongqiang成员
7月15日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
7月15日 添加了label:approved
CANN-robotCANN-robot成员
7月15日 合入了pull request