已合并
[kernel] embedding_hash_table and sparse_tensor_dense_mat_mul modify simt api #4154
majiayuan创建于 4月23日
[kernel] embedding_hash_table and sparse_tensor_dense_mat_mul modify simt api #4154
已合并
majiayuan创建于 4月23日
majiayuan
4月23日

描述

根据映射关系,统一将C++风格API替换为C风格API。

关联的Issue

[Requirement|需求建议]: embedding_hash_table 以及 sparse_tensor_dense_mat_mul SIMT算子整改原有cpp simt接口 #2571

测试

SIMT API接口修改前后,反汇编得到的md5码相同。

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 majiayuan 的贡献)
Mmajiayuan
4月23日 创建了 pull request,commit b060c7ed
CANN-robot
CANN-robot成员
4月23日 评论:

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


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
hash 周奇龙, 陈风 (2/2) 周奇龙, 陈风 (2/1)
matmul 周奇龙, 唐超 (2/2) 唐超 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

majiayuan, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
4月23日 添加了label:cann-cla/yes
此处折叠了12条事件消息 查看更多
CANN-robotCANN-robot成员
5月7日 将LinPX设为审查人
majiayuan
5月8日 评论:

compile

likedislike
Mmajiayuan
5月8日 预合并成功(commit_id: 31564a661bafc3d92a4b24b13dd10e1ec60a37b7)
CANN-robotCANN-robot成员
5月8日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
5月8日 评论:

流水线任务触发成功
任务链接 [7822d39ecc284fb7a3c05d039ad20a43][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950 ✅ SUCCESS >>>>> >>>>>
Pre_Compile ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_950_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_950_ubuntu24 ✅ SUCCESS >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
UT_Test_ophost ✅ SUCCESS
UT_Test_opapi ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
UT_Test_opgraph ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
ATK_Test_A2 ✅ SUCCESS

[2026-05-08 09:26:46]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
5月8日 评论:

流水线任务触发成功
任务链接 [eee52f3be1734c73ba97b41ab36bea5e][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS
anti_virus ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_style ✅ SUCCESS
pre-commit ✅ SUCCESS

[2026-05-08 09:17:41]    CI执行结束

likedislike
CANN-robotCANN-robot成员
5月8日 添加了label:api-check-pass
CANN-robotCANN-robot成员
5月8日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
5月8日 添加了label:ci-pipeline-passed
Mmajiayuan
5月8日 修改了pull request 的描述
sunday成员
5月11日 评论:

/lgtm
/approve

likedislike
chenfeng
chenfeng成员
5月11日 评论:

/lgtm
/approve

likedislike
唐超成员
5月11日 通过审查
唐超成员
5月11日 通过了评审
唐超成员5月11日进行代码检视1
matmul/sparse_tensor_dense_mat_mul/op_kernel/arch35/sparse_tensor_dense_mat_mul_b32.h
@@ -25,8 +25,8 @@ __simt_vf__ __aicore__ LAUNCH_BOUND(SIMT_MAX_THREAD_NUM) inline void ComputeB32(
2525 const int32_t p, __gm__ T_IDX* x1Indices, __gm__ T_VAL* x1Values, __gm__ T_VAL* x2, __gm__ T_VAL* y)
2626{
2727 // 总共有usedCoreNum*ThreadNum个线程,每个线程所在的位置为currCoreIdx*ThreadNum+LocalThreadIdx
28- for (int32_t elemIdx = currCoreIdx * Simt::GetThreadNum() + Simt::GetThreadIdx(); elemIdx < elemNum;
29- elemIdx += usedCoreNum * Simt::GetThreadNum()) {
28+ for (int32_t elemIdx = currCoreIdx * blockDim.x + threadIdx.x; elemIdx < elemNum;
29+ elemIdx += usedCoreNum * blockDim.x) {
3030 // 计算索引i、j、k,用于找到v1=x1(i,k)和v2=x2(k,j)
3131 // i、j、k 统一转成int32类型
3232 int32_t x1VecIdx = elemIdx / p;
@@ -49,7 +49,7 @@ __simt_vf__ __aicore__ LAUNCH_BOUND(SIMT_MAX_THREAD_NUM) inline void ComputeB32(
4949 }
5050 // 累加到对应位置
5151 __gm__ T_VAL* outAddr = y + i * p + j;
52- Simt::AtomicAdd(outAddr, v1 * v2);
52+ asc_atomic_add(outAddr, v1 * v2);
5353 }
5454}
5555 
@@ -118,10 +118,10 @@ __aicore__ inline void SparseTensorDenseMatMulB32<T_IDX, T_VAL, ADJ_A, ADJ_B>::P
118118 __gm__ T_VAL* x1ValuesGmAddr = (__gm__ T_VAL*)x1ValuesGm_.GetPhyAddr();
119119 __gm__ T_VAL* x2GmAddr = (__gm__ T_VAL*)x2Gm_.GetPhyAddr();
120120 __gm__ T_VAL* yGmAddr = (__gm__ T_VAL*)yGm_.GetPhyAddr();
121- Simt::VF_CALL<ComputeB32<T_IDX, T_VAL, ADJ_A, ADJ_B>>(
唐超5月11日评论:

为什么新接口不是驼峰的?

likedislike
唐超成员
5月11日 解决了最后一个问题
唐超成员
5月11日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
5月11日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
5月11日 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
5月11日 评论:

The following label is not ready.

ci-pipeline-passed: The ci-pipeline-passed label is expired. Please compile again.

likedislike
majiayuan
5月11日 评论:

compile

likedislike
Mmajiayuan
5月11日 预合并成功(commit_id: a1947e01c70bce5eb69a17466db276f0845e7f98)
CANN-robotCANN-robot成员
5月11日 删除了label:api-check-pass
CANN-robotCANN-robot成员
5月11日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
5月11日 评论:

流水线任务触发成功
任务链接 [1f34dbdf0d43487381ea002e49d908a3][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_950 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_950 ✅ SUCCESS >>>>> >>>>>
Pre_Compile ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_950_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_950_ubuntu24 ✅ SUCCESS >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
UT_Test_ophost ✅ SUCCESS
UT_Test_opapi ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
UT_Test_opgraph ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
ATK_Test_A2 ✅ SUCCESS

[2026-05-11 10:16:13]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
5月11日 评论:

流水线任务触发成功
任务链接 [3f1c233948864581b971024177045622][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
anti_virus ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_style ✅ SUCCESS
pre-commit ✅ SUCCESS

[2026-05-11 10:08:07]    CI执行结束

likedislike
CANN-robotCANN-robot成员
5月11日 添加了label:api-check-pass
CANN-robotCANN-robot成员
5月11日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
5月11日 添加了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
5月11日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: 唐超, 周奇龙, 陈风.
Reviewers who wrote a comment of /lgtm are: 唐超, 周奇龙, 陈风.

likedislike
CANN-robotCANN-robot成员
5月11日 关闭了关联的issue
CANN-robotCANN-robot成员
5月11日 合入了pull request
CANN-robot
CANN-robot成员
5月11日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: 陈风, 唐超, 周奇龙.
Reviewers who wrote a comment of /lgtm are: 周奇龙, 唐超, 陈风.

likedislike
CANN-robot
CANN-robot成员
5月11日 评论:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike