已合并
aclnnRandom支持非连续 #4422
wushuai创建于 17 天前
aclnnRandom支持非连续 #4422
已合并
wushuai创建于 17 天前
wushuai
17 天前

描述

aclnnRandom支持非连续

关联的Issue

测试

冒烟pass、用例测试pass

文档更新

random/dsa_random_uniform/docs/aclnnInplaceRandomTensor.md

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 wushuai 的贡献)
Wwushuai
17 天前 创建了 pull request,commit 8d57e0ff
atomgit-bot
atomgit-bot
17 天前 评论:

变更摘要

此 PR 主要对 aclnn_random.cpp 中的随机数算子进行了三方面的改进:为 RegBase 平台引入独立的数据类型校验列表(排除复数类型)、在有区间参数的 GetWorkspaceSize 函数中新增 Contiguous 预处理确保 tensor 内存连续性、以及将四个 GetWorkspaceSize 函数的输出操作统一使用提前捕获的 out 变量(原始 tensor)完成 CastProcessViewCopy,使计算路径和写回路径解耦。

主要改动

  • 新增 REGBASE_DTYPE_SUPPORT_LIST 及条件类型校验: 新增一个不包含 DT_COMPLEX64DT_COMPLEX128 的数据类型支持列表,CheckDtypeValid 函数根据 IsRegBase() 返回值选择使用 REGBASE_DTYPE_SUPPORT_LIST 或原有的 DTYPE_SUPPORT_LIST,以适配 RegBase 平台不支持复数类型的场景。

  • aclnnInplaceRandomGetWorkspaceSizeaclnnInplaceRandomTensorGetWorkspaceSize 新增 Contiguous 调用: 在这两个函数中,通过 l0op::Contiguous(selfRef, ...) 获取连续内存的 tensor(selfContiguous),后续的 GetDataTypeGetViewShaperandomDavidPath/randomTensorDavidPath 等计算操作均基于 selfContiguous,避免非连续 tensor 导致的计算异常。

  • 输出操作统一使用原始 tensor(out: 四个 GetWorkspaceSize 函数均在开头通过 auto out = const_cast<aclTensor*>(selfRef) 捕获原始输出 tensor,CastProcessViewCopy 等最终写回操作统一基于 out,而非 selfContiguous 或直接使用 selfRef,使计算过程与输出目标分离。

likedislike
atomgit-bot
atomgit-bot
17 天前 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
17 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
17 天前 评论:

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
*/*/docs/acl*.md 陈娇, xuejinghui (2/2) 陈娇 (1/1)
repo-cann/ops-math xuejinghui, 宋恺 (2/2) xuejinghui, 宋恺 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
此处折叠了71条消息 查看更多
songkai111成员
17 天前 评论:

/approve

likedislike
chenjiao成员
17 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
17 天前 添加了label:lgtmapproved
CANN-robotCANN-robot成员
17 天前 关闭了关联的issue
CANN-robotCANN-robot成员
17 天前 合入了pull request