Unverified Commit 67fe12a1 authored by Connor Baker's avatar Connor Baker Committed by GitHub
Browse files

cudaPackages: fixup expressions for libcudla and tensorrt-samples's testers (#480474)

parents a1965bd0 37f7291c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
  flags,
  lib,
  libcublas,
  libcudla,
  libcufft,
  libcurand,
  libcusolver,
@@ -197,6 +198,7 @@ backendStdenv.mkDerivation (finalAttrs: {
    libnvjitlink
    libnvjpeg
  ]
  ++ lib.optionals libcudla.meta.available [ libcudla ]
  ++ lib.optionals (cudaAtLeast "13") [ cuda_culibos ];

  cmakeFlags = [
+3 −8
Original line number Diff line number Diff line
{
  backendStdenv,
  buildRedist,
  cudaMajorMinorVersion,
  cudaOlder,
  lib,
}:
buildRedist {
@@ -19,7 +19,7 @@ buildRedist {
  autoPatchelfIgnoreMissingDeps = [
    "libnvcudla.so"
  ]
  ++ lib.optionals (cudaMajorMinorVersion == "11.8") [
  ++ lib.optionals (cudaOlder "12") [
    "libcuda.so.1"
    "libnvdla_runtime.so"
  ];
@@ -27,12 +27,7 @@ buildRedist {
  platformAssertions = [
    {
      message = "Only Xavier (7.2) and Orin (8.7) Jetson devices are supported";
      assertion =
        let
          inherit (backendStdenv) hasJetsonCudaCapability requestedJetsonCudaCapabilities;
        in
        hasJetsonCudaCapability
        -> (lib.subtractLists [ "7.2" "8.7" ] requestedJetsonCudaCapabilities == [ ]);
      assertion = lib.subtractLists [ "7.2" "8.7" ] backendStdenv.cudaCapabilities == [ ];
    }
  ];
}
+30 −30
Original line number Diff line number Diff line
@@ -30,12 +30,6 @@ in
        }
    );

  # TODO(@connorbaker): A number of the tests fail with 10.2:
  # API Usage Error (Unable to load library: libnvinfer_builder_resource_win.so.10.2.0:
  # libnvinfer_builder_resource_win.so.10.2.0: cannot open shared object file: No such file or directory)
  # TODO(@connorbaker): Add tests for trtexec.
  testers =
    let
  mkTester =
    name: cmdArgs:
    writeShellApplication {
@@ -47,23 +41,29 @@ in
        "''${cmdArgs[@]}"
      '';
    };
    in
    lib.packagesFromDirectoryRecursive {
      callPackage =
        path: _:
        import path {
          inherit (finalAttrs.passthru) sample-data;

  # TODO(@connorbaker): Add tests for trtexec.
  testers =
    let
      mkTesters = lib.flip import {
        inherit (finalAttrs.passthru) mkTester sample-data;
        inherit
          atLeast
          backendStdenv
          finalAttrs
          lib
            mkTester
          older
          ;
      };
    in
    # Filter out sets of testers which are completely empty (not available on this architecture, this version, etc.).
    lib.filterAttrs (_: attrs: attrs != { }) (
      # Construct all the testers from the filesystem.
      lib.packagesFromDirectoryRecursive {
        callPackage = path: _: mkTesters path;
        directory = ./testers;
    };
      }
    );

  # Wrap each of the derivations in testers in a runCommand.
  tests = lib.mapAttrsRecursiveCond (as: !(lib.isDerivation as)) (
+5 −3
Original line number Diff line number Diff line
{
  atLeast,
  backendStdenv,
  lib,
  mkTester,
@@ -26,15 +27,16 @@ lib.optionalAttrs (older "10.8") (
      "--datadir=${sample-data.outPath + "/mnist"}"
      "--fp16"
    ];

  }
  // lib.optionalAttrs (atLeast "10") {
    bf16 = mkTester "sample_algorithm_selector-bf16" [
      "sample_algorithm_selector"
      "--datadir=${sample-data.outPath + "/mnist"}"
      "--bf16"
    ];
  }
  # Only Orin has a DLA
  // lib.optionalAttrs (lib.elem "8.7" backendStdenv.cudaCapabilities) {
  # Only Xavier and Orin have a DLA
  // lib.optionalAttrs (lib.subtractLists [ "7.2" "8.7" ] backendStdenv.cudaCapabilities == [ ]) {
    dla = mkTester "sample_algorithm_selector-dla" [
      "sample_algorithm_selector"
      "--datadir=${sample-data.outPath + "/mnist"}"
+4 −1
Original line number Diff line number Diff line
{
  atLeast,
  lib,
  mkTester,
  sample-data,
  ...
@@ -21,7 +23,8 @@
    "--datadir=${sample-data.outPath + "/mnist"}"
    "--fp16"
  ];

}
// lib.optionalAttrs (atLeast "10") {
  bf16 = mkTester "sample_dynamic_reshape-bf16" [
    "sample_dynamic_reshape"
    "--datadir=${sample-data.outPath + "/mnist"}"
Loading