feat(ascend): add deterministic collective Ascend C kernel - #355
Merged
zhangj1an merged 1 commit intoSep 10, 2026
Merged
Conversation
zhangj1an
requested review from
Flink-ddd,
KJLdefeated,
bitborne and
inaniloquentee
as code owners
August 28, 2026 16:03
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This was referenced Sep 1, 2026
zhangj1an
force-pushed
the
feat/ascend-deterministic-collective
branch
2 times, most recently
from
September 10, 2026 14:00
3d7ade8 to
1671f1e
Compare
inaniloquentee
approved these changes
Sep 10, 2026
Sequential rebase onto latest test (includes RL-Align#320, RL-Align#340): ops_npu.asc kept as the comment-only aggregator; deterministic_collective_* bindings consolidated into npu_module.cpp; _C_npu.pyi unioned; collectives.py and setup.py auto-merged (CUDA fused paths kept, NPU staged flow added). Signed-off-by: zhangj1an <jianmusings@gmail.com>
zhangj1an
force-pushed
the
feat/ascend-deterministic-collective
branch
from
September 10, 2026 15:54
1671f1e to
06c8655
Compare
zhangj1an
added a commit
to erfgss/RL-Kernel
that referenced
this pull request
Sep 10, 2026
Sequential rebase onto latest test (includes RL-Align#320/RL-Align#340/RL-Align#355): rmsnorm binding consolidated into npu_module.cpp; _C_npu.pyi, registry npu priority map, ascend __init__, test_dispatch, check_operator.py unioned with the existing rope/attention/collective entries; setup.py mixed-build support already present from RL-Align#378. Signed-off-by: zhangj1an <jianmusings@gmail.com>
zhangj1an
added a commit
to zhangj1an/rl-kernel
that referenced
this pull request
Sep 10, 2026
Sequential rebase onto latest test (includes RL-Align#320/RL-Align#340/RL-Align#355/RL-Align#364): embedding binding consolidated into npu_module.cpp; _C_npu.pyi, registry enum + npu priority map, test_dispatch unioned. Signed-off-by: zhangj1an <jianmusings@gmail.com>
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.
Latest Status [29 Aug 2026]
My 8x910C breaks on
libccl_kernel.so, so I cannot test this kernel across ranks. I do not have root access to that machine to re-build pytorch npu. It would be great if the community can help me verify this PR works e2e. Thanks in advance!Summary
Port of the CUDA deterministic collective (PR #312) to Ascend NPU.
_C_npu.deterministic_collective_reduce): same balanced fixed tree for TP 1/2/4/8 (ws=8: ((t0+t1)+(t2+t3))+((t4+t5)+(t6+t7))). Every level rounds once in the input dtype with round-to-nearest-even, matching CUDAordered_add(add.rn/__hadd), so results are bitwise identical across ranks, TP configs, and CUDA/Ascend.Addon this CANN, so each level adds fp32-exact partials and casts back withCAST_RINT(IEEE RN, verified bitwise against torch including tie lanes).[world_size, N]and runs the fixed-tree kernel locally. Reduction order never depends on the HCCL algorithm.DeterministicCollectivegains an NPU backend with the same public surface (all_reduce/all_gather/reduce_scatter,out=aliasing, shape validation, metadata exchange). CUDA IPC path unchanged.csrc/ascend/ops_npu.ascconsolidates the singlePYBIND11_MODULE(one per.ascfile, else Bisheng hits duplicatePyInit__C_npu— same pattern as PR [WS1][kernels] Deterministic attention Ascend C kernel #320);setup.pyrestores the Ascend extension build, which the currenttestbranch had lost.Files
csrc/ascend/distributed/deterministic_collective_ascend.asccsrc/ascend/ops_npu.asc_C_npupybind registration.csrc/ascend/batch_invariant_logp_ascend.ascPYBIND11_MODULEonly; kernel logic unchanged.rl_engine/distributed/collectives.pyrl_engine/_C_npu.pyitests/distributed/test_deterministic_{all_reduce,all_gather,reduce_scatter}_ascend.pysetup.pyTest
Environment: Ascend 910B, CANN 8.5.1 (Bisheng), torch 2.7.1 + torch_npu 2.7.1.
tests/test_batch_invariant_logp.pyregressionNotes
dist.all_gatheron plain HCCL (no RL-Kernel code) aborts inlibccl_kernel.so(RunAicpuKfcResInitV2, aicpu exception). The 8-rank tests are the first thing to run once HCCL is healthy.DeterministicCollective.ruff checkpasses.