npx skills add ...
npx skills add nvidia/tensorrt-incubator --skill tripy-debugging
Debug and diagnose errors in nvtripy code. Use when: interpreting TripyException stack traces, enabling MLIR/TensorRT debug output, understanding error reporting with stack_info, using raise_error, configuring debug environment variables, tracing compilation failures.
npx skills add nvidia/tensorrt-incubator --skill tripy-debugging
TripyException error messages and stack tracesraise_error — The Primary Error FunctionFrom nvtripy/common/exception.py:
details: A list of strings and/or tensors. Tensors will have their stack info rendered.TripyExceptionEvery tensor captures its creation stack trace (_stack_info) for precise error reporting. This is managed in nvtripy/utils/stack_info.py.
When a tensor appears in raise_error details, the system renders the exact line and column where the tensor was created, helping users trace back to the problematic code.
Key points:
Tensor.from_trace_tensor(out, include_code_index=stack_depth) — sets the stack depth for error reportingSTACK_DEPTH_OF_FROM_TRACE_TENSOR = 4 — the default depth in create_opstack_depth_offset parameter in create_op adjusts for wrapper functionsSet these before running to enable debug output:
| Variable | Default | Description |
|---|---|---|
TRIPY_MLIR_DEBUG_ENABLED | "0" | Enable MLIR debug output |
TRIPY_MLIR_DEBUG_TYPES | "-translate-to-tensorrt" | Comma-separated MLIR pass types to debug |
TRIPY_MLIR_DEBUG_PATH | "/tripy/mlir-dumps" | Directory for MLIR debug dumps |
TRIPY_TRT_DEBUG_ENABLED | "0" | Enable TensorRT debug output |
TRIPY_TRT_DEBUG_PATH | "/tripy/tensorrt-dumps" | Directory for TensorRT debug dumps |
TRIPY_EXTRA_ERROR_INFORMATION | "" | Comma-separated extra error info |
From nvtripy/config.py:
The logging system (nvtripy/logging/) provides granular control:
The VerbosityTrie allows setting different log levels for different module paths, using a trie data structure for efficient prefix matching.
Error pattern: Expected 'input' to be one of [...] (but it was '...')
This comes from the constraint system. Check:
input_requirements in the @wrappers.interface decoratorEnable MLIR debug output:
Check the dumps in /tripy/mlir-dumps/ for the MLIR IR at each pass.
The trace system tracks shapes through infer_rank on trace ops. Check:
infer_rank policy on the trace opDYNAMIC_DIM = -1) vs static shapesEnable TensorRT debug output:
Check:
InputInfo boundsUse the helper.raises context manager:
The raises helper supports:
ExcType: Expected exception typematch: Regex pattern to match against error messagehas_stack_info_for: Verify that specific tensors' stack info appears in the errorraise_error() instead of raw raise for user-facing errorsdetails for stack info renderinghelper.raises(tp.TripyException, match=...)