diff options
author | 2018-06-14 20:19:20 -0700 | |
---|---|---|
committer | 2018-06-14 20:22:04 -0700 | |
commit | 3cd4eda38e12351c06d45d0780e16d482491ab95 (patch) | |
tree | 590d0fa390e4a7c714594170f55e7f0486ca808f | |
parent | 7f3dbd0f1ba1de89fb82226ea9f4506a97b9b19d (diff) |
Added comment to explain plugging on external sharding normalizers.
PiperOrigin-RevId: 200662293
-rw-r--r-- | tensorflow/compiler/xla/service/hlo_sharding_metadata.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_sharding_metadata.cc b/tensorflow/compiler/xla/service/hlo_sharding_metadata.cc index 7b4b071af4..748273a43c 100644 --- a/tensorflow/compiler/xla/service/hlo_sharding_metadata.cc +++ b/tensorflow/compiler/xla/service/hlo_sharding_metadata.cc @@ -235,6 +235,23 @@ StatusOr<int64> ApplyDomainShardingPass(const DomainMetadata::Domain& domain, Status ApplyDomainSharding(const DomainMetadata::Domain& domain, const HloSharding& sharding) { + // Here is the place to call external sharding normalizers, which are + // implemented in other modules (ie, spatial partitioning). + // The signature of the external normalizer function should be something + // like: + // + // StatusOr<bool> Normalizer(const DomainMetadata::Domain&, + // const HloSharding& sharding); + // + // The function should return true if it has processed the domain + // normalization, false if domain was not one recognized by it, or an error. + // We will call the functions in order below, and fall back to local code if + // none of the external normalizers acted on the domain. + // External normalizers should not handle the cases that are already handled + // locally. + + // None of the external normalizers handled the domain sharding, try to see + // whether this is a single sharding first. auto single_sharding = sharding.ExtractSingleSharding(); if (single_sharding) { // Shortcut the simple case. We have a unique sharding, so we call |