Introduction
A TensorRT engine is a model compiled by NVIDIA
TensorRT to run as fast as possible on one kind of NVIDIA GPU. TensorRT takes a
trained network, usually as an ONNX file, merges layers,
picks the fastest GPU kernels for each step and can lower the number precision, then
writes the result out as a serialised engine. The extension is .engine or
.plan; NVIDIA’s Triton Inference Server expects the name
model.plan.
An engine is not a portable model. It works only with the TensorRT version that built it and on the same GPU model, or at least the same GPU architecture, so it is normally built on the machine that will run it and kept beside the ONNX file it came from.
Structure
No public layout exists: NVIDIA does not document the engine format, so this
site has no byte-level reference page for it. The layout is internal to TensorRT. The file holds the optimised
network, the chosen kernels and the weights, and is read back with TensorRT’s runtime
(deserializeCudaEngine). The trtexec tool that comes with
TensorRT builds one with --saveEngine and can load and time one with
--loadEngine.
Links
Software
- NVIDIA TensorRT – builds and runs engines, with the
trtexectool (Windows, Linux) - Triton Inference Server – NVIDIA’s model server, which loads engines named
model.plan(Linux)
Developers
- TensorRT – APIs for building and loading engines (C++, Python)
Reference
- TensorRT documentation – NVIDIA’s developer guide and API reference