From e900cba510adc88dead120a7f2e32806dc7e9518 Mon Sep 17 00:00:00 2001 From: Luna Nova Date: Sat, 8 Nov 2025 19:46:29 -0800 Subject: [PATCH] onnxruntime: use --compile-no-warning-as-error for clang&ROCm We were using two different approaches to ask for no -Werror, let's clean up by using the cmakeFlags version consistently. Fixes: 27767283176858b2786fd485b1a99535a47a05ed --- pkgs/by-name/on/onnxruntime/package.nix | 40 ++++++++++++------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/pkgs/by-name/on/onnxruntime/package.nix b/pkgs/by-name/on/onnxruntime/package.nix index bd91c2d2584f..4e8bef5c865b 100644 --- a/pkgs/by-name/on/onnxruntime/package.nix +++ b/pkgs/by-name/on/onnxruntime/package.nix @@ -228,6 +228,10 @@ effectiveStdenv.mkDerivation rec { (lib.cmakeBool "onnxruntime_USE_ROCM" 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) ] @@ -238,8 +242,6 @@ effectiveStdenv.mkDerivation rec { (lib.cmakeFeature "onnxruntime_NVCC_THREADS" "1") ] ++ lib.optionals rocmSupport [ - # Werror combines with rocprim header issues to cause errors (warp size const deprecation) - "--compile-no-warning-as-error" (lib.cmakeFeature "CMAKE_HIP_ARCHITECTURES" ( builtins.concatStringsSep ";" rocmPackages.clr.localGpuTargets or rocmPackages.clr.gpuTargets )) @@ -249,25 +251,21 @@ effectiveStdenv.mkDerivation rec { (lib.cmakeBool "onnxruntime_USE_COMPOSABLE_KERNEL_CK_TILE" false) ]; - env = - lib.optionalAttrs effectiveStdenv.cc.isClang { - NIX_CFLAGS_COMPILE = "-Wno-error"; - } - // lib.optionalAttrs rocmSupport { - MIOPEN_PATH = rocmPackages.miopen; - # HIP steps fail to find ROCm libs when not in HIPFLAGS, causing - # fatal error: 'rocrand/rocrand.h' file not found - HIPFLAGS = lib.concatMapStringsSep " " (pkg: "-I${lib.getInclude pkg}/include") [ - rocmPackages.hipblas - rocmPackages.hipcub - rocmPackages.hiprand - rocmPackages.hipsparse - rocmPackages.rocblas - rocmPackages.rocprim - rocmPackages.rocrand - rocmPackages.rocthrust - ]; - }; + env = lib.optionalAttrs rocmSupport { + MIOPEN_PATH = rocmPackages.miopen; + # HIP steps fail to find ROCm libs when not in HIPFLAGS, causing + # fatal error: 'rocrand/rocrand.h' file not found + HIPFLAGS = lib.concatMapStringsSep " " (pkg: "-I${lib.getInclude pkg}/include") [ + rocmPackages.hipblas + rocmPackages.hipcub + rocmPackages.hiprand + rocmPackages.hipsparse + rocmPackages.rocblas + rocmPackages.rocprim + rocmPackages.rocrand + rocmPackages.rocthrust + ]; + }; doCheck = !(