-
Notifications
You must be signed in to change notification settings - Fork 74.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IFRT] Add xla::ifrt::Sharding::IsFullyReplicated()
IFRT Sharding type gains `IsFullyReplicated()`, which quickly tells if the sharding represents a fully-replicated sharding. The main motivation is to make full replication information queriable at IFRT shardings and prepare for enabling IFRT implementations to handle full replication directly. There are a preset of rules: * `SingleDeviceSharding` is trivially fully replicated by its definition. * `ConcreteSharding` and `OpaqueSharding` is not fully replicated. They have special cases where it may be fully replicated, but the user is advised to use a more specific sharding type to represent such cases. * `ConcreteEvenSharding` may/may not fully replicated. This is controlled at creation time. * `ShardingParamSharding` and (IFRT) `HloSharding` depend on whether their lower-level sharding represents full replication. `ConcreteEvenSharding` is a noteworthy case where the full replication information does not come from the existing source of the information. This is because the creators of this sharding (e.g., JAX) typically has the information, but the replication information is lost when coercing it into `ConcreteEvenSharding`. This problem will be gradually less problematic once JAX uses a higher-level IFRT sharding type (mainly (IFRT) `HloSharding`) at more places. This change extends the `Sharding` type, but the new method is not used by any existing code. PiperOrigin-RevId: 635667260
- Loading branch information
1 parent
4d210c6
commit aed4341
Showing
10 changed files
with
217 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.