TECHNOLOGY

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

In this article
THE QUICK TAKE

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

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

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles