Windows TensorRT-RTX Setup¶
Steps to build and run rustnn with the TensorRT-RTX backend on Windows 10 or 11 (x64).
Install¶
- An NVIDIA driver for an RTX GPU.
nvidia-smimust list the device. - The TensorRT-RTX 1.6 SDK from https://developer.nvidia.com/tensorrt-rtx (NVIDIA developer
account required). Extract it, for example to
C:\TensorRT-RTX-1.6, and add itsbindirectory toPATH: thetrtxcrate loadstensorrt_rtx_1_6.dllby name. Alternatively callrustnn::backends::trtx::dynamically_load_tensorrt(Some(path))at startup. - Visual Studio Build Tools with the "Desktop development with C++" workload (linker and Windows SDK).
- LLVM for libclang, which autocxx uses while building
trtx-sys:winget install LLVM.LLVM, andLIBCLANG_PATH=C:\Program Files\LLVM\binwhen cargo cannot find it. protoc:winget install Google.Protobuf.- Rust from https://rustup.rs;
rust-toolchain.tomlselects the pinned toolchain. git config --system core.longpaths truebefore cloning; paths exceed 260 characters.- Optional: Node.js for the WPT tests, and ONNX Runtime for the
onnx-runtimefeature (make onnxruntime-download, thenORT_DYLIB_PATHas in Getting Started). Do not rely on theonnxruntime.dllinSystem32; it is too old for theortcrate.
The CUDA toolkit is not required for running: the CUDA driver API is loaded at run time.
Build¶
Verify¶
$env:RUST_LOG = "info"
cargo run --release --features trtx-runtime,onnx-runtime -- examples\sample_graph.webnn --convert onnx --run-trtx
The log lists the CUDA devices found and Backend selected: Trtx { cuda_device_idx: 0 }. In an
application, MLContextOptions::new(MLPowerPreference::HighPerformance, true) selects
TensorRT-RTX when the feature is enabled; context.rustnn_backend() confirms it.
WPT conformance¶
# Git Bash
export PATH="/c/TensorRT-RTX-1.6/bin:$PATH"
export ORT_DYLIB_PATH=/c/git/rustnn/target/onnxruntime/onnxruntime-win-x64-1.29.0/lib/onnxruntime.dll
make test-wpt-trtx
WPT_BACKEND=trtx make test-wpt-op OP=gemm
Set ORT_DYLIB_PATH even for TensorRT runs: the harness probes the ONNX Runtime backend too,
and a wrong DLL poisons the ONNX Runtime initialization for the rest of the process. Test output
is fully buffered when redirected to a file; watch the console or wait for the process to exit.
Troubleshooting¶
| Symptom | Cause and fix |
|---|---|
LoadLibraryExW error 126 when creating a context; TensorRT not selected |
tensorrt_rtx_1_6.dll is not on PATH. Add the SDK bin directory or load the library explicitly |
Failed to load ONNX Runtime dylib: BadVersion { version_str: "1.17.1" } |
ORT_DYLIB_PATH is unset and the System32 DLL was picked up. Point it at the downloaded release |
libclang not found while compiling trtx-sys |
Install LLVM and set LIBCLANG_PATH |
| Results look stale after a converter change | Delete the engine caches %LOCALAPPDATA%\rustnn\trtx and %LOCALAPPDATA%\rustnn\trtx-jit |
Access is denied from cargo fmt or the linker |
A test binary is still running; wait for it to finish |
| Path too long errors during clone or build | git config --system core.longpaths true, or clone to a short path such as C:\git |
Without a GPU¶
cargo check -F trtx-runtime --all-targets compiles the backend and is what CI runs. The
trtx-runtime-mock feature builds the converter against the mock trtx API for API-level
checks; the execution tests are excluded in mock mode.