Repository navigation
Conversation
RealQuantTransformerLayer._report_quantize_tensor_info called a group-less torch.distributed.barrier() before and after it logged the layer's tensors on global rank 0. It runs once per layer during model construction when RealQuantTransformerLayer.verbose is True, for the FP8 real-quant layers that the ModelOpt GPT spec builds. Every rank enters those barriers once for each layer it builds. With uneven pipeline stages, ranks enter different numbers of WORLD barriers, so one stage's barriers pair with another stage's later collectives or the job hangs. A model whose grid does not span every rank, such as one MIMO module, hangs on its first layer, because the other ranks never enter. Only global rank 0 wrote the report, so the barriers ordered nothing. Drop both barriers and log through log_single_rank. No collective replaces them, so there is no group whose ranks must all reach the report. It still prints on rank 0 by default, now follows set_default_log_ranks, and no longer needs torch.distributed to be initialized. The path is dormant in this repo: verbose is a class attribute, and no flag sets it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
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.
Why.
RealQuantTransformerLayer._report_quantize_tensor_infocallstorch.distributed.barrier()with no group before and after it logs. It runs once per layer during model construction, whenRealQuantTransformerLayer.verboseis True. Every rank enters the two barriers once for each layer it builds.The path is dormant in this repo.
verboseis a class attribute, and no flag sets it.What.
megatron/core/post_training/modelopt/layers.py.log_single_rank. No collective replaces the barriers, so no group has to match the ranks that build the layer.set_default_log_ranks, and it no longer needstorch.distributedto be initialized.Tests.
test_real_quant_report_logs_without_collectivesintests/unit_tests/post_training/test_modelopt_module_spec.py. It patchesbarrier,monitored_barrier,all_reduce,all_gatherandbroadcastto raise, then calls the report on a stub layer. On a log rank it expects one line with the original and the quantized dtype. On any other rank it expects none.TestModelOptGPTModel,TestModelOptMLAMoE,TestModelOptLlama4MoE,TestModelOptHybridModel), which fail in setup without CUDA. They build no real-quant layer.verbose=Truewas built on GPUs.tools/check_process_group_usage.pyreports the same 3 pre-existing entries before and after.Compatibility.
verbose, nothing changes.verbose, the report no longer synchronizes ranks. It logs the same lines, on the ranks thatset_default_log_ranksnames (rank 0 unless changed).Part of #6307.
🤖 Generated with Claude Code