class_docstr: Stats for a sharding planner execution.
class_docstr_tok: ["Stats","for","a","sharding","planner","execution","."]
code: def _log_max_perf_and_max_hbm(
      self, perfs: List[Perf], used_hbm: List[int]
  ) -> None:
      max_total_perf_text = f"Longest Critical Path (Maximum of Total Perf): {_generate_max_text([perf.total for perf in perfs])}"
      max_fwd_compute_perf_text = f"Maximum of Forward Compute: {_generate_max_text([perf.fwd_compute for perf in perfs])}"
      max_fwd_comms_perf_text = f"Maximum of Forward Comms: {_generate_max_text([perf.fwd_comms for perf in perfs])}"
      max_bwd_compute_perf_text = f"Maximum of Backward Compute: {_generate_max_text([perf.bwd_compute for perf in perfs])}"
      max_bwd_comms_perf_text = f"Maximum of Backward Comms: {_generate_max_text([perf.bwd_comms for perf in perfs])}"
      max_prefetch_compute_perf_text = f"Maximum of Prefetch Compute: {_generate_max_text([perf.prefetch_compute for perf in perfs])}"
  
      sum_of_maxima = (
          max(perf.fwd_compute for perf in perfs)
          + max(perf.fwd_comms for perf in perfs)
          + max(perf.bwd_compute for perf in perfs)
          + max(perf.bwd_comms for perf in perfs)
          + max(perf.prefetch_compute for perf in perfs)
      )
      sum_of_maxima_text = (
          f"Sum of Maxima: {round(sum_of_maxima, 3)} ms"
      )
  
      self._stats_table.append(f"#{'' : ^{self._width-2}}#")
      self._stats_table.append(
          f"# {max_total_perf_text : <{self._width-3}}#"
      )
      self._stats_table.append(
          f"# {max_fwd_compute_perf_text : <{self._width-3}}#"
      )
      self._stats_table.append(
          f"# {max_fwd_comms_perf_text : <{self._width-3}}#"
      )
      self._stats_table.append(
          f"# {max_bwd_compute_perf_text : <{self._width-3}}#"
      )
      self._stats_table.append(
          f"# {max_bwd_comms_perf_text : <{self._width-3}}#"
      )
      self._stats_table.append(
          f"# {max_prefetch_compute_perf_text : <{self._width-3}}#"
      )
      self._stats_table.append(
          f"# {sum_of_maxima_text : <{self._width-3}}#"
      )
  
      max_hbm = max(used_hbm)
      max_hbm_indices = [
          i for i in range(len(used_hbm)) if used_hbm[i] == max_hbm
      ]
      rank_text = "ranks" if len(max_hbm_indices) > 1 else "rank"
      max_hbm_indices = _collapse_consecutive_ranks(max_hbm_indices)
      max_hbm_ranks = f"{rank_text} {','.join(max_hbm_indices)}"
      peak_memory_pressure = f"Peak Memory Pressure: {round(bytes_to_gb(max_hbm), 3)} GB on {max_hbm_ranks}"
      self._stats_table.append(f"#{'' : ^{self._width-2}}#")
      self._stats_table.append(
          f"# {peak_memory_pressure : <{self._width-3}}#"
      )
  
imports: import logging
  from collections import defaultdict
  from typing import Any, cast, Dict, List, Optional, Tuple, Union
  from torch import nn
  from torchrec.distributed.planner.constants import BIGINT_DTYPE, NUM_POOLINGS
  from torchrec.distributed.planner.shard_estimators import _calculate_shard_io_sizes
  from torchrec.distributed.planner.storage_reservations import FixedPercentageStorageReservation, HeuristicalStorageReservation, InferenceStorageReservation
  from torchrec.distributed.planner.types import ParameterConstraints, Perf, ShardingOption, Stats, Storage, StorageReservation, Topology
  from torchrec.distributed.planner.utils import _find_imbalance_tables, bytes_to_gb, bytes_to_mb, sharder_name
  from torchrec.distributed.types import ModuleSharder, ParameterSharding, ShardingPlan, ShardingType
label_desc: Use image node_id 4 for calling the EmbeddingStats obj's underlying member method code with example usage: obj._log_max_perf_and_max_hbm(perfs, used_hbm) without return types