Commit ad6aeedf authored by David Guibert's avatar David Guibert
Browse files

tensorrt: fix false fallback to tensorRTDefaultVersion

Throw an error if the default version of tensorrt does not support the
cuda version.

Adding cudatoolkit 11.8 fails to evaluate
tensorrt.{tensorRTDefaultVersion} as "11.8" is not listed on any
supportedCudaVersions of any tensorRTVersions attributes.
parent 8a63fb02
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ final: prev: let
    # Add all supported builds as attributes
    allBuilds = mapAttrs' (version: file: nameValuePair (computeName version) (buildTensorRTPackage (removeAttrs file ["fileVersionCuda"]))) supportedVersions;
    # Set the default attributes, e.g. tensorrt = tensorrt_8_4;
    defaultBuild = { "tensorrt" = allBuilds.${computeName tensorRTDefaultVersion}; };
    defaultBuild = { "tensorrt" = if allBuilds ? ${computeName tensorRTDefaultVersion}
      then allBuilds.${computeName tensorRTDefaultVersion}
      else throw "tensorrt-${tensorRTDefaultVersion} does not support your cuda version ${cudaVersion}"; };
  in allBuilds // defaultBuild;

  tensorRTVersions = {