[full_dtensor] Allow sharding config to wrap declared plain inputs#3860
Open
Matrix-Z97 wants to merge 1 commit into
Open
[full_dtensor] Allow sharding config to wrap declared plain inputs#3860Matrix-Z97 wants to merge 1 commit into
Matrix-Z97 wants to merge 1 commit into
Conversation
|
|
Contributor
|
For full dtensor mode, the inputs shouldn't have plain tensors. The raise is intentional, not a miss. |
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.
Summary
This PR updates
Module._redistribute_inputs()so plain Tensor inputs with explicitin_src_shardingsare wrapped viaDTensor.from_local()before the full_dtensor plain-Tensor guard is applied.With this change:
in_src_shardingsare converted according to their sharding config;Why
The existing
ShardingConfigcontract documents thatin_src_shardingscan be used to annotate plain tensors as DTensors at module boundaries.However, the previous full_dtensor logic rejected any plain Tensor input before checking whether that input had a declared source sharding. As a result, this documented path was unreachable in full_dtensor mode:
I am not entirely sure whether the previous behavior was intentional or a bug. The current ShardingConfig and _redistribute_inputs() documentation both suggest that plain Tensor inputs with explicit in_src_shardings should be wrapped at the module boundary, but full_dtensor mode previously raised before that path could run. Could reviewers confirm whether this relaxation matches the intended full_dtensor contract?