fix causal_softmax op to adapt with ascend#1280
Merged
wooway777 merged 2 commits intoJun 13, 2026
Merged
Conversation
修改 causal_softmax 算子在昇腾 Ascend 上对 x tensor 非默认 batch stride 和 BF16 dtype 进行适配。 修改内容:修改 Infinicore/src/infiniop/ops/causal_softmax/ascend/causal_softmax_ascend.cc 1、新增 BF16 值张量支持; 2、引入连续 temp 缓冲(batch×seq×total_seq_len),每条 calculate 将 x 逐行拷贝到 temp 后在 temp 上完成 masked_fill 和 softmax,最终写入 y,绕过 aclnnInplaceMaskedFillTensor 无法处理 x_tensor 非默认 batch stride 的限制 现状: infiniop算子测试全部通过;infinicore算子接口测试跑通,53/63 Passed
wooway777
approved these changes
Jun 13, 2026
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.
修改 causal_softmax 算子在昇腾 Ascend 上对 x tensor 非默认 batch stride 和 BF16 dtype 进行适配。
修改内容:修改 Infinicore/src/infiniop/ops/causal_softmax/ascend/causal_softmax_ascend.cc
1、新增 BF16 值张量支持;
2、引入连续 temp 缓冲(batch×seq×total_seq_len),每条 calculate 将 x 逐行拷贝到 temp 后在 temp 上完成 masked_fill 和 softmax,最终写入 y,绕过 aclnnInplaceMaskedFillTensor 无法处理 x_tensor 非默认 batch stride 的限制。
现状: infiniop算子测试全部通过;infinicore算子接口测试跑通,53/63 Passed


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


测试样例:
测试结果: