Repository navigation
Conversation
ultrons
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
khatwanimohit,
richjames0,
shralex,
shuningjin,
vipannalla and
xibinliu
as code owners
October 6, 2026 18:34
There was a problem hiding this comment.
Code Review
This pull request introduces readiness tokens (last_fwd_bwd_token and last_update_token) to the MaxTextTrainingEngine to support Tunix's TrainerWorker step timer. These tokens are updated during the forward-backward and optimizer update steps respectively. A corresponding unit test has been added to verify their behavior. There are no review comments, so I have no feedback to provide.
6 tasks done
parambole
added a commit
to google/tunix
that referenced
this pull request
Oct 13, 2026
…maxtext#5568 #5568 keeps step-boundary checkpoints free of undrained metrics buffers, which this PR's deferred get_metrics() relies on. AI-Hypercomputer/maxtext#5571 is not in this commit yet, so the deferral stays off until the pin includes it.
This was referenced Oct 14, 2026
ultrons
force-pushed
the
sivaibhav/engine-step-timing-tokens
branch
from
October 15, 2026 22:33
62912b8 to
7f19b07
Compare
Set `last_fwd_bwd_token` (the microbatch loss array) in `fwd_bwd` and `last_update_token` (the gradient norm) in `update`. Tunix's TrainerWorker step timer blocks on these off the serving thread to stamp when each microbatch and the optimizer step finished on device (TRAINER_STEP_TIMING, google/tunix#2713). Without them the timeline carries dispatch times only. The loss rather than the running sums, which the next microbatch's accumulate donates; the gradient norm is the same signal the throttler already waits on. On a dropless rerun of an overflowed microbatch (`_resolve_overflow_check`), the rerun's loss replaces the token, since it is the last device work dispatched.
ultrons
force-pushed
the
sivaibhav/engine-step-timing-tokens
branch
from
October 16, 2026 19:05
7f19b07 to
f9eccaa
Compare
This branch has not been deployed
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.
Exposes the two readiness tokens that Tunix's trainer step timer (
TRAINER_STEP_TIMING, google/tunix#2713) waits on, so the timeline reports when each microbatch and the optimizer step finished on device.last_fwd_bwd_token: the microbatch's loss array (theWeightedMetric'sunreduced_sumwhen the loss is one), set infwd_bwd. The loss rather than the running gradient sums, because the next microbatch's accumulate donates those. When an overflowed microbatch is rerun dropless (_resolve_overflow_check), the rerun's loss replaces the token, since it is the last device work dispatched.last_update_token: the gradient norm, set inupdate. It is the same signal the in-flight throttler already waits on, since it comes out of the update executable.Both start as
None. The timer blocks on them from a daemon thread, so the serving path never waits.Why: with the MaxText backend (what the MLPerf recipes run) neither attribute existed, so the worker's step timer had no device-readiness signal and every
readyfield inTRAINER_STEP_TIMINGstayedNone. google/tunix#2713 now warns once when a trainer lacks them; this makes the warning go away for MaxText.Rebased onto atwigg/mlperf e526ea0 (after #5718); also applies on #5721
We rebased the commit onto
atwigg/mlperfat e526ea0, which includes #5718'sprepare_fwd_bwd_input/wait_for_device. Thefwd_bwdtoken now sits after the throttler hand-off in the restructured method, and the dropless rerun path sets it as well (2 files, +34 lines). The same commit cherry-picks cleanly onto the #5721 head (14ed039) and onto e938007, the #5721 state that google/tunix#2884 pins.Test receipt (CPU,
trellis-experimental@sha256:d6cc06ff...image, with the checkout'ssrc/placed ahead of the image's installed maxtext; a probe test in the same session confirmedmaxtext.training_engine.maxtext_engine.__file__resolved to the mountedsrc/):tests/post_training/unit/maxtext_engine_test.py: 112 passed, 1 failed with this change; 111 passed, 1 failed on plain e526ea0. The extra pass is the newtest_readiness_tokens_track_last_microbatch_and_update. The one failure,test_maybe_register_pathways_persistence, fails identically on both (Orbax Pathways handler registration on a CPU-only host).maxtext_engine_prepared_input_test.pyandmaxtext_engine_stage_before_update_test.py: 14 passed with this change, 14 passed on plain e526ea0.Testing (original revision)
test_readiness_tokens_track_last_microbatch_and_update.tests/post_training/unit/maxtext_engine_test.pyon CPU in theatwigg/trellis-experimental:1005image: 91 passed, 1 failed. The failure,test_maybe_register_pathways_persistence, fails identically without this change (Orbax Pathways handler registration on a CPU-only host).Checklist