[PyTorch] Preserve FP8 recompute state for inner autocast - #3284
[PyTorch] Preserve FP8 recompute state for inner autocast#3284nvegesna-netizen wants to merge 3 commits into
Conversation
a11a5f5 to
839178b
Compare
Signed-off-by: Nitin Vegesna <nvegesna@nvidia.com>
839178b to
06dc465
Compare
| @@ -0,0 +1,99 @@ | |||
| # Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | |||
There was a problem hiding this comment.
Regression tests omitted from CI
The PyTorch QA job enumerates individual test files, but this new standalone regression suite is not included, so its FP8 activation-recompute coverage does not execute in CI.
Knowledge Base Used: Tests and QA
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Greptile SummaryThis PR fixes FP8 metadata preservation when activation checkpointing contains an inner FP8 autocast region.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously omitted regression suite is now explicitly invoked by the L0 PyTorch unittest script. Important Files Changed
Reviews (3): Last reviewed commit: "test: run FP8 recompute coverage in PyTo..." | Re-trigger Greptile |
Signed-off-by: Nitin Vegesna <nvegesna@nvidia.com>
Signed-off-by: Nitin Vegesna <nvegesna@nvidia.com>
Description
Activation checkpointing currently samples the global FP8 state before invoking
the checkpointed callable. If that callable opens its own FP8 autocast context,
the initial forward is incorrectly treated as a non-FP8 checkpoint region.
Delayed-scaling modules therefore do not preserve the scale and amax metadata
needed by the recompute forward.
Track the activation-recompute region independently of the FP8 state at context
entry, and gate the public query on the current FP8 state instead. This keeps
non-FP8 execution unchanged while allowing an inner FP8 autocast context to
participate in activation-recompute bookkeeping.
Changes
checkpointed callable.
FP8/non-FP8 checkpoint regions with both reentrant and non-reentrant
checkpoint implementations.
Validation
gradients, FP8 recompute metadata is preserved only for FP8 modules, and a
fully non-FP8 checkpoint does not create FP8 recompute metadata.
FP8 autocast context opened inside the checkpointed callable. Training
completed with finite loss and gradients, and the missing recompute metadata
failure did not recur.
git diff --checkpasses.Python 3.9 interpreter cannot parse syntax already present on the current
mainbranch. The reported errors were confined to unchanged files.