Repository navigation
Fix convergence issue with mxfp8 param + full cuda graph - #3076
Conversation
Signed-off-by: qiyuw <qiyuw@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change modifies Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/claude review |
|
/ok to test b5e8c46 |
What does this PR do ?
When using fp8_param_gather=True + reuse_grad_buf_for_mxfp8_param_ag=True + overlap_param_gather=True with full-iteration CUDA graph (cuda_graph_impl=local, cuda_graph_scope=full_iteration), the first training iteration after warmup produces zero grad norm and incorrect loss.
Root cause: _handle_mxfp8_param_buffer_copy() guards the _copy_main_params_to_param_buffer() call behind a forward_pre_hook_enabled check. The main training loop intentionally disables forward pre-hooks for the first iteration (line 283-284 of train.py), so the copy is skipped. Without CUDA graphs this is safe — params are already in param.data and no all-gather runs.
However, with full-iteration CUDA graph, the all-gather (and the subsequent copy-to-param.data + zero of param_data) are baked into the captured graph and replay unconditionally. On the first iteration:
zero_grad_buffer() zeros param_data
_handle_mxfp8_param_buffer_copy() is skipped (hooks disabled)
Graph replays → AG gathers from param_data (all zeros) → copies zeros to param.data
Forward runs with zero weights → zero gradients
Changelog
GitHub Actions CI
See the CI sectionin the Contributing doc for how to trigger the CI. A Nvidia developer will need to approve and trigger the CI for external contributors.
Before your PR is "Ready for review"
Pre checks:
If you haven't finished some of the above items you can still open "Draft" PR.
Additional Information
Summary by CodeRabbit
Release Notes