Pull Request has been successfully merged by CANN-robot.
(Thank you for Cruiter's contribution.)变更摘要
该 PR 为 AscendC C API 的向量计算与类型转换接口新增"带返回值"形式的重载:原有接口(如 asc_relu(vector_float& dst, ...))通过输出参数 dst 返回结果,本次改动新增直接以返回值形式(如 vector_float asc_relu(vector_float src, vector_bool mask))调用的版本,其实现方式为在函数内部定义 dst 变量、调用对应 *_impl 后返回结果。改动覆盖 vector_compute_impl.h、reg_vector.h、reg_convert.h 等核心头文件,并新增 asc_muls_cast 接口及对 asc_fma、asc_madd 的数据类型扩展,同时补充了相应测试。
主要改动
- 新增带返回值的向量计算接口重载:在
vector_compute_impl.h与reg_vector.h中,为asc_relu、asc_select、asc_abs_sub、asc_abs、asc_axpy、asc_ln、asc_exp_sub、asc_exp_sub_half2float、asc_reduce_max/asc_reduce_min/asc_reduce_sum(含*_datablock变体)、asc_*_scalar(add/mul/min/max)以及asc_ge_scalar/asc_gt_scalar/asc_ne_scalar等接口新增直接返回vector结果的重载函数,将原"输出参数写结果"改为"返回结果"的调用方式。 - 转换类接口新增带返回值重载:在
reg_convert.h中为asc_int322float_rd/ru/rz/rn/rna、asc_float2bfloat16_rd/rn/rna/ru/rz(含_sat)、asc_int322int16/asc_int322uint16(含_sat)、asc_int322int64、asc_uint82uint16等类型转换接口补充返回类型重载,并支持EVEN/ODD位置模式参数。 - 新增
asc_muls_cast接口:新增实现文件asc_muls_cast_impl.h,基于vmulscvt指令实现 float 数据乘标量并转换输出为 half,支持EVEN/ODD位置模式,同时在vector_compute_impl.h与reg_vector.h中提供声明及带返回值版本。 - 扩展
asc_fma与asc_madd数据类型:asc_fma_impl.h新增vector_int16_t/vector_uint16_t/vector_int32_t/vector_uint32_t类型的asc_fma_impl(基于vmula),asc_madd_impl.h新增vector_bfloat16_t的asc_madd_impl(基于vmadd),并在reg_vector.h与vector_compute_impl.h中补充声明与实现。 - 补充接口测试:新增带返回值接口测试文件
test_asc_return_value.cpp与test_asc_muls_cast.cpp,为asc_fma新数据类型、asc_madd的vector_bfloat16_t、asc_muls_cast的EVEN/ODD位置调用补充测试用例,并在host_header_reg_compute_checker.cpp中增加asc_muls_cast符号检查。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| docs | ✅ munanhw, houyuyang, wuyang_hw (3/2) | ✅ munanhw (1/1) |
| impl/c_api | ✅ pangfd, houyuyang, wuyang_hw (3/2) | ✅ pangfd (1/1) |
| include/c_api/reg_compute | ✅ horming, houyuyang, wuyang_hw (3/2) | ✅ horming (1/1) |
| repo-cann/asc-devkit | ✅ houyuyang, wuyang_hw (2/2) | ✅ houyuyang (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
printfscanfmain, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/lgtm
/approve


/lgtm


描述
AscendC C API新增带返回值接口
关联的Issue
测试
文档更新
类型标签