torch.accelerator.memory.memory_stats
"allocated_bytes.{all,large_pool,small_pool}.{current,peak,allocated,freed}"
"segment.{all,large_pool,small_pool}.{current,peak,allocated,freed}":
number of reserved segments from device memory allocation.
"reserved_bytes.{all,large_pool,small_pool}.{current,peak,allocated,freed}":
amount of reserved memory.
"active.{all,large_pool,small_pool}.{current,peak,allocated,freed}":
number of active memory blocks.
"active_bytes.{all,large_pool,small_pool}.{current,peak,allocated,freed}":
amount of active memory.
"inactive_split.{all,large_pool,small_pool}.{current,peak,allocated,freed}":
number of inactive, non-releasable memory blocks.
"inactive_split_bytes.{all,large_pool,small_pool}.{current,peak,allocated,freed}":
amount of inactive, non-releasable memory.
For these core statistics, values are broken down as follows.
all: combined statistics across all memory pools.
large_pool: statistics for the large allocation pool
(as of June 2025, for size >= 1MB allocations).
small_pool: statistics for the small allocation pool
(as of June 2025, for size < 1MB allocations).
current: current value of this metric.
peak: maximum value of this metric.
allocated: historical total increase in this metric.
freed: historical total decrease in this metric.
In addition to the core statistics, we also provide some simple event
counters:
"num_alloc_retries": number of failed device memory allocation calls that
result in a cache flush and retry.
"num_ooms": number of out-of-memory errors thrown.
"num_sync_all_streams": number of synchronize_and_free_events calls.
"num_device_alloc": number of device memory allocation calls.
"num_device_free": number of device memory free calls.