Add SM100 tensor-parallel fused scaled cross entropy - #1458
Merged
Merged
Conversation
kolehma8
commented
Sep 10, 2026
yueyiming2009
left a comment
Collaborator
There was a problem hiding this comment.
Public API and workspace review comments. Both findings are blocking for the advertised SM100 integration; kernel review is still in progress.
Implement persistent SM100 forward and backward kernels with NVLS and two-host remote-ring reduction, add topology-aware workspace management and public APIs, and include correctness and performance coverage through TP16. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Split the forward kernel entry point from its role implementations, dispatch warp roles explicitly at the kernel top level, and consolidate repeated dW accumulator handling while addressing review feedback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Derive parent-relative local and matching-rank teams with a 2D NVSHMEM split, use subgroup-scoped cooperative SM100 launches, and validate strided groups such as {0,4,8,12} across two hosts.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Record the production IBGDA environment and transport initialization signal for multi-host TP subgroup execution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Count the backward logits recomputation alongside forward, dX, and dW when reporting end-to-end throughput. Refresh the README headline with the corrected four-GEMM rates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Normalize reference qualifiers in the compile-time output contract so NVCC accepts the SM90 test while preserving the intended exact type check. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dispatch the native TP implementation on Hopper and SM100-family GPUs using the real CUDA capability query. Reject workspace-size requests that do not exactly match an existing immutable configuration, preventing mixed configured/requested footprints. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
kolehma8
force-pushed
the
jkolehm/tp-fslce-sm100
branch
from
September 14, 2026 17:30
c727e07 to
f6683fe
Compare
vaibhavjindal
approved these changes
Sep 14, 2026
vaibhavjindal
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Just want to check if the verl convergence tests pass and also if the test suite present here is equivalent to regular FLCE test suite that we have.
Collaborator
Author
I will follow-up this PR with a Verl training run once the integration is finished. |
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
Adds a native Blackwell-family (
sm_100f, including B200/B300) tensor-parallel fused scaled linear cross-entropy implementation.Code entry points
LigerFusedLinearScaledCrossEntropyNativeTPFunction.forwardLigerFusedLinearScaledCrossEntropyNativeTPFunction.backwardfused_linear_scaled_cross_entropy_forwardfused_linear_scaled_cross_entropy_backwardfused_linear_scaled_cross_entropy_forward_sm100fused_linear_scaled_cross_entropy_backward_sm100forward_gemm_tp_kernel_sm100backward_gemm_tp_kernel_sm100forward_gemm_roles_sm100.cuhbackward_gemm_mainloop_sm100.cuhMulti-host subgroup topology
Multi-host setup is relative to the configured TP team rather than the full NVSHMEM world.
nvshmem_team_split_2dderives:For a 16-rank world on two eight-GPU hosts, TP group
{0,4,8,12}becomes local rows{0,4}/{8,12}and remote pairs{0,8}/{4,12}. SM100 remote kernels use a parent-team stream barrier followed by a cooperative clustered CUDA launch, so disjoint TP groups do not require world-synchronous kernel entry.Validated concurrently as four TP4 groups
{0,4,8,12},{1,5,9,13},{2,6,10,14}, and{3,7,11,15}:NVSHMEM_IB_ENABLE_IBGDA=1was forced for the final campaign. Runtime initialization reportedSuccessfully initialized the transport: IBGDA. It will be used for device-side APIs over IB, created DCI/RC QPs, and selected each configuredmlx5_*device.Random BF16,
M=4096,H=4096, globalV=131072, 10 warmups, and 30 measured iterations:Native versus fallback forward maximum absolute difference was
5.45e-4.SM90 regression validation
Validated the shared topology, workspace, and binding changes on two eight-GPU
H200 hosts with a clean
sm_90abuild:forward, dX, dW, entropy, and CUDA graph replay.
{0,4,8,12},{1,5,9,13},{2,6,10,14}, and{3,7,11,15}all passed on H200.16 ranks.
Implementation
Forward
M256 x N256 x K64, cluster2 x 1.__global__entry point is isolated inforward_gemm_kernel_sm100.cuhand dispatches those roles explicitly; templated implementations live inforward_gemm_roles_sm100.cuh.Backward
M256 x N256 x K64.Allocator2SmTMEM allocation is reused across all phases.The measured TP16 remote stage is 0.285-0.328 ms:
Correctness
1.09e-3.make checkstylepasses.Performance methodology
backward logits recomputation for dZ, dX, and dW.
M=4096 forward
M=4096 forward + backward
M=8192 forward
M=8192 forward + backward
M=16384 forward
M=16384 forward + backward
Memory
Inputs, weights, and final outputs are excluded. Native reports its exact reusable C++/NVSHMEM forward+backward workspace. Verl reports incremental PyTorch peak memory.
M=4096
M=8192
M=16384
Additional weak-scaling production result
With fixed
V_local=65536,M=4096, andH=4096:Model-shape campaign
The following production model shapes use
M=8192, random BF16 inputs, 10 warmups, and 30 measured iterations. TP16 spans the same two eight-GPU hosts as the fixed-shape campaign.Qwen3-30B-A3B (
H=2048,V=151936)Forward
Forward + backward
Memory
Llama 4 (
H=5120,V=202048)Forward
Forward + backward
Memory
DeepSeek-V3 (
H=7168,V=129280)Forward
Forward + backward
Memory
Validation commands
On B300 (
-DLIGER_CUTE_CUDA_ARCH=100f):Distributed numerical validation:
TP16 uses two eight-GPU hosts with: