Repository navigation
Keep the finalize thread from rewinding the preemption sync counter. - #3746
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
`CheckpointManager._finalize_checkpoint` runs on the async finalize thread, for a step older than the training step. It called `reached_preemption(step)` only to decide whether to record `/jax/checkpoint/write/preempt/duration_saved_secs`. That call reaches JAX `ReachedSyncPoint`, which stores the step as the process's preemption sync counter. When a preemption notice arrives, JAX picks the highest counter plus one as the sync step. With the counter moved back, a process can already be past the sync step and never save at it. In multi-process JAX the other processes then wait for it at the save barrier. On Pathways the old step can latch the preemption, so the training thread never sees it. `save()` already knows whether a step is a preemption save. It now records the step, and `_finalize_checkpoint` reads that record instead of calling `reached_preemption()`. `_finalize` clears the record on every path, including a cancelled save. The metric fires in the same cases, and each save makes one fewer coordination call. A new multi-process test fixes the order of events with key-value handshakes. Without the fix the primary misses the sync step and the other processes save one step early. A second test checks that the metric is recorded once, only on the primary. PiperOrigin-RevId: 1018642390
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Keep the finalize thread from rewinding the preemption sync counter.
CheckpointManager._finalize_checkpointruns on the async finalize thread, fora step older than the training step. It called
reached_preemption(step)onlyto decide whether to record
/jax/checkpoint/write/preempt/duration_saved_secs.That call reaches JAX
ReachedSyncPoint, which stores the step as theprocess's preemption sync counter. When a preemption notice arrives, JAX picks
the highest counter plus one as the sync step. With the counter moved back, a
process can already be past the sync step and never save at it. In multi-process
JAX the other processes then wait for it at the save barrier. On Pathways the
old step can latch the preemption, so the training thread never sees it.
save()already knows whether a step is a preemption save. It now records thestep, and
_finalize_checkpointreads that record instead of callingreached_preemption()._finalizeclears the record on every path, includinga cancelled save. The metric fires in the same cases, and each save makes one
fewer coordination call.
A new multi-process test fixes the order of events with key-value handshakes.
Without the fix the primary misses the sync step and the other processes save
one step early. A second test checks that the metric is recorded once, only on
the primary.