tensorflow/compiler/xla/service/collective_ops_utils.cc
// Returns the group formation mode implied by (a) whether the operation has
// channel_id and (b) if it has use_global_device_ids and if yes, its value.
Returns the group formation mode implied by (a) whether the operation has
channel_id and (b) if it has use_global_device_ids and if yes, its value.
Returns the group formation mode implied by ( a ) whether the operation has channel_id and ( b ) if it has use_global_device_ids and if yes its value .
StatusOr<CollectiveOpGroupMode> GetCollectiveOpGroupMode(
    bool has_channel_id, absl::optional<bool> use_global_device_ids) {
  if (!has_channel_id) {
    if (!use_global_device_ids.has_value() || !*use_global_device_ids) {
      return CollectiveOpGroupMode::kCrossReplica;
    } else {
      return InvalidArgument(
          "Invalid combination of has_channel_id and use_global_device_ids");
    }
  } else {
    if (!use_global_device_ids.has_value()) {
      return CollectiveOpGroupMode::kCrossPartition;
    } else if (!*use_global_device_ids) {
      return CollectiveOpGroupMode::kCrossReplicaAndPartition;
    } else {
      return CollectiveOpGroupMode::kFlattenedID;
    }
  }
}
StatusOr < CollectiveOpGroupMode > GetCollectiveOpGroupMode ( bool has_channel_id , absl :: optional < bool > use_global_device_ids ) { if ( ! has_channel_id ) { if ( ! use_global_device_ids . has_value ( ) || ! * use_global_device_ids ) { return CollectiveOpGroupMode :: kCrossReplica ; } else { return InvalidArgument ( " " ) ; } } else { if ( ! use_global_device_ids . has_value ( ) ) { return CollectiveOpGroupMode :: kCrossPartition ; } else if ( ! * use_global_device_ids ) { return CollectiveOpGroupMode :: kCrossReplicaAndPartition ; } else { return CollectiveOpGroupMode :: kFlattenedID ; } } }
Returns the group formation mode implied by (a) whether the operation has
channel_id and (b) if it has use_global_device_ids and if yes, its value.
Returns the group formation mode implied by ( a ) whether the operation has channel_id and ( b ) if it has use_global_device_ids and if yes its value .