[PyTorch] Deprecate unused is_cg_capturable in parallel_cross_entropy - #3455
Merged
Conversation
Since NVIDIA#3273 the cross entropy backward no longer contains a synchronization point, so the operation is always CUDA graph capturable and the flag has no effect. Keep accepting it on the public API for backward compatibility (with a FutureWarning), drop the dead internal plumbing. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Closed
13 tasks
Collaborator
Author
|
/te-ci pytorch L0 |
Contributor
Greptile SummaryThe PR retains the public
Confidence Score: 5/5The PR appears safe to merge because the public signature remains compatible and all affected internal call contracts remain aligned. The retained public parameter emits the intended warning for its only nondefault value, while the internal autograd and Triton paths consistently remove the dead argument without leaving mismatched callers or gradient slots. Important Files Changed
Reviews (1): Last reviewed commit: "Drop removal promise from deprecation no..." | Re-trigger Greptile |
Collaborator
|
/te-ci pytorch L0 |
ptrendx
approved these changes
Sep 1, 2026
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.
Description
Since #3273 the fused cross entropy backward reconstructs the derivative from saved statistics and no longer contains the
torch.equal-based synchronization point. Theis_cg_capturableflag therefore has no effect — the operation is always CUDA graph capturable.This PR marks the flag as deprecated on the public
parallel_cross_entropyAPI (docstring note +FutureWarningwhen set) and removes the dead internal plumbing. The parameter is kept in the signature for backward compatibility, since Megatron-LM passes it explicitly.Should also be mentioned as deprecated in the v2.19 release notes.
Type of change
Changes
Please list the changes introduced in this PR:
is_cg_capturableinparallel_cross_entropy: docstring now states it is unused, and passingTrueemits aFutureWarning.CrossEntropyFunction,_parallel_cross_entropy_overwrite_inputand the Tritoncross_entropy_backwardwrapper, where it was already a no-op.Checklist: