TECHNOLOGY

ONNX Runtime large-graph startup: a wide ready set can make topological sorting expensive

In this article
THE QUICK TAKE

The 1.32 topological-sort change targets wide ready sets during initialization; preserve visit ordering and measure graph structure, not only node count.

ONNX Runtime 1.32.0 includes a session-creation change replacing a sorted-list ready set with a priority queue in topological sorting. The linked PR targets graphs with many simultaneously ready nodes, including constants. The important shape here is graph width and ordering work, rather than a neural tensor’s dimensions or the model’s parameter count.

A chain and a wide graph stress different work

A long dependency chain may keep only a few nodes ready at once. A graph with many independent constants can fill the ready set immediately. Linear insertion into a sorted list behaves differently in those cases. A proposed scaling test keeps node count comparable while varying dependency width, recording sort time separately. This distinguishes the data-structure mechanism from a generic statement that all big graphs are slow to initialize.

A heap must preserve the intended priority

The PR explains that the comparator’s tie-breaking preserves visitation order under the new structure. That property matters because an initialization optimization should not introduce arbitrary ordering changes as a side effect. A proposed unit check compares emitted node sequences on tied-priority and mixed-priority graphs. Numerical model outputs are still useful, but they may not reveal changed planning order when several valid topological orders happen to compute the same result.

Repeated graph views amplify the cost

Upstream notes that graph viewers perform sorting and can be constructed by multiple transformers. A moderate per-sort cost can therefore accumulate across session creation. Profile total invocation count as well as individual sort duration. A benchmark that runs the sort once may explain complexity but understate its actual initialization share, while a full startup number alone can hide why a seemingly small container replacement mattered.

Do not turn one stress case into a universal ratio

The PR reports dramatic improvement for constant-heavy large graphs alongside other changes. Those numbers are attributed examples, not predictions for another model. This article reports the ready-set mechanism and proposed structural controls without new timings. A correct local conclusion links width, sort frequency and startup time, while keeping steady-state inference performance separate from the initialization work that changed.

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