﻿# ONNX Runtime 1.32 device memory queries: available bytes are a snapshot, not a reservation

ONNX Runtime 1.32 memory-capacity APIs report device capacity and advisory availability; neither value reserves memory for a future session.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-ort-device-capacity-advisory-snapshot/
Language: en

ONNX Runtime 1.32.0 adds provider-neutral device memory-capacity queries with CUDA implementations. Upstream separates device-global total capacity from estimated available memory and explicitly calls the latter advisory. This helps an application inspect a device, but a successful query cannot promise that a later allocation of the same size will succeed.

## Total capacity has a device scope

The PR defines total memory as capacity exposed by the selected EP device and memory type. A partitioned device can expose less than the physical board, and the number is not a per-process allocation budget. Preserve the selected device identity with the query. Otherwise an application may compare model requirements against a different resource boundary than the one from which it will actually allocate.

## Availability changes after the query

Other work can allocate memory between inspection and session initialization. The application itself may create contexts or staging buffers during that interval. A capacity check should therefore be used for planning and informative errors, with ordinary allocation failure handling retained. Treating a free-memory snapshot as an admission guarantee creates a time-of-check assumption that the API explicitly does not supply.

## Failure is not a zero-capacity device

Upstream documents unsupported providers or memory types returning a not-implemented result and preserving outputs on failure. A caller must inspect status before consuming an output variable. Substituting zero for every query error confuses lack of support with a genuinely small device and can produce misleading model-selection decisions. A proposed test includes an unsupported query and verifies that stale output values are never interpreted as fresh capacity evidence.

## Measure inspection overhead independently

The PR distinguishes total-only queries from availability queries and discusses context-initialization effects. If an application polls frequently, measure the actual query mode rather than assuming inspection is free. Keep it outside a benchmark’s timed inference interval unless it belongs to the product request path. This article reports the new API semantics and proposed checks, without claiming a model-fit guarantee or a new memory measurement on the user’s hardware.

## Sources

- [ONNX Runtime v1.32.0 release](https://github.com/microsoft/onnxruntime/releases/tag/v1.32.0)
- [ONNX Runtime pull request #33447](https://github.com/microsoft/onnxruntime/pull/33447)

## Related reading

- [CUDA OOM Allocated vs Reserved: Read the Evidence](/journal/cuda-oom-reserved-vs-allocated/)
- [ONNX Runtime provider order: graph partition priority is not request failover](/journal/fg2-onnxruntime-provider-priority-subgraph-partition/)
