Scaling NVIDIA TensorRT Performance Optimization Beyond a Single Build Route with the Global Performance Tuner, Part 2 NVIDIA's Global Performance Tuner, released in TensorRT 11.1, automatically tunes performance by treating alternative scheduling strategies as explicit, searchable build routes, each a concrete combination of compiler knob values. Part 2 of NVIDIA's series describes the feature's algorithm and architecture and offers best practices, noting that TensorRT still performs remaining engine construction stages such as tactic selection after a route is applied. Because no single fusion strategy is universally better across models, tensor shapes and target GPUs, NVIDIA says selecting the better route requires building candidate engines and comparing their end-to-end performance. The Global Performance Tuner https://docs.nvidia.com/deeplearning/tensorrt/latest/performance/tuning.html is a feature for automatic performance tuning released in NVIDIA TensorRT 11.1 https://docs.nvidia.com/deeplearning/tensorrt/latest/getting-started/release-notes-11/11.1.0.html . It provides automatic, accuracy-aware and end-to-end performance tuning within TensorRT by customizing different optimizations for different models. For more details, see Part 1 https://developer.nvidia.com/blog/scaling-nvidia-tensorrt-performance-optimization-beyond-a-single-build-route-with-the-global-performance-tuner-part-1/ of this series, which introduces the challenges associated with scheduling a critical stage in deep learning compiler optimization , the motivation for developing the Global Performance Tuner feature in TensorRT, and the mathematical theories established to formalize the problem. This post, Part 2, uses the notation from Part 1 to describe the algorithm and architectural design of the Global Performance Tuner feature. It also provides best practices for using it. Designing the Global Performance Tuner feature in TensorRT The central design idea of the Global Performance Tuner is to represent alternative scheduling strategies as explicit and searchable build routes. A compiler knob also called a compiler flag or compiler option is a configuration setting that changes some aspect of the compilation pipeline, such as a heuristic, fusion decision, or code generation path. Each tunable knob exposes a finite set of allowed values and has a default value. A build route is a concrete combination of knob values. When no build route is specified, TensorRT uses the default build route, in which every knob retains its default value. Consider a hypothetical compiler consisting of three passes, $f 1$, $f 2$, and $f 3$. Suppose a binary knob $p$ controls the fusion strategy used by $f 2$: when $p=1$, the pass applies horizontal fusion; when $p=0$, it applies vertical fusion: $f 2 s = \begin{cases} f’ 2 s , & \text{if } p = 1 \\ f” 2 s , & \text{if } p = 0 \end{cases}$ The two possible values of $p$ define two build routes and therefore produce a candidate solution set of size two for the input model $m$: $B m = \{f 3 f’ 2 f 1 m ,\, f 3 f” 2 f 1 m \}$ Neither fusion strategy is universally better. Horizontal fusion may produce the faster engine for one model, while vertical fusion may be more effective for another. The result may also change across tensor shapes and target GPUs, even when the model itself remains unchanged. Selecting the better route therefore requires building both candidate engines and comparing their end-to-end performance. Even this two-route example captures the essential idea of tuning: the compiler exposes meaningful scheduling alternatives, and measured behavior determines which complete solution performs best for the deployment case at hand. In the mathematical framework introduced earlier, a build route is a composition of compiler passes. In the implementation, a combination of knob assignments provides a compact specification of that route. Changing one or more knob values changes how the model travels through the tunable parts of the compilation pipeline. Within this abstraction, a knob combination can be treated as identifying a build route. More precisely, the knob combination is a build-route specification, not a complete description of the resulting engine. TensorRT still performs the remaining stages of engine construction, including tactic selection, and may reconcile individual knob values with constraints imposed by the network. The route specifies the requested choices within the tunable configuration space. It does not replace the rest of the TensorRT builder. TensorRT exposes a compact API surface around two fundamental capabilities: - Apply and inspect one build route : A setter applies a fixed route to the builder configuration, while the corresponding getter returns the currently specified route. - Discover the tunable configuration space : A separate getter describes the available knobs, their allowed values, their defaults, and their purposes. The corresponding C++ APIs are: bool IBuilderConfig::setBuildRoute char const buildRoute ; char const IBuilderConfig::getBuildRoute const; char const IBuilderConfig::getAllBuildRoutes const; You can use these APIs to implement custom tuners. A sample C++ implementation is also provided in trtexec . At a high level, trtexec organizes tuning as follows: - When a user specifies an input model and a regex-like tunable build route expression, trtexec will expand the expression into a list of concrete build routes according to the searching algorithm. - There will be a loop to traverse all fixed build routes. In each iteration, the model will be built with that single build route, then accuracy and performance will be measured during each iteration. - All build routes that crash during building or fail accuracy during inference are excluded from best-engine selection. The engine with the best measured end-to-end performance is selected. TensorRT 11.1 provides more than 200 knobs for tuning. For more details, refer to the Global Performance Tuner documentation https://docs.nvidia.com/deeplearning/tensorrt/latest/performance/tuning.html . The same implementation in Python will be released in Torch-TensorRT 2.15. The practical value of exploring multiple build routes becomes visible in end-to-end measurements. Figure 1 compares the default TensorRT build route, normalized to 1.0x for each workload, with the best eligible route found during tuning. Across these ten evaluated workloads, tuning delivered performance improvements ranging from 1.14x to 1.63x. The variation across workloads is central to the result. Different models expose different optimization opportunities, so a single default scheduling strategy cannot be expected to realize every model’s best performance. The Global Performance Tuner explores alternative build routes, rejects candidates that do not satisfy the accuracy requirement, and selects the fastest eligible engine measured in the target environment. Case study: Performance-accuracy entanglement The Global Performance Tuner feature applies accuracy-aware tuning, so the performance-accuracy entanglement problem can theoretically be solved perfectly. Consider the following thought experiment. For a simple neural network model, as shown in Figure 2, imagine there are knobs controlling whether to force some IRs to use a low-precision kernel, which is equivalent to converting the graph into quantized graph by inserting Q/DQ nodes between ops. This is not supported by TensorRT 11.0 and later because weakly typed APIs are deprecated. This model has four places to insert Q/DQ. Suppose these are controlled by four different binary knobs. The deep learning compiler could then provide 2