message: [XLA][NFC] Call `get_group_id` just once in `HloSharding::PartialTile`
diff: @@ -97,9 +97,10 @@ HloSharding HloSharding::PartialTile(
  });
  Array<int64> sorted_tile(tile_assignment_last_dim_replicate.dimensions());
  sorted_tile.Each([&](absl::Span<const int64> indices, int64* device) {
  - auto begin = sorted_groups[get_group_id(indices)].begin();
  + const int64 group_id = get_group_id(indices);
  + auto begin = sorted_groups[group_id].begin();
  *device = *begin;
  - sorted_groups[get_group_id(indices)].erase(begin);
  + sorted_groups[group_id].erase(begin);
  });
  return HloSharding(sorted_tile, /*replicate_on_last_tile_dim=*/true,
  metadata);
  @@ -428,13 +429,12 @@ Status HloSharding::ValidateNonTuple(const Shape& shape,
  // unique.
  Status status = Status::OK();
  absl::flat_hash_set<int64> seen_cores;
  - tile_assignment_.Each(
  - [&](absl::Span<const int64> indices, int32 core) {
  + tile_assignment_.Each([&](absl::Span<const int64> indices, int32 core) {
  // Don't overwrite a bad status, so we report the first error.
  if (status.ok()) {
  if (core >= num_devices) {
  - status = tensorflow::errors::InvalidArgument(StrCat(
  - "core ", core, " > ", num_devices, " in tile assignment"));
  + status = tensorflow::errors::InvalidArgument(
  + StrCat("core ", core, " > ", num_devices, " in tile assignment"));
  } else if (seen_cores.contains(core)) {
  status = tensorflow::errors::InvalidArgument(
  StrCat("core ", core, " is not unique in tile assignment"));
  