已关闭
[Requirement|需求建议]: A5(arch35) 的 Modulate 算子 Reg 路径接口升级(Reg::DataCopy → LoadAlign/StoreAlign、__local_mem__ → __ubuf__) #5649
Nice try创建于  20 天前关闭于  20 天前
Nice try
Nice try成员
20 天前 创建

Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.

Backgroud(背景信息)

社区仓库 cann/ops-nn 中 vfusion/modulate 算子在 A5(arch35,即 Ascend 950,源码按 COMPUTE_UNITS ascend950 编译)侧的 Reg 实现路径(vfusion/modulate/op_kernel/arch35/modulate_regbase_common.h)仍在使用旧地址空间限定符 __local_mem__ 与旧的 Reg 加载/存储接口 Reg::DataCopy。需要将该路径升级到新的 __ubuf__ 地址空间限定符与 Reg::LoadAlign / Reg::StoreAlign 接口,以适配当前接口规范。

Origin(信息来源)

cann/ops-nn 仓库 PR #9990(https://gitcode.com/cann/ops-nn/pull/9990),由社区开发者提交,改动 1 个文件(vfusion/modulate/op_kernel/arch35/modulate_regbase_common.h),增删各 20 行。

Benefit / Necessity (价值/作用)

  • 消除 A5(arch35)Reg 路径对旧接口(__local_mem__、Reg::DataCopy)的依赖,与新版 Reg 接口(LoadAlign/StoreAlign)及 UB 地址空间模型保持一致;
  • 保持算子代码与当前工具链/接口规范同步,降低后续版本兼容与维护成本;
  • 不改变算子功能与计算公式(y = x * (1 + scaleOptional) + shiftOptional),无行为影响。

Design(设计方案)

对 vfusion/modulate/op_kernel/arch35/modulate_regbase_common.h 中 ModulateBaseKernel 的 ComputeScaleShift / ComputeScale / ComputeShift 三个函数做等价的接口替换:

  1. x/scale/shift/y 的 LocalTensor::GetPhyAddr() 指针强转由 __local_mem__ T* 改为 __ubuf__ T*;
  2. Reg 加载由 Reg::DataCopy<T, Reg::LoadDist::DIST_NORM> 改为 Reg::LoadAlign<T, Reg::LoadDist::DIST_NORM>;
  3. Reg 存储由 Reg::DataCopy<T, Reg::StoreDist::DIST_NORM> 改为 Reg::StoreAlign<T, Reg::StoreDist::DIST_NORM>;
  4. 加载/存储位置(scaleAddr/shiftAddr/xAddr/yAddr + rowOffset + i*VL)与计算逻辑保持不变。

关联 PR:https://gitcode.com/cann/ops-nn/pull/9990

likedislike
Nice tryNice try成员
20 天前 添加了label:requirement
Nice try
Nice try成员
20 天前 评论:

/assign @Nice_try

likedislike
CANN-robotCANN-robot成员
20 天前 将 Nice_try 设为负责人
CANN-robotCANN-robot成员
20 天前 关闭了 issue
CANN-robotCANN-robot成员
20 天前 添加了label:resolved
Nice tryNice try成员
20 天前 关联了pull request:refactor(modulate): A5(arch35) Reg 加载存储接口升级为 LoadAlign/StoreAlign