Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.
TBE转Ascend C 功能实现
Mod 算子提供 aclnnFmodTensor / aclnnInplaceFmodTensor / aclnnFmodScalar / aclnnInplaceFmodScalar 四个 aclnn 接口,计算语义为:
out = self - other * trunc(self / other)
当前 CI/UT 已验证 op_api / op_host / op_kernel 三段均可通过,出包也已通过。
接口侧 dtype 支持范围按当前 op_api 逻辑:
host 侧包含 op_def / infershape / tiling:
op_def 注册 Mod,输入 x1/x2、输出 y,格式均为 ND,当前 AddConfig("ascend910b")。
infershape 输出 shape 固定跟随 self,即 out.shape == self.shape。
op_api 负责更严格的参数校验:
tiling 侧按 self 总元素数做多核切分:
tiling 同时识别三类 other 形态:
kernel 采用模板化实现,tiling key 选择实际 dtype 模板:
FP32 / FP16 / BF16 / INT32 分支分别实例化
多核按 host tiling 下发的 blockIdx / perCoreDataCount / tailCoreNum 处理各自数据段
数据搬运使用 DataCopyPad
scalar other 场景:只搬一个元素到 UB,再 Duplicate 成当前 tile
same-shape 场景:x1/x2 按相同 offset 连续搬运
broadcast 场景:根据 input2Stride 计算 other offset,并尽量按连续段搬运,避免整 tensor materialize
浮点路径:
INT32 路径:
💡 备注(选填)
/assign
Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.
一、背景信息 (必填)
TBE转Ascend C 功能实现
二、价值/作用 (必填)
三、设计方案 (必填)
3.1 使能方式(涉及哪些框架:如Aclnn直调、Pytorch训练等)
3.2 总体设计
Mod 算子提供 aclnnFmodTensor / aclnnInplaceFmodTensor / aclnnFmodScalar / aclnnInplaceFmodScalar 四个 aclnn 接口,计算语义为:
out = self - other * trunc(self / other)
当前 CI/UT 已验证 op_api / op_host / op_kernel 三段均可通过,出包也已通过。
3.2.1 算子支持的数据类型
接口侧 dtype 支持范围按当前 op_api 逻辑:
3.2.2 host侧设计
host 侧包含 op_def / infershape / tiling:
op_def 注册 Mod,输入 x1/x2、输出 y,格式均为 ND,当前 AddConfig("ascend910b")。
infershape 输出 shape 固定跟随 self,即 out.shape == self.shape。
op_api 负责更严格的参数校验:
tiling 侧按 self 总元素数做多核切分:
tiling 同时识别三类 other 形态:
3.2.3 kernel侧设计
kernel 采用模板化实现,tiling key 选择实际 dtype 模板:
FP32 / FP16 / BF16 / INT32 分支分别实例化
多核按 host tiling 下发的 blockIdx / perCoreDataCount / tailCoreNum 处理各自数据段
数据搬运使用 DataCopyPad
scalar other 场景:只搬一个元素到 UB,再 Duplicate 成当前 tile
same-shape 场景:x1/x2 按相同 offset 连续搬运
broadcast 场景:根据 input2Stride 计算 other offset,并尽量按连续段搬运,避免整 tensor materialize
浮点路径:
INT32 路径:
3.3 支持硬件
3.4 算子约束限制
💡 备注(选填)