Loading pkgs/by-name/on/onnxruntime/cpuinfo-logging.patchdeleted 100644 → 0 +0 −45 Original line number Diff line number Diff line diff --git a/onnxruntime/core/common/cpuid_info.cc b/onnxruntime/core/common/cpuid_info.cc --- a/onnxruntime/core/common/cpuid_info.cc +++ b/onnxruntime/core/common/cpuid_info.cc @@ -3,6 +3,7 @@ #include "core/common/cpuid_info.h" #include "core/common/logging/logging.h" #include "core/common/logging/severity.h" +#include <iostream> #ifdef __linux__ @@ -364,8 +365,14 @@ #if defined(CPUINFO_SUPPORTED) pytorch_cpuinfo_init_ = cpuinfo_initialize(); if (!pytorch_cpuinfo_init_) { - LOGS_DEFAULT(WARNING) << "Failed to initialize PyTorch cpuinfo library. May cause CPU EP performance degradation " - "due to undetected CPU features."; + constexpr const char* message = + "Failed to initialize PyTorch cpuinfo library. May cause CPU EP performance degradation due to undetected CPU " + "features."; + if (logging::LoggingManager::HasDefaultLogger()) { + LOGS_DEFAULT(WARNING) << message; + } else { + std::cerr << "onnxruntime cpuid_info warning: " << message << std::endl; + } } #endif // defined(CPUINFO_SUPPORTED) #if defined(__linux__) diff --git a/onnxruntime/core/platform/posix/env.cc b/onnxruntime/core/platform/posix/env.cc --- a/onnxruntime/core/platform/posix/env.cc +++ b/onnxruntime/core/platform/posix/env.cc @@ -605,7 +605,12 @@ PosixEnv() { cpuinfo_available_ = cpuinfo_initialize(); if (!cpuinfo_available_) { - LOGS_DEFAULT(INFO) << "cpuinfo_initialize failed"; + constexpr const char* message = "cpuinfo_initialize failed"; + if (logging::LoggingManager::HasDefaultLogger()) { + LOGS_DEFAULT(INFO) << message; + } else { + std::cerr << "onnxruntime cpuid_info warning: " << message << std::endl; + } } } bool cpuinfo_available_{false}; pkgs/by-name/on/onnxruntime/package.nix +107 −59 Original line number Diff line number Diff line { lib, config, stdenv, lib, fetchFromGitHub, applyPatches, fetchpatch, abseil-cpp_202407, cmake, Loading @@ -14,7 +15,6 @@ howard-hinnant-date, libpng, nlohmann_json, perl, pkg-config, python3Packages, removeReferencesTo, Loading @@ -33,51 +33,91 @@ }@inputs: let version = "1.22.2"; src = fetchFromGitHub { owner = "microsoft"; repo = "onnxruntime"; tag = "v${version}"; fetchSubmodules = true; hash = "sha256-X8Pdtc0eR0iU+Xi2A1HrNo1xqCnoaxNjj4QFm/E3kSE="; }; stdenv = throw "Use effectiveStdenv instead"; effectiveStdenv = if cudaSupport then cudaPackages.backendStdenv else inputs.stdenv; inherit (cudaPackages) cuda_nvcc; cudaArchitecturesString = cudaPackages.flags.cmakeCudaArchitecturesString; mp11 = fetchFromGitHub { # While onnxruntime suggests using (3 year-old) protobuf 21.12 # https://github.com/microsoft/onnxruntime/blob/v1.23.2/cmake/deps.txt#L40, using a newer # protobuf version is possible. # We still need to patch the nixpkgs protobuf (32.1) to address the following test failure that # occurs when cudaSupport is enabled: # [libprotobuf ERROR /build/source/src/google/protobuf/descriptor_database.cc:642] File already exists in database: onnx/onnx-ml.proto # [libprotobuf FATAL /build/source/src/google/protobuf/descriptor.cc:1986] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): # terminate called after throwing an instance of 'google::protobuf::FatalException' # what(): CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): # # # Caused by: https://github.com/protocolbuffers/protobuf/commit/8f7aab29b21afb89ea0d6e2efeafd17ca71486a9 # Reported upstream: https://github.com/protocolbuffers/protobuf/issues/21542 protobuf' = protobuf.overrideAttrs (old: { patches = (old.patches or [ ]) ++ [ (fetchpatch { name = "Workaround nvcc bug in message_lite.h"; url = "https://raw.githubusercontent.com/conda-forge/protobuf-feedstock/737a13ea0680484c08e8e0ab0144dab82c10c1b3/recipe/patches/0010-Workaround-nvcc-bug-in-message_lite.h.patch"; hash = "sha256-joK50Il4mrwIc6zuNW9gDIfOx9LuA4FlusJuzUf9kqI="; }) ]; }); # TODO: update the following dependencies according to: # https://github.com/microsoft/onnxruntime/blob/v<VERSION>/cmake/deps.txt mp11-src = fetchFromGitHub { name = "mp11-src"; owner = "boostorg"; repo = "mp11"; tag = "boost-1.82.0"; hash = "sha256-cLPvjkf2Au+B19PJNrUkTW/VPxybi1MpPxnIl4oo4/o="; }; safeint = fetchFromGitHub { safeint-src = fetchFromGitHub { name = "safeint-src"; owner = "dcleblanc"; repo = "safeint"; tag = "3.0.28"; hash = "sha256-pjwjrqq6dfiVsXIhbBtbolhiysiFlFTnx5XcX77f+C0="; }; onnx = fetchFromGitHub { onnx-src = applyPatches { name = "onnx-src"; src = fetchFromGitHub { owner = "onnx"; repo = "onnx"; tag = "v1.17.0"; hash = "sha256-9oORW0YlQ6SphqfbjcYb0dTlHc+1gzy9quH/Lj6By8Q="; tag = "v1.18.0"; hash = "sha256-UhtF+CWuyv5/Pq/5agLL4Y95YNP63W2BraprhRqJOag="; }; patches = [ # Fix "error: conversion from 'onnx::OpSchema' to non-scalar type 'onnx::OpSchemaRegistry::OpSchemaRegisterOnce'" # https://github.com/microsoft/onnxruntime/issues/26229 # Fix from https://github.com/onnx/onnx/pull/7390 (fetchpatch { url = "https://github.com/onnx/onnx/commit/595a069aaac07586f111681245bc808ee63551f8.patch"; includes = [ "onnx/defs/schema.h" ]; hash = "sha256-FFAJuJse4nmNT3ixvEdlqzbr3edY46SqEFv7z/oo6m0="; }) # Fix "undefined reference to `onnx::RNNShapeInference(onnx::InferenceContext&)'" (fetchpatch { url = "https://github.com/onnx/onnx/commit/6769c41ad64ebca0358da8c7211d2c6d0e627b2b.patch"; hash = "sha256-VlTHs0om20kTNvSVQaasSsa5JROliQy4k9BECTsBtbU="; }) ]; }; cutlass = fetchFromGitHub { cutlass-src = fetchFromGitHub { name = "cutlass-src"; owner = "NVIDIA"; repo = "cutlass"; tag = "v3.5.1"; hash = "sha256-sTGYN+bjtEqQ7Ootr/wvx3P9f8MCDSSj3qyCWjfdLEA="; tag = "v3.9.2"; hash = "sha256-teziPNA9csYvhkG5t2ht8W8x5+1YGGbHm8VKx4JoxgI="; }; dlpack = fetchFromGitHub { dlpack-src = fetchFromGitHub { name = "dlpack-src"; owner = "dmlc"; repo = "dlpack"; rev = "5c210da409e7f1e51ddf445134a4376fdbd70d7d"; Loading @@ -86,30 +126,38 @@ let isCudaJetson = cudaSupport && cudaPackages.flags.isJetsonBuild; in effectiveStdenv.mkDerivation rec { effectiveStdenv.mkDerivation (finalAttrs: { pname = "onnxruntime"; inherit src version; version = "1.23.2"; src = fetchFromGitHub { owner = "microsoft"; repo = "onnxruntime"; tag = "v${finalAttrs.version}"; fetchSubmodules = true; hash = "sha256-hZ2L5+0Enkw4rGDKVpRECnKXP87w6Kbiyp6Fdxwt6hk="; }; patches = [ # https://github.com/microsoft/onnxruntime/pull/24583 # Missing cstdint include (GCC 15 compatibility) (fetchpatch { url = "https://github.com/microsoft/onnxruntime/commit/d6e712c5b7b6260a61e54d1fe40107cf5366ee77.patch"; hash = "sha256-FSuPybX8f2VoxvLhcYx4rdChaiK8bSUDR32sN3Efwfc="; }) # Correct maybe-uninitialized and range-loop-construct warnings # https://github.com/microsoft/onnxruntime/pull/26201 (fetchpatch { name = "fix-compilation-with-gcc-15.patch"; url = "https://github.com/microsoft/onnxruntime/commit/f7619dc93f592ddfc10f12f7145f9781299163a0.patch"; hash = "sha256-jxfMB+/Zokcu5DSfZP7QV1E8mTrsLe/sMr+ZCX/Y3m0="; url = "https://github.com/microsoft/onnxruntime/commit/8ebd0bf1cf02414584d15d7244b07fa97d65ba02.patch"; hash = "sha256-vX+kaFiNdmqWI91JELcLpoaVIHBb5EPbI7rCAMYAx04="; }) # Handle missing default logger when cpuinfo initialization fails in the build sandbox # TODO: Remove on next release # https://github.com/microsoft/onnxruntime/issues/10038 # https://github.com/microsoft/onnxruntime/pull/15661 # https://github.com/microsoft/onnxruntime/pull/20509 ./cpuinfo-logging.patch ]; nativeBuildInputs = [ cmake pkg-config python3Packages.python protobuf protobuf' ] ++ lib.optionals pythonSupport ( with python3Packages; Loading @@ -127,9 +175,6 @@ effectiveStdenv.mkDerivation rec { ] ++ lib.optionals isCudaJetson [ cudaPackages.autoAddCudaCompatRunpath ] ++ lib.optionals rocmSupport [ perl # for tools/ci_build/hipify-perl ]; buildInputs = [ Loading Loading @@ -169,6 +214,7 @@ effectiveStdenv.mkDerivation rec { ++ lib.optionals rocmSupport [ rocmPackages.clr rocmPackages.hipblas rocmPackages.hipblaslt rocmPackages.hipcub rocmPackages.hipfft rocmPackages.hiprand Loading @@ -178,6 +224,7 @@ effectiveStdenv.mkDerivation rec { rocmPackages.rocrand rocmPackages.rocthrust rocmPackages.miopen rocmPackages.migraphx rocmPackages.rccl rocmPackages.rocm-smi rocmPackages.roctracer Loading @@ -192,9 +239,9 @@ effectiveStdenv.mkDerivation rec { ++ lib.optionals pythonSupport ( with python3Packages; [ onnx pytest sympy onnx ] ); Loading @@ -215,34 +262,30 @@ effectiveStdenv.mkDerivation rec { (lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true) (lib.cmakeBool "FETCHCONTENT_QUIET" false) (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ABSEIL_CPP" "${abseil-cpp_202407.src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_DLPACK" "${dlpack}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_DLPACK" "${dlpack-src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_FLATBUFFERS" "${flatbuffers_23.src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MP11" "${mp11}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ONNX" "${onnx}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MP11" "${mp11-src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ONNX" "${onnx-src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_RE2" "${re2.src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_SAFEINT" "${safeint}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_SAFEINT" "${safeint-src}") (lib.cmakeFeature "FETCHCONTENT_TRY_FIND_PACKAGE_MODE" "ALWAYS") # fails to find protoc on darwin, so specify it (lib.cmakeFeature "ONNX_CUSTOM_PROTOC_EXECUTABLE" (lib.getExe protobuf)) (lib.cmakeFeature "ONNX_CUSTOM_PROTOC_EXECUTABLE" (lib.getExe protobuf')) (lib.cmakeBool "onnxruntime_BUILD_SHARED_LIB" true) (lib.cmakeBool "onnxruntime_BUILD_UNIT_TESTS" doCheck) (lib.cmakeBool "onnxruntime_BUILD_UNIT_TESTS" finalAttrs.doCheck) (lib.cmakeBool "onnxruntime_USE_FULL_PROTOBUF" withFullProtobuf) (lib.cmakeBool "onnxruntime_USE_CUDA" cudaSupport) (lib.cmakeBool "onnxruntime_USE_NCCL" (cudaSupport && ncclSupport)) (lib.cmakeBool "onnxruntime_USE_ROCM" rocmSupport) (lib.cmakeBool "onnxruntime_USE_MIGRAPHX" rocmSupport) (lib.cmakeBool "onnxruntime_ENABLE_LTO" (!cudaSupport || cudaPackages.cudaOlder "12.8")) ] ++ lib.optionals (effectiveStdenv.cc.isClang || rocmSupport) [ # Disable -Werror from COMPILE_WARNING_AS_ERROR target property "--compile-no-warning-as-error" ] ++ lib.optionals pythonSupport [ (lib.cmakeBool "onnxruntime_ENABLE_PYTHON" true) ] ++ lib.optionals cudaSupport [ # Werror and cudnn_frontend deprecations make for a bad time. "--compile-no-warning-as-error" (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_CUTLASS" "${cutlass}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_CUTLASS" "${cutlass-src}") (lib.cmakeFeature "onnxruntime_CUDNN_HOME" "${cudaPackages.cudnn}") (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cudaArchitecturesString) (lib.cmakeFeature "onnxruntime_NVCC_THREADS" "1") Loading Loading @@ -296,8 +339,9 @@ effectiveStdenv.mkDerivation rec { substituteInPlace cmake/libonnxruntime.pc.cmake.in \ --replace-fail '$'{prefix}/@CMAKE_INSTALL_ @CMAKE_INSTALL_ echo "find_package(cudnn_frontend REQUIRED)" > cmake/external/cudnn_frontend.cmake '' # https://github.com/microsoft/onnxruntime/blob/c4f3742bb456a33ee9c826ce4e6939f8b84ce5b0/onnxruntime/core/platform/env.h#L249 + '' substituteInPlace onnxruntime/core/platform/env.h --replace-fail \ "GetRuntimePath() const { return PathString(); }" \ "GetRuntimePath() const { return PathString(\"$out/lib/\"); }" Loading @@ -305,8 +349,8 @@ effectiveStdenv.mkDerivation rec { + lib.optionalString rocmSupport '' patchShebangs tools/ci_build/hipify-perl '' + lib.optionalString (effectiveStdenv.hostPlatform.system == "aarch64-linux") '' # https://github.com/NixOS/nixpkgs/pull/226734#issuecomment-1663028691 + lib.optionalString (effectiveStdenv.hostPlatform.system == "aarch64-linux") '' rm -v onnxruntime/test/optimizer/nhwc_transformer_test.cc ''; Loading @@ -314,8 +358,8 @@ effectiveStdenv.mkDerivation rec { ${python3Packages.python.interpreter} ../setup.py bdist_wheel ''; postInstall = '' # perform parts of `tools/ci_build/github/linux/copy_strip_binary.sh` postInstall = '' install -m644 -Dt $out/include \ ../include/onnxruntime/core/framework/provider_options.h \ ../include/onnxruntime/core/providers/cpu/cpu_provider_factory.h \ Loading @@ -330,7 +374,7 @@ effectiveStdenv.mkDerivation rec { passthru = { inherit cudaSupport cudaPackages ncclSupport; # for the python module inherit protobuf; protobuf = protobuf'; tests = lib.optionalAttrs pythonSupport { python = python3Packages.onnxruntime; }; Loading @@ -348,7 +392,7 @@ effectiveStdenv.mkDerivation rec { compatibility. ''; homepage = "https://github.com/microsoft/onnxruntime"; changelog = "https://github.com/microsoft/onnxruntime/releases/tag/v${version}"; changelog = "https://github.com/microsoft/onnxruntime/releases/tag/${finalAttrs.src.tag}"; # https://github.com/microsoft/onnxruntime/blob/master/BUILD.md#architectures platforms = lib.platforms.unix; license = lib.licenses.mit; Loading @@ -356,5 +400,9 @@ effectiveStdenv.mkDerivation rec { puffnfresh ck3d ]; # [libprotobuf ERROR /build/source/src/google/protobuf/descriptor_database.cc:642] File already # exists in database: onnx/onnx-ml.proto # https://github.com/onnx/onnx/issues/6094 broken = withFullProtobuf; }; } }) pkgs/development/rocm-modules/6/migraphx/default.nix +7 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, fetchpatch, rocmUpdateScript, pkg-config, cmake, Loading Loading @@ -79,6 +80,12 @@ stdenv.mkDerivation (finalAttrs: { patches = [ ./msgpack-6-compat.patch # Backport "Add quantize_bf16 to C api output" # Required for onnxruntime 1.23+ (fetchpatch { url = "https://github.com/ROCm/AMDMIGraphX/commit/f33afac654dfc4558f4d9867c2d28a2d98cf49b4.patch"; hash = "sha256-5O4UanmyhQ9Te830SISaquM4TdG/gEY3wfWSaU/cS30="; }) ]; nativeBuildInputs = [ Loading Loading
pkgs/by-name/on/onnxruntime/cpuinfo-logging.patchdeleted 100644 → 0 +0 −45 Original line number Diff line number Diff line diff --git a/onnxruntime/core/common/cpuid_info.cc b/onnxruntime/core/common/cpuid_info.cc --- a/onnxruntime/core/common/cpuid_info.cc +++ b/onnxruntime/core/common/cpuid_info.cc @@ -3,6 +3,7 @@ #include "core/common/cpuid_info.h" #include "core/common/logging/logging.h" #include "core/common/logging/severity.h" +#include <iostream> #ifdef __linux__ @@ -364,8 +365,14 @@ #if defined(CPUINFO_SUPPORTED) pytorch_cpuinfo_init_ = cpuinfo_initialize(); if (!pytorch_cpuinfo_init_) { - LOGS_DEFAULT(WARNING) << "Failed to initialize PyTorch cpuinfo library. May cause CPU EP performance degradation " - "due to undetected CPU features."; + constexpr const char* message = + "Failed to initialize PyTorch cpuinfo library. May cause CPU EP performance degradation due to undetected CPU " + "features."; + if (logging::LoggingManager::HasDefaultLogger()) { + LOGS_DEFAULT(WARNING) << message; + } else { + std::cerr << "onnxruntime cpuid_info warning: " << message << std::endl; + } } #endif // defined(CPUINFO_SUPPORTED) #if defined(__linux__) diff --git a/onnxruntime/core/platform/posix/env.cc b/onnxruntime/core/platform/posix/env.cc --- a/onnxruntime/core/platform/posix/env.cc +++ b/onnxruntime/core/platform/posix/env.cc @@ -605,7 +605,12 @@ PosixEnv() { cpuinfo_available_ = cpuinfo_initialize(); if (!cpuinfo_available_) { - LOGS_DEFAULT(INFO) << "cpuinfo_initialize failed"; + constexpr const char* message = "cpuinfo_initialize failed"; + if (logging::LoggingManager::HasDefaultLogger()) { + LOGS_DEFAULT(INFO) << message; + } else { + std::cerr << "onnxruntime cpuid_info warning: " << message << std::endl; + } } } bool cpuinfo_available_{false};
pkgs/by-name/on/onnxruntime/package.nix +107 −59 Original line number Diff line number Diff line { lib, config, stdenv, lib, fetchFromGitHub, applyPatches, fetchpatch, abseil-cpp_202407, cmake, Loading @@ -14,7 +15,6 @@ howard-hinnant-date, libpng, nlohmann_json, perl, pkg-config, python3Packages, removeReferencesTo, Loading @@ -33,51 +33,91 @@ }@inputs: let version = "1.22.2"; src = fetchFromGitHub { owner = "microsoft"; repo = "onnxruntime"; tag = "v${version}"; fetchSubmodules = true; hash = "sha256-X8Pdtc0eR0iU+Xi2A1HrNo1xqCnoaxNjj4QFm/E3kSE="; }; stdenv = throw "Use effectiveStdenv instead"; effectiveStdenv = if cudaSupport then cudaPackages.backendStdenv else inputs.stdenv; inherit (cudaPackages) cuda_nvcc; cudaArchitecturesString = cudaPackages.flags.cmakeCudaArchitecturesString; mp11 = fetchFromGitHub { # While onnxruntime suggests using (3 year-old) protobuf 21.12 # https://github.com/microsoft/onnxruntime/blob/v1.23.2/cmake/deps.txt#L40, using a newer # protobuf version is possible. # We still need to patch the nixpkgs protobuf (32.1) to address the following test failure that # occurs when cudaSupport is enabled: # [libprotobuf ERROR /build/source/src/google/protobuf/descriptor_database.cc:642] File already exists in database: onnx/onnx-ml.proto # [libprotobuf FATAL /build/source/src/google/protobuf/descriptor.cc:1986] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): # terminate called after throwing an instance of 'google::protobuf::FatalException' # what(): CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): # # # Caused by: https://github.com/protocolbuffers/protobuf/commit/8f7aab29b21afb89ea0d6e2efeafd17ca71486a9 # Reported upstream: https://github.com/protocolbuffers/protobuf/issues/21542 protobuf' = protobuf.overrideAttrs (old: { patches = (old.patches or [ ]) ++ [ (fetchpatch { name = "Workaround nvcc bug in message_lite.h"; url = "https://raw.githubusercontent.com/conda-forge/protobuf-feedstock/737a13ea0680484c08e8e0ab0144dab82c10c1b3/recipe/patches/0010-Workaround-nvcc-bug-in-message_lite.h.patch"; hash = "sha256-joK50Il4mrwIc6zuNW9gDIfOx9LuA4FlusJuzUf9kqI="; }) ]; }); # TODO: update the following dependencies according to: # https://github.com/microsoft/onnxruntime/blob/v<VERSION>/cmake/deps.txt mp11-src = fetchFromGitHub { name = "mp11-src"; owner = "boostorg"; repo = "mp11"; tag = "boost-1.82.0"; hash = "sha256-cLPvjkf2Au+B19PJNrUkTW/VPxybi1MpPxnIl4oo4/o="; }; safeint = fetchFromGitHub { safeint-src = fetchFromGitHub { name = "safeint-src"; owner = "dcleblanc"; repo = "safeint"; tag = "3.0.28"; hash = "sha256-pjwjrqq6dfiVsXIhbBtbolhiysiFlFTnx5XcX77f+C0="; }; onnx = fetchFromGitHub { onnx-src = applyPatches { name = "onnx-src"; src = fetchFromGitHub { owner = "onnx"; repo = "onnx"; tag = "v1.17.0"; hash = "sha256-9oORW0YlQ6SphqfbjcYb0dTlHc+1gzy9quH/Lj6By8Q="; tag = "v1.18.0"; hash = "sha256-UhtF+CWuyv5/Pq/5agLL4Y95YNP63W2BraprhRqJOag="; }; patches = [ # Fix "error: conversion from 'onnx::OpSchema' to non-scalar type 'onnx::OpSchemaRegistry::OpSchemaRegisterOnce'" # https://github.com/microsoft/onnxruntime/issues/26229 # Fix from https://github.com/onnx/onnx/pull/7390 (fetchpatch { url = "https://github.com/onnx/onnx/commit/595a069aaac07586f111681245bc808ee63551f8.patch"; includes = [ "onnx/defs/schema.h" ]; hash = "sha256-FFAJuJse4nmNT3ixvEdlqzbr3edY46SqEFv7z/oo6m0="; }) # Fix "undefined reference to `onnx::RNNShapeInference(onnx::InferenceContext&)'" (fetchpatch { url = "https://github.com/onnx/onnx/commit/6769c41ad64ebca0358da8c7211d2c6d0e627b2b.patch"; hash = "sha256-VlTHs0om20kTNvSVQaasSsa5JROliQy4k9BECTsBtbU="; }) ]; }; cutlass = fetchFromGitHub { cutlass-src = fetchFromGitHub { name = "cutlass-src"; owner = "NVIDIA"; repo = "cutlass"; tag = "v3.5.1"; hash = "sha256-sTGYN+bjtEqQ7Ootr/wvx3P9f8MCDSSj3qyCWjfdLEA="; tag = "v3.9.2"; hash = "sha256-teziPNA9csYvhkG5t2ht8W8x5+1YGGbHm8VKx4JoxgI="; }; dlpack = fetchFromGitHub { dlpack-src = fetchFromGitHub { name = "dlpack-src"; owner = "dmlc"; repo = "dlpack"; rev = "5c210da409e7f1e51ddf445134a4376fdbd70d7d"; Loading @@ -86,30 +126,38 @@ let isCudaJetson = cudaSupport && cudaPackages.flags.isJetsonBuild; in effectiveStdenv.mkDerivation rec { effectiveStdenv.mkDerivation (finalAttrs: { pname = "onnxruntime"; inherit src version; version = "1.23.2"; src = fetchFromGitHub { owner = "microsoft"; repo = "onnxruntime"; tag = "v${finalAttrs.version}"; fetchSubmodules = true; hash = "sha256-hZ2L5+0Enkw4rGDKVpRECnKXP87w6Kbiyp6Fdxwt6hk="; }; patches = [ # https://github.com/microsoft/onnxruntime/pull/24583 # Missing cstdint include (GCC 15 compatibility) (fetchpatch { url = "https://github.com/microsoft/onnxruntime/commit/d6e712c5b7b6260a61e54d1fe40107cf5366ee77.patch"; hash = "sha256-FSuPybX8f2VoxvLhcYx4rdChaiK8bSUDR32sN3Efwfc="; }) # Correct maybe-uninitialized and range-loop-construct warnings # https://github.com/microsoft/onnxruntime/pull/26201 (fetchpatch { name = "fix-compilation-with-gcc-15.patch"; url = "https://github.com/microsoft/onnxruntime/commit/f7619dc93f592ddfc10f12f7145f9781299163a0.patch"; hash = "sha256-jxfMB+/Zokcu5DSfZP7QV1E8mTrsLe/sMr+ZCX/Y3m0="; url = "https://github.com/microsoft/onnxruntime/commit/8ebd0bf1cf02414584d15d7244b07fa97d65ba02.patch"; hash = "sha256-vX+kaFiNdmqWI91JELcLpoaVIHBb5EPbI7rCAMYAx04="; }) # Handle missing default logger when cpuinfo initialization fails in the build sandbox # TODO: Remove on next release # https://github.com/microsoft/onnxruntime/issues/10038 # https://github.com/microsoft/onnxruntime/pull/15661 # https://github.com/microsoft/onnxruntime/pull/20509 ./cpuinfo-logging.patch ]; nativeBuildInputs = [ cmake pkg-config python3Packages.python protobuf protobuf' ] ++ lib.optionals pythonSupport ( with python3Packages; Loading @@ -127,9 +175,6 @@ effectiveStdenv.mkDerivation rec { ] ++ lib.optionals isCudaJetson [ cudaPackages.autoAddCudaCompatRunpath ] ++ lib.optionals rocmSupport [ perl # for tools/ci_build/hipify-perl ]; buildInputs = [ Loading Loading @@ -169,6 +214,7 @@ effectiveStdenv.mkDerivation rec { ++ lib.optionals rocmSupport [ rocmPackages.clr rocmPackages.hipblas rocmPackages.hipblaslt rocmPackages.hipcub rocmPackages.hipfft rocmPackages.hiprand Loading @@ -178,6 +224,7 @@ effectiveStdenv.mkDerivation rec { rocmPackages.rocrand rocmPackages.rocthrust rocmPackages.miopen rocmPackages.migraphx rocmPackages.rccl rocmPackages.rocm-smi rocmPackages.roctracer Loading @@ -192,9 +239,9 @@ effectiveStdenv.mkDerivation rec { ++ lib.optionals pythonSupport ( with python3Packages; [ onnx pytest sympy onnx ] ); Loading @@ -215,34 +262,30 @@ effectiveStdenv.mkDerivation rec { (lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true) (lib.cmakeBool "FETCHCONTENT_QUIET" false) (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ABSEIL_CPP" "${abseil-cpp_202407.src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_DLPACK" "${dlpack}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_DLPACK" "${dlpack-src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_FLATBUFFERS" "${flatbuffers_23.src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MP11" "${mp11}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ONNX" "${onnx}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_MP11" "${mp11-src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ONNX" "${onnx-src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_RE2" "${re2.src}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_SAFEINT" "${safeint}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_SAFEINT" "${safeint-src}") (lib.cmakeFeature "FETCHCONTENT_TRY_FIND_PACKAGE_MODE" "ALWAYS") # fails to find protoc on darwin, so specify it (lib.cmakeFeature "ONNX_CUSTOM_PROTOC_EXECUTABLE" (lib.getExe protobuf)) (lib.cmakeFeature "ONNX_CUSTOM_PROTOC_EXECUTABLE" (lib.getExe protobuf')) (lib.cmakeBool "onnxruntime_BUILD_SHARED_LIB" true) (lib.cmakeBool "onnxruntime_BUILD_UNIT_TESTS" doCheck) (lib.cmakeBool "onnxruntime_BUILD_UNIT_TESTS" finalAttrs.doCheck) (lib.cmakeBool "onnxruntime_USE_FULL_PROTOBUF" withFullProtobuf) (lib.cmakeBool "onnxruntime_USE_CUDA" cudaSupport) (lib.cmakeBool "onnxruntime_USE_NCCL" (cudaSupport && ncclSupport)) (lib.cmakeBool "onnxruntime_USE_ROCM" rocmSupport) (lib.cmakeBool "onnxruntime_USE_MIGRAPHX" rocmSupport) (lib.cmakeBool "onnxruntime_ENABLE_LTO" (!cudaSupport || cudaPackages.cudaOlder "12.8")) ] ++ lib.optionals (effectiveStdenv.cc.isClang || rocmSupport) [ # Disable -Werror from COMPILE_WARNING_AS_ERROR target property "--compile-no-warning-as-error" ] ++ lib.optionals pythonSupport [ (lib.cmakeBool "onnxruntime_ENABLE_PYTHON" true) ] ++ lib.optionals cudaSupport [ # Werror and cudnn_frontend deprecations make for a bad time. "--compile-no-warning-as-error" (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_CUTLASS" "${cutlass}") (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_CUTLASS" "${cutlass-src}") (lib.cmakeFeature "onnxruntime_CUDNN_HOME" "${cudaPackages.cudnn}") (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cudaArchitecturesString) (lib.cmakeFeature "onnxruntime_NVCC_THREADS" "1") Loading Loading @@ -296,8 +339,9 @@ effectiveStdenv.mkDerivation rec { substituteInPlace cmake/libonnxruntime.pc.cmake.in \ --replace-fail '$'{prefix}/@CMAKE_INSTALL_ @CMAKE_INSTALL_ echo "find_package(cudnn_frontend REQUIRED)" > cmake/external/cudnn_frontend.cmake '' # https://github.com/microsoft/onnxruntime/blob/c4f3742bb456a33ee9c826ce4e6939f8b84ce5b0/onnxruntime/core/platform/env.h#L249 + '' substituteInPlace onnxruntime/core/platform/env.h --replace-fail \ "GetRuntimePath() const { return PathString(); }" \ "GetRuntimePath() const { return PathString(\"$out/lib/\"); }" Loading @@ -305,8 +349,8 @@ effectiveStdenv.mkDerivation rec { + lib.optionalString rocmSupport '' patchShebangs tools/ci_build/hipify-perl '' + lib.optionalString (effectiveStdenv.hostPlatform.system == "aarch64-linux") '' # https://github.com/NixOS/nixpkgs/pull/226734#issuecomment-1663028691 + lib.optionalString (effectiveStdenv.hostPlatform.system == "aarch64-linux") '' rm -v onnxruntime/test/optimizer/nhwc_transformer_test.cc ''; Loading @@ -314,8 +358,8 @@ effectiveStdenv.mkDerivation rec { ${python3Packages.python.interpreter} ../setup.py bdist_wheel ''; postInstall = '' # perform parts of `tools/ci_build/github/linux/copy_strip_binary.sh` postInstall = '' install -m644 -Dt $out/include \ ../include/onnxruntime/core/framework/provider_options.h \ ../include/onnxruntime/core/providers/cpu/cpu_provider_factory.h \ Loading @@ -330,7 +374,7 @@ effectiveStdenv.mkDerivation rec { passthru = { inherit cudaSupport cudaPackages ncclSupport; # for the python module inherit protobuf; protobuf = protobuf'; tests = lib.optionalAttrs pythonSupport { python = python3Packages.onnxruntime; }; Loading @@ -348,7 +392,7 @@ effectiveStdenv.mkDerivation rec { compatibility. ''; homepage = "https://github.com/microsoft/onnxruntime"; changelog = "https://github.com/microsoft/onnxruntime/releases/tag/v${version}"; changelog = "https://github.com/microsoft/onnxruntime/releases/tag/${finalAttrs.src.tag}"; # https://github.com/microsoft/onnxruntime/blob/master/BUILD.md#architectures platforms = lib.platforms.unix; license = lib.licenses.mit; Loading @@ -356,5 +400,9 @@ effectiveStdenv.mkDerivation rec { puffnfresh ck3d ]; # [libprotobuf ERROR /build/source/src/google/protobuf/descriptor_database.cc:642] File already # exists in database: onnx/onnx-ml.proto # https://github.com/onnx/onnx/issues/6094 broken = withFullProtobuf; }; } })
pkgs/development/rocm-modules/6/migraphx/default.nix +7 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, fetchpatch, rocmUpdateScript, pkg-config, cmake, Loading Loading @@ -79,6 +80,12 @@ stdenv.mkDerivation (finalAttrs: { patches = [ ./msgpack-6-compat.patch # Backport "Add quantize_bf16 to C api output" # Required for onnxruntime 1.23+ (fetchpatch { url = "https://github.com/ROCm/AMDMIGraphX/commit/f33afac654dfc4558f4d9867c2d28a2d98cf49b4.patch"; hash = "sha256-5O4UanmyhQ9Te830SISaquM4TdG/gEY3wfWSaU/cS30="; }) ]; nativeBuildInputs = [ Loading