Repository navigation
fix: run cross_entropy on AsyncCollectiveTensor logits in eager mode - #1032
Closed
xuan7zhang wants to merge 1 commit into
Closed
xuan7zhang wants to merge 1 commit into
xuan7zhang wants to merge 1 commit into
Conversation
F.cross_entropy failed on the AsyncCollectiveTensor output of RowwiseParallel with "Tensor not bound: lazy alloc kAlloc may not have executed". Root cause: cross_entropy_autograd_privateuse1 calls the kernel with _op_dk(PrivateUse1). This call skips the Python dispatch key, which AsyncCollectiveTensor uses to wait for the collective and unwrap its inner tensor. The kernel thus got a wrapper tensor with no storage. Fix: for a traceable wrapper subclass input, use the CompositeImplicitAutograd decomposition. The plain-tensor path and the DTensor path do not change. I used an AI assistant to help write this change.
Collaborator
|
Thanks for the fix, @xuan7zhang, and for taking the time to send it. We have already fixed this internally, so we'll close this one. We appreciate it. |
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
For wrapper subclass inputs, such as the
AsyncCollectiveTensoroutput ofRowwiseParallel, the cross_entropy autograd handler now uses theCompositeImplicitAutograddecomposition. Plain tensors and DTensors do not change.I used Claude Code to help write this change, and I reviewed and tested it myself.
Related Issue
Fixes #1026
Motivation and Context
The handler called the kernel with
_op_dk(PrivateUse1), which skips the Python key.AsyncCollectiveTensordid not unwrap, and the kernel failed with"Tensor not bound: lazy alloc kAlloc may not have executed".
No open PR covers this.
Type of Change
Testing
Eager, 4 devices (trn2.3xlarge). The DTensor tests use
world_size = 8, so I set itto 4 locally for these runs. That change is not in the PR.
Ran locally (no Neuron hardware needed):
Ran on Neuron hardware:
Checklist