perf(cuda-graphs): share partial capture pools#2943
Draft
yaoyu-33 wants to merge 1 commit into
Draft
Conversation
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
940467c to
f8659a3
Compare
7c13d12 to
9aa4a75
Compare
f8659a3 to
6148e4b
Compare
9aa4a75 to
be567b9
Compare
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
Stacked on #2932 and linked to #1027.
make_graphed_callables()invocation, giving attention and MoE one shared private pool each instead of one pool per layerA private-pool delta cannot be attributed honestly to one entry once TE captures the full scope in a single call, so actual graph-pool deltas are reported per scope rather than repeated for every layer.
H100 experiment
Qwen3-30B-A3B, 8x H100 80GB, BF16, FSDP2 + EP8, TE attention and experts, HybridEP, no AC/PP, mock dataset.
Exact old/new comparison at local/global batch 1/8, sequence length 1024:
Shared pools reduce peak allocated memory by 0.97 GiB/GPU (1.8%) at this shape. Runtime is statistically inconclusive in these short runs; this PR's measured benefit is memory/capacity rather than a claimed speedup.
Capacity comparison at local/global batch 2/16, sequence length 1024:
At this larger shape, shared capture reduces allocated memory by at least 11.83 GiB/GPU relative to the old failure point and turns the previous OOM into successful capture/replay. The completed graph run is 25.1% faster than eager. Eager and graph loss sequences match to the logged precision across all 15 steps.
Allocator diagnostics after shared capture at local batch 2:
The larger local-batch-2, sequence-2048 case still OOMs during the MoE backward warmup. That result identifies retained TE expert backward state as the next memory target; a separate stacked PR will page only marked expert saved activations.
Validation
170 passed, 9 skipped:tests/unit_tests/recipes/test_partial_cuda_graphs.pytests/unit_tests/recipes/test_train_ft.pytests/unit_tests/recipes/test_train_ft_partial_cuda_graphs.pytests/unit_tests/moe/test_backend_config.pygit diff --checkpass