已合并
refactor: use asc_uintdiv SIMT API in integer fast div sample #6277
zhangshunwei2创建于 9 天前
refactor: use asc_uintdiv SIMT API in integer fast div sample #6277
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 zhangshunwei2 的贡献)9 天前 创建了 pull request,commit b8884624
atomgit-bot
9 天前 评论:
9 天前 评论:
变更摘要
本 PR 将快速除法样例 simd_simt_integer_fast_div 重构为使用 PR #6009 新增的 SIMT 快除接口,移除手写的魔数(magic)与移位量(shift)预计算及除法实现,改为调用 asc_get_uintdiv_magic_and_shift() 与 asc_uintdiv(),使两个 Case 的计算行为与原实现保持等价;同时同步更新样例中英文 README 与《整数除法的快速算法》优化指南的说明与关键代码,并补充对应 API 文档链接。
主要改动
- 移除手写魔数预计算:删除
integer_div.asc中的count_leading_zero()、get_bit_count1()与calc_magic_shift()函数,以及BIT_64_LEN、BIT_32_LEN常量,核函数标量逻辑改为调用asc_get_uintdiv_magic_and_shift(&magic, &shift, divisor)预计算magic和shift。 - SIMT VF 快除改用接口:将
simt_fast_div中基于__umulhi(value, magic)加右移的手写计算替换为asc_uintdiv(value, magic, shift),由接口统一完成除法计算。 - 样例文档同步:
README.md/README_en.md的 Case 说明、核心实现、转换原理、关键代码与调优建议同步为新接口调用方式,并补充接口 API 文档链接。
- **优化指南同步**:`fast_integer_division.md` 的描述、正例代码与总结同步为 `asc_get_uintdiv_magic_and_shift()` + `asc_uintdiv()` 的调用方式,并添加接口文档链接。


不准确?
atomgit-bot
9 天前 评论:
9 天前 评论:
9 天前 添加了label:cann-cla/yes
CANN-robot
9 天前 评论:
9 天前 评论:
此处折叠了45条消息 查看更多
9 天前 添加了label:ci-pipeline-passed
9 天前 解决了最后一个问题
9 天前 添加了label:lgtm
9 天前 合入了pull request
描述
快速除法样例
simd_simt_integer_fast_div适配 PR #6009 新增的 SIMT 快除接口:integer_div.asc:删除手写的calc_magic_shift()预计算函数(内部基于clz()、bcnt1()标量接口)以及__umulhi+ 移位的手写快除实现,改为在核函数标量计算逻辑中调用asc_get_uintdiv_magic_and_shift()接口预计算magic和shift,在SIMT VF计算逻辑中调用asc_uintdiv()接口完成除法计算,两个Case的计算行为与原实现等价。README.md/README_en.md:Case说明、核心实现、转换原理、关键代码、调优建议同步为新接口调用方式,并为接口添加API文档链接。fast_integer_division.md):描述、正例代码、总结同步为新接口调用方式,并为接口添加API文档链接。关联的Issue
关联 Issue #1592。
测试
[Success] Case accuracy is verification passed.)。[Success])。simt_api/math_functions.h头文件引用场景编译验证通过(接口最小依赖检查)。文档更新
更新样例README(中英文)与SIMD与SIMT混合编程优化指南《整数除法的快速算法》:快除实现描述与关键代码同步为
asc_get_uintdiv_magic_and_shift()+asc_uintdiv()接口调用方式,并添加对应API文档链接。类型标签