feat(cp): add opt-in NVSHMEM CP state handoff#110
Open
foraxe wants to merge 4 commits into
Open
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
foraxe
marked this pull request as ready for review
July 22, 2026 13:22
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
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
Motivation
The general FLA CP preprocessing path communicates and stages complete intermediate states. The NVSHMEM backend specializes the recurrent-state boundary:
The backend is disabled by default. Existing behavior is unchanged unless both
CULA_CP_OVERLAP=1andCULA_CP_COMM_BACKEND=nvshmemare set.Supported configuration
NVSHMEM_DISABLE_CUDA_VMM=1CUDA_DEVICE_MAX_CONNECTIONS=1CUDA_DEVICE_MAX_CONNECTIONS=2, barrier publication, fused remote merge, and current-stream executionThe CP=4 optimization is limited to world size at most four and a non-transposed state layout. Other configurations retain the existing path unless strict opt-in settings request an error instead of fallback.
Correctness
The deterministic oracle compares the cuLA NVSHMEM path with FLA CP at the same output and backward boundary. It checks output and active Q/K/V/g/beta gradients.
Performance
Measurements use BF16, 20 warmups, 60 iterations, five in-process repeats, and the median of each repeat's rank-max iteration median.
CP=2
CP=4
4096x88192x16These numbers isolate the cuLA KDA CP preprocessing boundary. They are not an integrated Megatron training result and do not claim a 20% end-to-end speedup.
Validation
inclusionAI/cuLAcommit326a3073a9ce1c83 passedReproduction commands and complete repeat data are under
docs/cp_overlap/andbenchmarks/run_cp4_nvshmem_optimized.sh.