| 【PR】新增 aclrtBinaryGetFunctionCount接口 Co-authored-by: weixin_47917346<zhangjunyu23@huawei.com> # message auto-generated for no-merge-commit merge: !4285 merge master into master 【PR】新增 aclrtBinaryGetFunctionCount接口 Created-by: weixin_47917346 Commit-by: weixin_47917346 Merged-by: cann-robot Description: # 新增 aclrtBinaryGetFunctionCount接口 ## 描述 **功能**:查询算子二进制文件中核函数总数 **函数签名**:aclError aclrtBinaryGetFunctionCount(aclrtBinHandle binHandle, uint32_t *count); **ACL层** 新增 aclrtBinaryGetFunctionCount 函数声明 新增 wrapper 宏注册 新增 aclrtBinaryGetFunctionCountImpl 实现,负责参数校验(binHandle/count 非空检查)并调用 RT 层 rtBinaryGetFunctionCount **RT层** 新增 rtBinaryGetFunctionCount 函数声明 新增 rtBinaryGetFunctionCount 实现,负责 handle 校验并调用 Api 层虚函数 **Api 基类与实现** 新增 BinaryGetFunctionCount 纯虚函数声明 src/runtime/core/src/api_impl/api_impl.cc:实现核心业务逻辑,通过 Program::GetKernelNameMap().size() 获取实际注册成功的 kernel 数量 **装饰器链** api_decorator.hpp/.cc:透传实现 api_error.hpp/.cc:RT 层参数校验(binHandle/count 非空检查) **单元测试** tests/depends/acl_stub.h:新增 rtBinaryGetFunctionCount 虚函数声明和 MOCK_METHOD2 tests/depends/runtime/src/runtime_stub.cpp:新增 stub 默认实现和全局转发函数 tests/ut/acl/testcase/acl_runtime_unittest.cpp:新增 2 个测试用例,覆盖参数校验、RT 层错误透传、正常路径 **示例** 新增上机示例example/2_advanced_features/kernel/3_binary_get_function_count:将add_custom/sub_custom/mul_custom三个 Ascendc 核函数编译到同一个独立算子二进制文件中,然后按以下步骤执行: 1. **加载文件**:调用aclrtBinaryLoadFromFile加载自己编写并编译好的算子二进制文件。 2. **查询核函数数量**:调用 aclrtBinaryGetFunctionCount 获取二进制中的核函数总数。 3. **按名称获取核函数句柄**:已知核函数名称,调用 aclrtBinaryGetFunction 逐个获取对应的核函数句柄。 4. **查询核函数信息**:调用 aclrtGetFunctionName 获取核函数名称,调用 aclrtGetFunctionAddr 获取核函数在 Device 上的代码地址。 5. **准备输入数据**:分配 Host 和 Device 内存,将输入数据拷贝到 Device。 6. **下发执行并验证**:调用 aclrtLaunchKernelWithHostArgs 分别下发三个核函数,同步等待执行完成后将结果拷贝回 Host 并校验。 **example测试结果** [STEP 1] Querying the number of kernel functions in the binary [INFO] aclrtBinaryGetFunctionCount returned 3 functions [STEP 2] Getting function handles by name [STEP 3] Querying function names and addresses [INFO] function[0]: name=add_custom, handle=0xaaaaf0650698, aic=(nil), aiv=0x124000000000 [INFO] function[1]: name=sub_custom, handle=0xaaaaf06510f8, aic=(nil), aiv=0x124000001460 [INFO] function[2]: name=mul_custom, handle=0xaaaaf0650bc8, aic=(nil), aiv=0x124000000a30 [STEP 4] Preparing input data [STEP 5] Launching kernels and verifying results [INFO] add_custom result verified [INFO] sub_custom result verified [INFO] mul_custom result verified [SUCCESS] aclrtBinaryGetFunctionCount sample passed ## 变更类型 请选择本次引入的变更类型: - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 如何测试 1. bash build.sh编译通过 2. UT 用例通过 3. 示例 example/2_advanced_features/kernel/3_binary_get_function_count/main.cpp 上机验证 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 See merge request: cann/runtime!4285 | 1 个月前 |
| 【PR】新增 aclrtBinaryGetFunctionCount接口 Co-authored-by: weixin_47917346<zhangjunyu23@huawei.com> # message auto-generated for no-merge-commit merge: !4285 merge master into master 【PR】新增 aclrtBinaryGetFunctionCount接口 Created-by: weixin_47917346 Commit-by: weixin_47917346 Merged-by: cann-robot Description: # 新增 aclrtBinaryGetFunctionCount接口 ## 描述 **功能**:查询算子二进制文件中核函数总数 **函数签名**:aclError aclrtBinaryGetFunctionCount(aclrtBinHandle binHandle, uint32_t *count); **ACL层** 新增 aclrtBinaryGetFunctionCount 函数声明 新增 wrapper 宏注册 新增 aclrtBinaryGetFunctionCountImpl 实现,负责参数校验(binHandle/count 非空检查)并调用 RT 层 rtBinaryGetFunctionCount **RT层** 新增 rtBinaryGetFunctionCount 函数声明 新增 rtBinaryGetFunctionCount 实现,负责 handle 校验并调用 Api 层虚函数 **Api 基类与实现** 新增 BinaryGetFunctionCount 纯虚函数声明 src/runtime/core/src/api_impl/api_impl.cc:实现核心业务逻辑,通过 Program::GetKernelNameMap().size() 获取实际注册成功的 kernel 数量 **装饰器链** api_decorator.hpp/.cc:透传实现 api_error.hpp/.cc:RT 层参数校验(binHandle/count 非空检查) **单元测试** tests/depends/acl_stub.h:新增 rtBinaryGetFunctionCount 虚函数声明和 MOCK_METHOD2 tests/depends/runtime/src/runtime_stub.cpp:新增 stub 默认实现和全局转发函数 tests/ut/acl/testcase/acl_runtime_unittest.cpp:新增 2 个测试用例,覆盖参数校验、RT 层错误透传、正常路径 **示例** 新增上机示例example/2_advanced_features/kernel/3_binary_get_function_count:将add_custom/sub_custom/mul_custom三个 Ascendc 核函数编译到同一个独立算子二进制文件中,然后按以下步骤执行: 1. **加载文件**:调用aclrtBinaryLoadFromFile加载自己编写并编译好的算子二进制文件。 2. **查询核函数数量**:调用 aclrtBinaryGetFunctionCount 获取二进制中的核函数总数。 3. **按名称获取核函数句柄**:已知核函数名称,调用 aclrtBinaryGetFunction 逐个获取对应的核函数句柄。 4. **查询核函数信息**:调用 aclrtGetFunctionName 获取核函数名称,调用 aclrtGetFunctionAddr 获取核函数在 Device 上的代码地址。 5. **准备输入数据**:分配 Host 和 Device 内存,将输入数据拷贝到 Device。 6. **下发执行并验证**:调用 aclrtLaunchKernelWithHostArgs 分别下发三个核函数,同步等待执行完成后将结果拷贝回 Host 并校验。 **example测试结果** [STEP 1] Querying the number of kernel functions in the binary [INFO] aclrtBinaryGetFunctionCount returned 3 functions [STEP 2] Getting function handles by name [STEP 3] Querying function names and addresses [INFO] function[0]: name=add_custom, handle=0xaaaaf0650698, aic=(nil), aiv=0x124000000000 [INFO] function[1]: name=sub_custom, handle=0xaaaaf06510f8, aic=(nil), aiv=0x124000001460 [INFO] function[2]: name=mul_custom, handle=0xaaaaf0650bc8, aic=(nil), aiv=0x124000000a30 [STEP 4] Preparing input data [STEP 5] Launching kernels and verifying results [INFO] add_custom result verified [INFO] sub_custom result verified [INFO] mul_custom result verified [SUCCESS] aclrtBinaryGetFunctionCount sample passed ## 变更类型 请选择本次引入的变更类型: - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 如何测试 1. bash build.sh编译通过 2. UT 用例通过 3. 示例 example/2_advanced_features/kernel/3_binary_get_function_count/main.cpp 上机验证 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 See merge request: cann/runtime!4285 | 1 个月前 |
| 【PR】: 文档一致性修改 Co-authored-by: weixin_47917346<zhangjunyu23@huawei.com> # message auto-generated for no-merge-commit merge: !4610 merge master into master 【PR】: 文档一致性修改 Created-by: weixin_47917346 Commit-by: weixin_47917346 Merged-by: cann-robot Description: # 文档一致性修改 ## 描述 3_binary_get_function_count 的 README 缺少产品支持表,其他用例(0_launch_kernel、1_launch_kernel_with_reslimit)均有产品支持表,这两个用例缺失,不符合文档一致性要求。按照0_launch_kernel的README格式内容修改 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 See merge request: cann/runtime!4610 | 1 个月前 |
| 【PR】: 文档一致性修改 Co-authored-by: weixin_47917346<zhangjunyu23@huawei.com> # message auto-generated for no-merge-commit merge: !4610 merge master into master 【PR】: 文档一致性修改 Created-by: weixin_47917346 Commit-by: weixin_47917346 Merged-by: cann-robot Description: # 文档一致性修改 ## 描述 3_binary_get_function_count 的 README 缺少产品支持表,其他用例(0_launch_kernel、1_launch_kernel_with_reslimit)均有产品支持表,这两个用例缺失,不符合文档一致性要求。按照0_launch_kernel的README格式内容修改 ## 变更类型 请选择本次引入的变更类型: <!-- [x] 表示选中 --> - [ ] 🐛 Bug 修复 - [ ] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [x] 📝 文档内容更新 See merge request: cann/runtime!4610 | 1 个月前 |
| 【PR】新增 aclrtBinaryGetFunctionCount接口 Co-authored-by: weixin_47917346<zhangjunyu23@huawei.com> # message auto-generated for no-merge-commit merge: !4285 merge master into master 【PR】新增 aclrtBinaryGetFunctionCount接口 Created-by: weixin_47917346 Commit-by: weixin_47917346 Merged-by: cann-robot Description: # 新增 aclrtBinaryGetFunctionCount接口 ## 描述 **功能**:查询算子二进制文件中核函数总数 **函数签名**:aclError aclrtBinaryGetFunctionCount(aclrtBinHandle binHandle, uint32_t *count); **ACL层** 新增 aclrtBinaryGetFunctionCount 函数声明 新增 wrapper 宏注册 新增 aclrtBinaryGetFunctionCountImpl 实现,负责参数校验(binHandle/count 非空检查)并调用 RT 层 rtBinaryGetFunctionCount **RT层** 新增 rtBinaryGetFunctionCount 函数声明 新增 rtBinaryGetFunctionCount 实现,负责 handle 校验并调用 Api 层虚函数 **Api 基类与实现** 新增 BinaryGetFunctionCount 纯虚函数声明 src/runtime/core/src/api_impl/api_impl.cc:实现核心业务逻辑,通过 Program::GetKernelNameMap().size() 获取实际注册成功的 kernel 数量 **装饰器链** api_decorator.hpp/.cc:透传实现 api_error.hpp/.cc:RT 层参数校验(binHandle/count 非空检查) **单元测试** tests/depends/acl_stub.h:新增 rtBinaryGetFunctionCount 虚函数声明和 MOCK_METHOD2 tests/depends/runtime/src/runtime_stub.cpp:新增 stub 默认实现和全局转发函数 tests/ut/acl/testcase/acl_runtime_unittest.cpp:新增 2 个测试用例,覆盖参数校验、RT 层错误透传、正常路径 **示例** 新增上机示例example/2_advanced_features/kernel/3_binary_get_function_count:将add_custom/sub_custom/mul_custom三个 Ascendc 核函数编译到同一个独立算子二进制文件中,然后按以下步骤执行: 1. **加载文件**:调用aclrtBinaryLoadFromFile加载自己编写并编译好的算子二进制文件。 2. **查询核函数数量**:调用 aclrtBinaryGetFunctionCount 获取二进制中的核函数总数。 3. **按名称获取核函数句柄**:已知核函数名称,调用 aclrtBinaryGetFunction 逐个获取对应的核函数句柄。 4. **查询核函数信息**:调用 aclrtGetFunctionName 获取核函数名称,调用 aclrtGetFunctionAddr 获取核函数在 Device 上的代码地址。 5. **准备输入数据**:分配 Host 和 Device 内存,将输入数据拷贝到 Device。 6. **下发执行并验证**:调用 aclrtLaunchKernelWithHostArgs 分别下发三个核函数,同步等待执行完成后将结果拷贝回 Host 并校验。 **example测试结果** [STEP 1] Querying the number of kernel functions in the binary [INFO] aclrtBinaryGetFunctionCount returned 3 functions [STEP 2] Getting function handles by name [STEP 3] Querying function names and addresses [INFO] function[0]: name=add_custom, handle=0xaaaaf0650698, aic=(nil), aiv=0x124000000000 [INFO] function[1]: name=sub_custom, handle=0xaaaaf06510f8, aic=(nil), aiv=0x124000001460 [INFO] function[2]: name=mul_custom, handle=0xaaaaf0650bc8, aic=(nil), aiv=0x124000000a30 [STEP 4] Preparing input data [STEP 5] Launching kernels and verifying results [INFO] add_custom result verified [INFO] sub_custom result verified [INFO] mul_custom result verified [SUCCESS] aclrtBinaryGetFunctionCount sample passed ## 变更类型 请选择本次引入的变更类型: - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 如何测试 1. bash build.sh编译通过 2. UT 用例通过 3. 示例 example/2_advanced_features/kernel/3_binary_get_function_count/main.cpp 上机验证 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 See merge request: cann/runtime!4285 | 1 个月前 |
| 【PR】新增 aclrtBinaryGetFunctionCount接口 Co-authored-by: weixin_47917346<zhangjunyu23@huawei.com> # message auto-generated for no-merge-commit merge: !4285 merge master into master 【PR】新增 aclrtBinaryGetFunctionCount接口 Created-by: weixin_47917346 Commit-by: weixin_47917346 Merged-by: cann-robot Description: # 新增 aclrtBinaryGetFunctionCount接口 ## 描述 **功能**:查询算子二进制文件中核函数总数 **函数签名**:aclError aclrtBinaryGetFunctionCount(aclrtBinHandle binHandle, uint32_t *count); **ACL层** 新增 aclrtBinaryGetFunctionCount 函数声明 新增 wrapper 宏注册 新增 aclrtBinaryGetFunctionCountImpl 实现,负责参数校验(binHandle/count 非空检查)并调用 RT 层 rtBinaryGetFunctionCount **RT层** 新增 rtBinaryGetFunctionCount 函数声明 新增 rtBinaryGetFunctionCount 实现,负责 handle 校验并调用 Api 层虚函数 **Api 基类与实现** 新增 BinaryGetFunctionCount 纯虚函数声明 src/runtime/core/src/api_impl/api_impl.cc:实现核心业务逻辑,通过 Program::GetKernelNameMap().size() 获取实际注册成功的 kernel 数量 **装饰器链** api_decorator.hpp/.cc:透传实现 api_error.hpp/.cc:RT 层参数校验(binHandle/count 非空检查) **单元测试** tests/depends/acl_stub.h:新增 rtBinaryGetFunctionCount 虚函数声明和 MOCK_METHOD2 tests/depends/runtime/src/runtime_stub.cpp:新增 stub 默认实现和全局转发函数 tests/ut/acl/testcase/acl_runtime_unittest.cpp:新增 2 个测试用例,覆盖参数校验、RT 层错误透传、正常路径 **示例** 新增上机示例example/2_advanced_features/kernel/3_binary_get_function_count:将add_custom/sub_custom/mul_custom三个 Ascendc 核函数编译到同一个独立算子二进制文件中,然后按以下步骤执行: 1. **加载文件**:调用aclrtBinaryLoadFromFile加载自己编写并编译好的算子二进制文件。 2. **查询核函数数量**:调用 aclrtBinaryGetFunctionCount 获取二进制中的核函数总数。 3. **按名称获取核函数句柄**:已知核函数名称,调用 aclrtBinaryGetFunction 逐个获取对应的核函数句柄。 4. **查询核函数信息**:调用 aclrtGetFunctionName 获取核函数名称,调用 aclrtGetFunctionAddr 获取核函数在 Device 上的代码地址。 5. **准备输入数据**:分配 Host 和 Device 内存,将输入数据拷贝到 Device。 6. **下发执行并验证**:调用 aclrtLaunchKernelWithHostArgs 分别下发三个核函数,同步等待执行完成后将结果拷贝回 Host 并校验。 **example测试结果** [STEP 1] Querying the number of kernel functions in the binary [INFO] aclrtBinaryGetFunctionCount returned 3 functions [STEP 2] Getting function handles by name [STEP 3] Querying function names and addresses [INFO] function[0]: name=add_custom, handle=0xaaaaf0650698, aic=(nil), aiv=0x124000000000 [INFO] function[1]: name=sub_custom, handle=0xaaaaf06510f8, aic=(nil), aiv=0x124000001460 [INFO] function[2]: name=mul_custom, handle=0xaaaaf0650bc8, aic=(nil), aiv=0x124000000a30 [STEP 4] Preparing input data [STEP 5] Launching kernels and verifying results [INFO] add_custom result verified [INFO] sub_custom result verified [INFO] mul_custom result verified [SUCCESS] aclrtBinaryGetFunctionCount sample passed ## 变更类型 请选择本次引入的变更类型: - [ ] 🐛 Bug 修复 - [x] ✨ 新功能 - [ ] 💄 代码风格更新(格式化,局部变量) - [ ] ♻️ 重构(既不修复错误也不增加功能的代码变动) - [ ] 📦 构建过程或辅助工具的变动 - [ ] 📝 文档内容更新 ## 如何测试 1. bash build.sh编译通过 2. UT 用例通过 3. 示例 example/2_advanced_features/kernel/3_binary_get_function_count/main.cpp 上机验证 ## 核对清单 - [x] 我的代码遵循了项目的代码风格 - [x] 我已对代码进行了自测 - [x] 我已更新了相关的文档 - [x] 我在标题中使用了合适的类型标签(如:feat:, fix:) - [x] 我已经详细阅读了贡献指南(CONTRIBUTING.md),并遵守了其中的所有规定,包括但不限于commit message的格式、无效commit的合并等 See merge request: cann/runtime!4285 | 1 个月前 |