diff options
Diffstat (limited to 'pkgs/development/libraries/onnxruntime/default.nix')
-rw-r--r-- | pkgs/development/libraries/onnxruntime/default.nix | 75 |
1 files changed, 47 insertions, 28 deletions
diff --git a/pkgs/development/libraries/onnxruntime/default.nix b/pkgs/development/libraries/onnxruntime/default.nix index 1a62114148f75..bb344664e6593 100644 --- a/pkgs/development/libraries/onnxruntime/default.nix +++ b/pkgs/development/libraries/onnxruntime/default.nix @@ -3,9 +3,13 @@ , lib , fetchFromGitHub , Foundation -, abseil-cpp +, abseil-cpp_202401 , cmake +, cpuinfo , eigen +, flatbuffers_23 +, gbenchmark +, glibcLocales , gtest , libpng , nlohmann_json @@ -24,7 +28,9 @@ let - version = "1.16.3"; + version = "1.18.1"; + + abseil-cpp = abseil-cpp_202401; stdenv = throw "Use effectiveStdenv instead"; effectiveStdenv = if cudaSupport then cudaPackages.backendStdenv else inputs.stdenv; @@ -34,15 +40,15 @@ let howard-hinnant-date = fetchFromGitHub { owner = "HowardHinnant"; repo = "date"; - rev = "v2.4.1"; - sha256 = "sha256-BYL7wxsYRI45l8C3VwxYIIocn5TzJnBtU0UZ9pHwwZw="; + rev = "v3.0.1"; + sha256 = "sha256-ZSjeJKAcT7mPym/4ViDvIR9nFMQEBCSUtPEuMO27Z+I="; }; mp11 = fetchFromGitHub { owner = "boostorg"; repo = "mp11"; - rev = "boost-1.79.0"; - hash = "sha256-ZxgPDLvpISrjpEHKpLGBowRKGfSwTf6TBfJD18yw+LM="; + rev = "boost-1.82.0"; + hash = "sha256-cLPvjkf2Au+B19PJNrUkTW/VPxybi1MpPxnIl4oo4/o="; }; safeint = fetchFromGitHub { @@ -52,34 +58,34 @@ let hash = "sha256-PK1ce4C0uCR4TzLFg+elZdSk5DdPCRhhwT3LvEwWnPU="; }; - pytorch_cpuinfo = fetchFromGitHub { - owner = "pytorch"; - repo = "cpuinfo"; - # There are no tags in the repository - rev = "5916273f79a21551890fd3d56fc5375a78d1598d"; - hash = "sha256-nXBnloVTuB+AVX59VDU/Wc+Dsx94o92YQuHp3jowx2A="; - }; + pytorch_clog = effectiveStdenv.mkDerivation { + pname = "clog"; + version = "3c8b153"; + src = "${cpuinfo.src}/deps/clog"; - flatbuffers = fetchFromGitHub { - owner = "google"; - repo = "flatbuffers"; - rev = "v1.12.0"; - hash = "sha256-L1B5Y/c897Jg9fGwT2J3+vaXsZ+lfXnskp8Gto1p/Tg="; + nativeBuildInputs = [ cmake gbenchmark gtest ]; + cmakeFlags = [ + "-DUSE_SYSTEM_GOOGLEBENCHMARK=ON" + "-DUSE_SYSTEM_GOOGLETEST=ON" + "-DUSE_SYSTEM_LIBS=ON" + # 'clog' tests set 'CXX_STANDARD 11'; this conflicts with our 'gtest'. + "-DCLOG_BUILD_TESTS=OFF" + ]; }; onnx = fetchFromGitHub { owner = "onnx"; repo = "onnx"; - rev = "refs/tags/v1.14.1"; - hash = "sha256-ZVSdk6LeAiZpQrrzLxphMbc1b3rNUMpcxcXPP8s/5tE="; + rev = "refs/tags/v1.16.1"; + hash = "sha256-I1wwfn91hdH3jORIKny0Xc73qW2P04MjkVCgcaNnQUE="; }; cutlass = fetchFromGitHub { owner = "NVIDIA"; repo = "cutlass"; - rev = "v3.0.0"; - sha256 = "sha256-YPD5Sy6SvByjIcGtgeGH80TEKg2BtqJWSg46RvnJChY="; - }; + rev = "v3.1.0"; + hash = "sha256-mpaiCxiYR1WaSSkcEPTzvcREenJWklD+HRdTT5/pD54="; + }; in effectiveStdenv.mkDerivation rec { pname = "onnxruntime"; @@ -89,7 +95,7 @@ effectiveStdenv.mkDerivation rec { owner = "microsoft"; repo = "onnxruntime"; rev = "refs/tags/v${version}"; - hash = "sha256-bTW9Pc3rvH+c8VIlDDEtAXyA3sajVyY5Aqr6+SxaMF4="; + hash = "sha256-+zWtbLKekGhwdBU3bm1u2F7rYejQ62epE+HcHj05/8A="; fetchSubmodules = true; }; @@ -102,6 +108,13 @@ effectiveStdenv.mkDerivation rec { # - use MakeAvailable instead of the low-level Populate, # - use Eigen3::Eigen as the target name (as declared by libeigen/eigen). ./0001-eigen-allow-dependency-injection.patch + # Incorporate a patch that has landed upstream which exposes new + # 'abseil-cpp' libraries & modifies the 're2' CMakeLists to fix a + # configuration error that around missing 'gmock' exports. + # + # TODO: Check if it can be dropped after 1.19.0 + # https://github.com/microsoft/onnxruntime/commit/b522df0ae477e59f60acbe6c92c8a64eda96cace + ./update-re2.patch ] ++ lib.optionals cudaSupport [ # We apply the referenced 1064.patch ourselves to our nix dependency. # FIND_PACKAGE_ARGS for CUDA was added in https://github.com/microsoft/onnxruntime/commit/87744e5 so it might be possible to delete this patch after upgrading to 1.17.0 @@ -124,11 +137,14 @@ effectiveStdenv.mkDerivation rec { ]; buildInputs = [ + cpuinfo eigen + glibcLocales libpng - zlib nlohmann_json microsoft-gsl + pytorch_clog + zlib ] ++ lib.optionals pythonSupport (with python3Packages; [ numpy pybind11 @@ -144,6 +160,7 @@ effectiveStdenv.mkDerivation rec { libcufft # cufft.h cudnn # cudnn.h cuda_cudart + nccl ]); nativeCheckInputs = [ @@ -168,11 +185,11 @@ effectiveStdenv.mkDerivation rec { "-DFETCHCONTENT_QUIET=OFF" "-DFETCHCONTENT_SOURCE_DIR_ABSEIL_CPP=${abseil-cpp.src}" "-DFETCHCONTENT_SOURCE_DIR_DATE=${howard-hinnant-date}" - "-DFETCHCONTENT_SOURCE_DIR_FLATBUFFERS=${flatbuffers}" + "-DFETCHCONTENT_SOURCE_DIR_FLATBUFFERS=${flatbuffers_23.src}" + "-DFETCHCONTENT_SOURCE_DIR_GOOGLETEST=${gtest.src}" "-DFETCHCONTENT_SOURCE_DIR_GOOGLE_NSYNC=${nsync.src}" "-DFETCHCONTENT_SOURCE_DIR_MP11=${mp11}" "-DFETCHCONTENT_SOURCE_DIR_ONNX=${onnx}" - "-DFETCHCONTENT_SOURCE_DIR_PYTORCH_CPUINFO=${pytorch_cpuinfo}" "-DFETCHCONTENT_SOURCE_DIR_RE2=${re2.src}" "-DFETCHCONTENT_SOURCE_DIR_SAFEINT=${safeint}" "-DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS" @@ -194,11 +211,13 @@ effectiveStdenv.mkDerivation rec { env = lib.optionalAttrs effectiveStdenv.cc.isClang { NIX_CFLAGS_COMPILE = toString [ "-Wno-error=deprecated-declarations" + "-Wno-error=deprecated-pragma" "-Wno-error=unused-but-set-variable" ]; }; - doCheck = !cudaSupport; + # aarch64-linux fails cpuinfo test, because /sys/devices/system/cpu/ does not exist in the sandbox + doCheck = !(cudaSupport || effectiveStdenv.buildPlatform.system == "aarch64-linux"); requiredSystemFeatures = lib.optionals cudaSupport [ "big-parallel" ]; |