﻿# ONNX Runtime 1.32 local functions: call depth is not the same as total function count

The 1.32 local-function depth limit validates reachable call chains; count, file size and call depth are different model-loading properties.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-ort-local-function-depth-load-validation/
Language: en

ONNX Runtime 1.32.0 enforces a maximum model-local function call depth of 100, according to its release notes and linked implementation. The bound concerns reachable call chains. A model with many shallow functions and one with a small number of deeply chained functions can therefore have very different validation outcomes despite similar file size.

## Reachability defines the relevant graph

A function declaration that is never called does not create the same execution expansion as a reachable chain. The PR includes reachability and shared-tail cases in its validation design. A proposed test should retain both reachable and unreachable deep declarations, checking the documented acceptance boundary. Treating the maximum as a limit on the number of functions would reject a different class of models from the one this guard addresses.

## Shared tails are not independent depths

Several functions can call into a common downstream chain. A validator must consider the longest reachable path without confusing repeated visitation with extra nesting. A small synthetic graph with branching and a shared tail makes this property visible. Compare it with a simple linear chain at the boundary. The goal is deterministic acceptance of valid call graphs and rejection of excessive depth, not merely avoiding a crash on one example.

## Loading and graph mutation both matter

The PR integrates checks with graph resolution and discusses how model and subgraph state must be represented for validation. A local suite should load serialized boundary cases and, where editing APIs are used, validate the result after graph changes. Checking only an original file can miss a later transformation that introduces a deeper call chain. Preserve build mode because minimal-build paths can have different graph-resolution facilities.

## A depth guard is a bounded robustness feature

The release limit does not by itself bound tensor allocation, loop work or every possible model resource cost. Applications still need checks appropriate to their accepted workload. This article reports the specific call-depth validation and proposed boundary tests without claiming universal safe loading or new security findings. A clear failure at the documented boundary is the intended result for an over-deep function graph, not a regression requiring the guard to be disabled.

## Sources

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

## Related reading

- [ONNX local functions: copy domain bindings and operator imports with the body](/journal/fg2-onnx-local-function-domain-opset-binding/)
- [Reduced ONNX Runtime builds: model changes can require a new operator inventory](/journal/fg2-onnxruntime-reduced-operator-build-contract/)
