fix(rnnt): prevent deadlock in multi-GPU validation when validation batch is split - #16315
Open
mayuriphad wants to merge 1 commit into
Open
mayuriphad wants to merge 1 commit into
mayuriphad wants to merge 1 commit into
Conversation
…validation steps to prevent deadlocks Signed-off-by: mayuriphad <mayuriphad656@gmail.com>
mayuriphad
force-pushed
the
fix-rnnt-validation-deadlock
branch
from
September 28, 2026 19:01
965da02 to
e8ce9e8
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.
Fixes #16003
What & Why
When \use_loss_wer=True\ and \�alidation_ds.batch_size > joint.fused_batch_size, \RNNTJoint.forward\ splits the validation batch into micro-batches and accumulates WER using \self.wer.update()\ and \self.wer.compute().
Previously, the _to_sync\ flag was only overridden to \False\ during training (\if self.training:). During validation, this meant \self.wer.compute()\ attempted to synchronize across GPUs for every sub-batch. Since different ranks can receive different global batch portions and split them into a different number of sub-batches, the synchronization counts would mismatch and cause NCCL watchdogs to hang in a deadlock.
How it was fixed
This patch unconditionally un-sets the _to_sync\ flag before \update()\ and \compute()\ inside the \orward()\ sub-batch loop (not just during training), and restores it after. The sub-batch loop calculates local \wer_num\ and \wer_denom\ and simply returns them to the caller. The global sync across ranks will then be safely deferred to the outer Lightning validation epoch end loop where batch splits don't affect sync counts.