Repository navigation
feat: checkpoint_exclude_swap - #1348
Merged
github-actions[bot] merged 1 commit intoNov 7, 2026
Merged
github-actions[bot] merged 1 commit into
github-actions[bot] merged 1 commit into
Conversation
JiaqiSong-99
requested review from
DavidFFFan and
liuchongming74
as code owners
October 29, 2026 07:52
JiaqiSong-99
force-pushed
the
checkpoint_exclude_swap
branch
2 times, most recently
from
November 2, 2026 07:56
30ccb8e to
75e9b60
Compare
Contributor
Author
|
/check-pr |
Contributor
Author
|
/retest |
|
|
JiaqiSong-99
force-pushed
the
checkpoint_exclude_swap
branch
from
November 5, 2026 06:54
75e9b60 to
62ad244
Compare
Contributor
Author
|
/retest |
Contributor
|
Hi @JiaqiSong-99, thanks for your contribution! This pull request is currently waiting for the CLA Assistant check to pass before the CI process can continue. Please follow the signing link shown by CLA Assistant on this PR. If you have already signed the CLA but the check is still failing, please make sure that all email addresses used in your commits are added to and verified on your GitHub account. After updating your email settings or signing the CLA, please click Recheck in the CLA Assistant comment/check so the status can be refreshed. Once the CLA Assistant check passes, CI will continue automatically. |
|
|
JiaqiSong-99
force-pushed
the
checkpoint_exclude_swap
branch
from
November 6, 2026 06:45
4367c5e to
e8c58a1
Compare
Contributor
Author
|
/retest |
|
|
JiaqiSong-99
force-pushed
the
checkpoint_exclude_swap
branch
from
November 6, 2026 08:38
e8c58a1 to
8555649
Compare
Contributor
Author
|
/retest |
|
|
suteng
approved these changes
Nov 7, 2026
DavidFFFan
approved these changes
Nov 7, 2026
Contributor
Author
|
/check-pr |
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.
Paired: GitHub #1348 ↔ GitCode !1882
What type of PR is this?
/kind feature
What does this PR do / why do we need it:
The existing checkpoint exclusion path keeps the outputs of recomputation-excluded regions and the activations required for backward on the device, increasing memory pressure when multiple
SAVEregions are chained. This PR adds activation swapping tocheckpoint_exclude_wrapper. Eligible outputs and saved tensors that cannot be reconstructed from replay inputs are offloaded to the CPU and restored on demand during backward, while ensuring that excluded regions execute only once and cached outputs are reused during replay.save_outputand introducesswap,group_swap, andcpu_pool. Outputs are now always stored in the replay cache, so existing uses ofsave_outputmust be migrated.CheckpointExcludeWrapperusesAsyncSaveOnCputo handle tensors saved for backward andSwapManagerto manage offloading, prefetching, and pinned-memory pools for excluded-region outputs.docs/api/api_reference.mdanddocs/guide/activation_checkpoint.mdwith the new API, constraints, fallback behavior, and prefetch configuration.+751/-198lines, including 3 core implementation files, 2 documentation files, and 6 test files.265 passed, 13 subtests passed, 4 warnings. Coverage includes API forwarding and argument validation, tensor offload and restoration, output registration, fallback paths, and storage cleanup.tests/torch/activation_memory/, covering chainedSAVEregions, numerical and gradient parity, regular and grouped swapping, explicit pinned-memory pools, and storage cleanup. These tests were not run because the current environment has no NPU.Which issue(s) this PR fixes:
Fixes #1328
Code review checklist [illustration]: