已合并
feat:nano支持rtsPointerGetAttributes接口 #4371
maxiaofan创建于 20 天前
feat:nano支持rtsPointerGetAttributes接口 #4371
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 maxiaofan 的贡献)atomgit-bot
20 天前 评论:
20 天前 评论:
变更摘要
本 PR 为 runtime_compact 特性新增指针属性查询能力:在 HAL 层新增 pointer_attributes_hal.h 头文件,定义内存类型枚举 drvMemType_t(DRV_MEMTYPE_HOST / DRV_MEMTYPE_DEVICE)并声明 halMemGetType 接口;在 api.c 中实现 rtsPointerGetAttributes 接口,通过调用 halMemGetType 获取指针所属内存类型并填充 rtPtrAttributes_t 结构体,同时补充了对应的 UT 桩函数与测试用例。
主要改动
- 新增 HAL 接口头文件:新增
src/runtime_compact/feature/inc/pointer_attributes_hal.h,定义drvMemType_t枚举(DRV_MEMTYPE_HOST/DRV_MEMTYPE_DEVICE)并声明drvMemType_t halMemGetType(const void* p)接口。 - 新增
rtsPointerGetAttributes接口实现:在src/runtime_compact/feature/src/api.c中实现该接口,对空指针入参(ptr/attributes)返回ACL_ERROR_RT_PARAM_INVALID,用memset_s清零rtPtrAttributes_t后根据halMemGetType的结果设置attributes->location.type(RT_MEMORY_LOC_HOST或RT_MEMORY_LOC_DEVICE)。 - 新增 UT 桩函数:在
tests/ut/runtime/runtime_c/stub/rt_utest_stub.cc中增加halMemGetType的桩实现,并通过可配置的全局变量g_halMemTypeForTest控制返回的内存类型。 - 新增接口测试用例:在
tests/ut/runtime/runtime_c/testcase/feature/rt_api_test.cc中新增runtime_rtsPointerGetAttributes测试,覆盖 HOST/DEVICE 两种内存类型下的返回结果,以及ptr、attributes为空时的参数校验分支。


不准确?
atomgit-bot
20 天前 评论:
20 天前 评论:
20 天前 添加了label:cann-cla/yes
此处折叠了236条消息 查看更多
6 天前 添加了label:lgtm
CANN-robot
6 天前 评论:
6 天前 评论:
The MR can not be merged, because of CodeReview discussion not resolved
If you want to solve this problem, you can click here to do it in the FAQs.


6 天前 解决了最后一个问题
6 天前 合入了pull request
Pull Request
描述
在 Runtime Compact 中新增 rtsPointerGetAttributes 接口,通过 HAL 查询指针的 Host/Device 内存属性,并补充参数校验及 Linux、LiteOS 单元测试。
变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
描述测试此变更的步骤和前提条件:
1.
2.
核对清单
其他信息
在此添加任何其他关于本次 PR 的说明。