cudaPackages.tensorrt: 10.9.0 -> 10.14.1 (for non-Jetson and Thor) (#464947)

This commit is contained in:
Connor Baker
2025-11-25 15:53:24 +00:00
committed by GitHub
7 changed files with 163 additions and 70 deletions
+11
View File
@@ -61,6 +61,17 @@ stdenv'.mkDerivation rec {
makeWrapper
];
# Included from release 1.16.2:
# https://github.com/lightvector/KataGo/commit/9030f72d152da42c1dd03590aa5116993ea842f6
# Doesn't apply cleanly as a patch so doing a quick replacement to the same effect.
prePatch = lib.optionalString (backend == "tensorrt") ''
nixLog "patching $PWD/cpp/CMakeLists.txt to work around outdated TensorRT version detection"
substituteInPlace "$PWD/cpp/CMakeLists.txt" \
--replace-fail \
'if(TENSORRT_VERSION VERSION_LESS 8.5)' \
'if(NOT TENSORRT_VERSION STREQUAL ".." AND TENSORRT_VERSION VERSION_LESS 8.5)'
'';
buildInputs = [
libzip
boost
@@ -0,0 +1,36 @@
{
"release_date": "2025-11-04",
"release_label": "10.14.1",
"release_product": "tensorrt",
"tensorrt": {
"name": "NVIDIA TensorRT",
"license": "TensorRT",
"version": "10.14.1.48",
"cuda_variant": [
"12",
"13"
],
"linux-sbsa": {
"cuda13": {
"md5": "f31d534daa41f517c8c5db8e0478119f",
"relative_path": "tensorrt/10.14.1/tars/TensorRT-10.14.1.48.Linux.aarch64-gnu.cuda-13.0.tar.gz",
"sha256": "3d3e438b49196a9b9ed5c5bc37ec24be9aa74d67d41db0f8fa54b4894aad748a",
"size": "5554126761"
}
},
"linux-x86_64": {
"cuda12": {
"md5": "d21dd1cb62518f81173150f7bda77311",
"relative_path": "tensorrt/10.14.1/tars/TensorRT-10.14.1.48.Linux.x86_64-gnu.cuda-12.9.tar.gz",
"sha256": "0daa7d5929c78edfbe86b474064d0f82d2064c475cc6be747c5101f1ccc37105",
"size": "7905642926"
},
"cuda13": {
"md5": "8ef547b7811197572294494551478214",
"relative_path": "tensorrt/10.14.1/tars/TensorRT-10.14.1.48.Linux.x86_64-gnu.cuda-13.0.tar.gz",
"sha256": "c74af67db57f1a0d7e66bb01ab93f1ecda5facac491ca76e680d832f1e035ce6",
"size": "7004299092"
}
}
}
}
@@ -7,6 +7,7 @@
"license": "TensorRT",
"version": "10.7.0.23",
"cuda_variant": [
"11",
"12"
],
"linux-aarch64": {
@@ -26,6 +27,12 @@
}
},
"linux-x86_64": {
"cuda11": {
"md5": "6adf7d02aae9105abb6bf3b4c1ce89f4",
"relative_path": "tensorrt/10.7.0/tars/TensorRT-10.7.0.23.Linux.x86_64-gnu.cuda-11.8.tar.gz",
"sha256": "958e1c32b48e41d1c48bdc94363450e14f996ca9de0e205ccee65af319eea2c0",
"size": "4341092411"
},
"cuda12": {
"md5": "925c98fbe9abe82058814159727732a2",
"relative_path": "tensorrt/10.7.0/tars/TensorRT-10.7.0.23.Linux.x86_64-gnu.cuda-12.6.tar.gz",
@@ -1,29 +0,0 @@
{
"release_date": "2025-03-11",
"release_label": "10.9.0",
"release_product": "tensorrt",
"tensorrt": {
"name": "NVIDIA TensorRT",
"license": "TensorRT",
"version": "10.9.0.34",
"cuda_variant": [
"12"
],
"linux-sbsa": {
"cuda12": {
"md5": "e56a9f9d7327c65d9b95996d3008ed44",
"relative_path": "tensorrt/10.9.0/tars/TensorRT-10.9.0.34.Linux.aarch64-gnu.cuda-12.8.tar.gz",
"sha256": "b81ec2a067f67f082c13caec2dcef54385b42a9de6a4ecae6f318aa2d41964f2",
"size": "4123115318"
}
},
"linux-x86_64": {
"cuda12": {
"md5": "ee49e3e6e00b21274907956216b6769f",
"relative_path": "tensorrt/10.9.0/tars/TensorRT-10.9.0.34.Linux.x86_64-gnu.cuda-12.8.tar.gz",
"sha256": "33be0e61e3bf177bbbcabb4892bf013f0c8ac71d2be73f2803848a382cb14272",
"size": "6917032417"
}
}
}
}
@@ -3,24 +3,33 @@
backendStdenv,
buildRedist,
cuda_cudart,
cudnn,
cuda_nvrtc,
cudaAtLeast,
cudaMajorMinorVersion,
lib,
libcudla, # only for Jetson
patchelf,
}:
let
inherit (_cuda.lib) majorMinorPatch;
inherit (backendStdenv) hasJetsonCudaCapability;
inherit (lib.attrsets) getLib;
inherit (backendStdenv) cudaCapabilities hostRedistSystem;
inherit (lib.lists) optionals;
inherit (lib.strings) concatStringsSep;
in
buildRedist (
finalAttrs:
let
majorMinorPatchVersion = majorMinorPatch finalAttrs.version;
majorVersion = lib.versions.major finalAttrs.version;
tensorrtAtLeast = lib.versionAtLeast finalAttrs.version;
tensorrtOlder = lib.versionOlder finalAttrs.version;
# Create variables and use logical OR to allow short-circuiting.
tensorrtAtLeast105 = tensorrtAtLeast "10.5.0";
tensorrtAtLeast100 = tensorrtAtLeast105 || tensorrtAtLeast "10.0.0";
allCCNewerThan75 = lib.all (lib.flip lib.versionAtLeast "7.5") cudaCapabilities;
allCCNewerThan70 = allCCNewerThan75 || lib.all (lib.flip lib.versionAtLeast "7.0") cudaCapabilities;
cudaCapabilitiesJSON = builtins.toJSON cudaCapabilities;
in
{
redistName = "tensorrt";
@@ -32,7 +41,12 @@ buildRedist (
"dev"
"include"
"lib"
]
# From 10.14.1, TensorRT samples are distributed through the TensorRT GitHub repository.
++ optionals (tensorrtOlder "10.14.1") [
"samples"
]
++ [
"static"
# "stubs" removed in postInstall
];
@@ -42,8 +56,6 @@ buildRedist (
nativeBuildInputs = [ patchelf ];
buildInputs = [
(getLib cudnn)
(getLib cuda_nvrtc)
cuda_cudart
]
++ optionals libcudla.meta.available [ libcudla ];
@@ -62,38 +74,44 @@ buildRedist (
''
for dir in bin lib; do
[[ -L "$dir" ]] || continue
nixLog "replacing symlink $NIX_BUILD_TOP/$sourceRoot/$dir with $NIX_BUILD_TOP/$sourceRoot/targets/${targetString}/$dir"
rm --verbose "$NIX_BUILD_TOP/$sourceRoot/$dir"
mv --verbose --no-clobber "$NIX_BUILD_TOP/$sourceRoot/targets/${targetString}/$dir" "$NIX_BUILD_TOP/$sourceRoot/$dir"
nixLog "replacing symlink $PWD/$dir with $PWD/targets/${targetString}/$dir"
rm --verbose "$PWD/$dir"
mv --verbose --no-clobber "$PWD/targets/${targetString}/$dir" "$PWD/$dir"
done
unset -v dir
''
# Remove symlinks if they exist
+ ''
for dir in include samples; do
if [[ -L "$NIX_BUILD_TOP/$sourceRoot/targets/${targetString}/$dir" ]]; then
nixLog "removing symlink $NIX_BUILD_TOP/$sourceRoot/targets/${targetString}/$dir"
rm --verbose "$NIX_BUILD_TOP/$sourceRoot/targets/${targetString}/$dir"
if [[ -L "$PWD/targets/${targetString}/$dir" ]]; then
nixLog "removing symlink $PWD/targets/${targetString}/$dir"
rm --verbose "$PWD/targets/${targetString}/$dir"
fi
done
unset -v dir
if [[ -d "$NIX_BUILD_TOP/$sourceRoot/targets" ]]; then
if [[ -d "$PWD/targets" ]]; then
nixLog "removing targets directory"
rm --recursive --verbose "$NIX_BUILD_TOP/$sourceRoot/targets" || {
nixErrorLog "could not delete $NIX_BUILD_TOP/$sourceRoot/targets: $(ls -laR "$NIX_BUILD_TOP/$sourceRoot/targets")"
rm --recursive --verbose "$PWD/targets" || {
nixErrorLog "could not delete $PWD/targets: $(ls -laR "$PWD/targets")"
exit 1
}
fi
'';
autoPatchelfIgnoreMissingDeps = optionals hasJetsonCudaCapability [
"libnvdla_compiler.so"
];
autoPatchelfIgnoreMissingDeps =
optionals (hostRedistSystem == "linux-aarch64") [
"libnvdla_compiler.so"
]
++ optionals (tensorrtAtLeast "10.13.3") [
"libcuda.so.1"
];
# Create a symlink for the Onnx header files in include/onnx
# NOTE(@connorbaker): This is shared with the tensorrt-oss package, with the `out` output swapped with `include`.
# When updating one, check if the other should be updated.
# TODO(@connorbaker): It seems like recent versions of TensorRT have separate libs for separate capabilities;
# we should remove libraries older than those necessary to support requested capabilities.
postInstall = ''
mkdir "''${!outputInclude:?}/include/onnx"
pushd "''${!outputInclude:?}/include" >/dev/null
@@ -102,6 +120,7 @@ buildRedist (
popd >/dev/null
''
# Move the python directory, which contains header files, to the include output.
# NOTE: Python wheels should be built from source using the TensorRT GitHub repo.
+ ''
nixLog "moving python directory to include output"
moveToOutput python "''${!outputInclude:?}"
@@ -115,10 +134,11 @@ buildRedist (
''
# Remove the Windows library used for cross-compilation if it exists.
+ ''
if [[ -e "''${!outputLib:?}/lib/libnvinfer_builder_resource_win.so.${majorMinorPatchVersion}" ]]; then
nixLog "removing Windows library"
rm --verbose "''${!outputLib:?}/lib/libnvinfer_builder_resource_win.so.${majorMinorPatchVersion}"
fi
nixLog "removing any Windows libraries"
for winLib in "''${!outputLib:?}/lib/"*_win*; do
rm --verbose "$winLib"
done
unset -v winLib
''
# Remove the stub libraries.
+ ''
@@ -137,10 +157,35 @@ buildRedist (
--add-needed libnvinfer_plugin.so.${majorVersion}
'';
passthru = {
# The CUDNN used with TensorRT.
inherit cudnn;
};
# NOTE: Like cuDNN, NVIDIA offers forward compatibility within a major releases of CUDA.
platformAssertions = [
{
message =
"tensorrt releases since 10.0.0 (found ${finalAttrs.version})"
+ " support CUDA compute capabilities 7.0 and newer (found ${cudaCapabilitiesJSON})";
assertion = tensorrtAtLeast100 -> allCCNewerThan70;
}
{
message =
"tensorrt releases since 10.0.0 (found ${finalAttrs.version})"
+ " support only CUDA compute capability 8.7 (Jetson Orin) for pre-Thor Jetson devices"
+ " (found ${cudaCapabilitiesJSON})";
assertion =
tensorrtAtLeast100 && hostRedistSystem == "linux-aarch64" -> cudaCapabilities == [ "8.7" ];
}
{
message =
"tensorrt releases since 10.0.0 (found ${finalAttrs.version})"
+ " support CUDA 12.4 and newer for pre-Thor Jetson devices (found ${cudaMajorMinorVersion})";
assertion = tensorrtAtLeast100 && hostRedistSystem == "linux-aarch64" -> cudaAtLeast "12.4";
}
{
message =
"tensorrt releases since 10.5.0 (found ${finalAttrs.version})"
+ " support CUDA compute capabilities 7.5 and newer (found ${cudaCapabilitiesJSON})";
assertion = tensorrtAtLeast105 -> allCCNewerThan75;
}
];
meta = {
description = "SDK that facilitates high-performance machine learning inference";
@@ -7,12 +7,21 @@
stdenv,
}:
let
inherit (cudaPackages.tensorrt) src pname version;
inherit (cudaPackages.tensorrt)
meta
pname
src
version
;
inherit (lib.versions) major minor;
inherit (stdenv.hostPlatform) parsed;
in
buildPythonPackage {
inherit pname version;
# Make sure to add the cudaNamePrefix tag since we're not using cudaPackages.buildRedist but this is a
# redistributable.
pname = "${cudaPackages.cudaNamePrefix}-${pname}";
inherit version;
src =
let
@@ -31,17 +40,27 @@ buildPythonPackage {
];
buildInputs = [
cudaPackages.cudnn
cudaPackages.tensorrt
];
pythonImportsCheck = [ "tensorrt" ];
meta = with lib; {
meta = {
description = "Python bindings for TensorRT, a high-performance deep learning interface";
homepage = "https://developer.nvidia.com/tensorrt";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
broken = !(cudaPackages ? tensorrt) || !(cudaPackages ? cudnn);
# Explicitly inherit from TensorRT's meta to avoid pulling in attributes added by stdenv.mkDerivation.
inherit (meta)
badPlatforms
broken
changelog
downloadPage
homepage
license
longDescription
maintainers
platforms
sourceProvenance
teams
;
};
}
+9 -5
View File
@@ -29,7 +29,7 @@ let
nvjpeg2000 = "0.9.0";
nvpl = "25.5";
nvtiff = "0.5.1";
tensorrt = if hasJetsonCudaCapability then "10.7.0" else "10.9.0";
tensorrt = if hasJetsonCudaCapability then "10.7.0" else "10.14.1";
};
cudaPackages_12_8 =
@@ -50,7 +50,7 @@ let
nvjpeg2000 = "0.9.0";
nvpl = "25.5";
nvtiff = "0.5.1";
tensorrt = if hasJetsonCudaCapability then "10.7.0" else "10.9.0";
tensorrt = if hasJetsonCudaCapability then "10.7.0" else "10.14.1";
};
cudaPackages_12_9 =
@@ -71,12 +71,15 @@ let
nvjpeg2000 = "0.9.0";
nvpl = "25.5";
nvtiff = "0.5.1";
tensorrt = if hasJetsonCudaCapability then "10.7.0" else "10.9.0";
tensorrt = if hasJetsonCudaCapability then "10.7.0" else "10.14.1";
};
# NOTE: Thor is supported from CUDA 13.0, so our check needs to capture whether pre-Thor devices were selected.
hasPreThorJetsonCudaCapability = lib.any (lib.flip lib.versionOlder "10.1");
cudaPackages_13_0 =
let
inherit (cudaPackages_13_0.backendStdenv) hasJetsonCudaCapability;
inherit (cudaPackages_13_0.backendStdenv) requestedJetsonCudaCapabilities;
in
mkCudaPackages {
cublasmp = "0.6.0";
@@ -92,7 +95,8 @@ let
nvjpeg2000 = "0.9.0";
nvpl = "25.5";
nvtiff = "0.5.1";
tensorrt = if hasJetsonCudaCapability then "10.7.0" else "10.9.0";
tensorrt =
if hasPreThorJetsonCudaCapability requestedJetsonCudaCapabilities then "10.7.0" else "10.14.1";
};
in
{