npx skills add ...
npx skills add nvidia/tensorrt-incubator --skill tripy-compilation
Work with the nvtripy compilation pipeline. Use when: using tp.compile, creating InputInfo or DimensionInputInfo, understanding the Trace → MLIR → TensorRT flow, configuring optimization levels, working with Executable objects, debugging compilation, using dynamic shapes or NamedDimension.
npx skills add nvidia/tensorrt-incubator --skill tripy-compilation
tp.compile()InputInfo and DimensionInputInfoExecutable objectstensorrt dialectExecutable objecttp.compile() — The Main Entry Point| Argument Type | Behavior |
|---|---|
InputInfo(shape, dtype) | Becomes a runtime input to the executable |
DimensionInputInfo(value_bounds) | Becomes a runtime scalar dimension input |
Tensor | Baked in as a compile-time constant |
| Any other type | Baked in as a compile-time constant |
The compiled Executable only accepts parameters that were InputInfo/DimensionInputInfo in the original compile() call.
InputInfo — Tensor Runtime InputsDimensionInputInfo — Scalar Dimension InputsFor functions that take scalar shape values as parameters:
Used when a function parameter controls a reshape or dynamic shape operation.
Executable — Running Compiled FunctionsExecutable propertiesinput_infos: Dict of parameter name → InputInfostream: The CUDA stream used for execution__signature__: Compatible with inspect.signature() for introspection.eval() for inputsRuntime inputs to compiled functions should be evaluated tensors (not lazy). Use .eval() to force evaluation before passing to the executable.
When compiling a Module:
state_dict() entries are named for readable tracesInputInfo arguments become runtime inputs| Level | Description |
|---|---|
| 0 | Minimal optimization, fastest compile |
| 1–2 | Moderate optimization |
| 3 | Default — good balance |
| 4–5 | Maximum optimization, slowest compile |
The timing cache stores kernel profiling data across compilations, significantly speeding up repeated compilations with similar operations.
The MLIR compiler (nvtripy/backend/mlir/compiler.py) uses these options:
--tensorrt-timing-cache-path: Path to timing cache--tensorrt-builder-opt-level: Optimization level (0-5)--force-entrypoints-return-allocs: Memory management--mlir-elide-elementsattrs-if-larger: Debug readability--tensorrt-layer-info-dir: TensorRT layer debug infotp.compileThe function passed to compile() must:
print, assert, file I/O)Tensor return types supportedList[Tensor] or Dict[str, Tensor] will be frozen as constants*args and **kwargs are frozen at compile timeInputInfo used for all runtime tensor inputsDimensionInputInfo used for scalar shape parameters(min, opt, max) tuplestp.compile().eval()'d before passing to executable