fix rms_norm op to adapt with ascend#1247
Open
ShaneWoof wants to merge 1 commit into
Open
Conversation
修改rms_norm算子在昇腾ascend上对跨半精度数据格式和3D张量进行适配。 修改内容: 1、修改Infinicore/src/infiniop/ops/rms_norm/ascend/rms_norm_aclnn.cc,当 w dtype 与 x dtype 不同且非 F32 时将 w cast 到 F32 再调用aclnnRmsNorm,并修复 3D 张量的 slice_shape 取值和循环遍历问题; 2、新增Infinicore/src/infiniop/ops/rms_norm/ascend/cast_kernel.cpp,实现 AscendC Cast 核函数(F16/BF16 → F32),用于跨半精度时 w dtype 的转换; 3、修改Infinicore/src/infiniop/devices/ascend/CMakeLists.txt,添加 cast_kernel.cpp 编译项。 现状:infiniop算子测试全部通过,infinicore算子接口测试跑通,103/108 Passed。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改rms_norm算子在昇腾ascend上对跨半精度数据格式和3D张量进行适配。
修改内容:
1、修改Infinicore/src/infiniop/ops/rms_norm/ascend/rms_norm_aclnn.cc,当 w dtype 与 x dtype 不同且非 F32 时将 w cast 到 F32 再调用aclnnRmsNorm,并修复 3D 张量的 slice_shape 取值和循环遍历问题;
2、新增Infinicore/src/infiniop/ops/rms_norm/ascend/cast_kernel.cpp,实现 AscendC Cast 核函数(F16/BF16 → F32),用于跨半精度时 w dtype 的转换;
3、修改Infinicore/src/infiniop/devices/ascend/CMakeLists.txt,添加 cast_kernel.cpp 编译项。
现状:infiniop算子测试全部通过,infinicore算子接口测试跑通,103/108 Passed




(1)infiniop
测试样例:
测试结果:
(2)infinicore
测试样例:
测试结果: