feat: support ascend npu sft#43
Merged
Merged
Conversation
d6245e1 to
688c0e1
Compare
688c0e1 to
606636d
Compare
Randomizez
reviewed
Mar 27, 2026
Randomizez
left a comment
Collaborator
There was a problem hiding this comment.
感觉有很多可以简化的地方,请看一下。另外alternatives尽量直接注册,在patch内注册有点太过隐式了。
added 4 commits
March 27, 2026 17:41
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.
Summary
This PR adds Ascend/NPU support for SFT workloads in StepTronOSS.
It introduces a NPU runtime patch entrypoint, NPU-specific optimization backends for MoE dispatch and grouped GEMM, Ascend SFT experiment entrypoints,
benchmark scripts, tests, and user-facing documentation.
Main Changes
steptronoss.utils.npu_patch.apply_npu_patch()grouped_gemm="npu_gmm"backed by MindSpeednpu_gmm_v2TokenDispatcher="npu_alltoall"for EP token routing on NPUapply_npu_patch()is calleddocs/ASCEND.mddocs/ASCEND_ZH.mdImplementation Notes
apply_npu_patch()before importing modules that depend on NPU runtime behavior or before selecting NPU backendsnpu_alltoallbuilds a unique token-rank routing layout before communication to avoid duplicated routing to the same remote ranknpu_moe_token_permute/npu_moe_token_unpermuteon the NPU bf16 pathindex_select/index_addfallback path for compatibilitynpu_gmmkeeps the same semantic interface as the existinggrouped_gemmpath and normalizesbatch_sizesinternallyTested Environment
Validated with:
8.3.RC2torch_npu2.8v2.2.0_core_r0.12.1All other dependencies are kept aligned with the project's
uvenvironment.Validation
tests/test_npu_alltoall_dispatcher.pytests/test_grouped_gemm_npu.pybenchmarks/benchmark_dispatcher_npu.pybenchmarks/benchmark_grouped_gemm_npu.pyTraining Results
Qwen3-1.7B sft smoke test (compared to l40s):

Step-3.5-Flash-Base-Midtrain sft: tp8pp8vpp3ep8 seq_len=8192 with recompute, sequence_parallel and offload_optimizer_state

Kernel Optimization
NPU grouped GEMM speedup vs baseline:
NPU MoE AllToAll Dispatcher speedup vs baseline:
