From 5f687d392b4d736c3ca5dc4d6778f5713a02ec28 Mon Sep 17 00:00:00 2001 From: Tristan Druyen Date: Fri, 3 May 2024 22:03:11 +0200 Subject: [PATCH] Nix fixes --- .devops/nix/apps.nix | 3 +++ .devops/nix/package.nix | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.devops/nix/apps.nix b/.devops/nix/apps.nix index b8a12cc0..f1e092e9 100644 --- a/.devops/nix/apps.nix +++ b/.devops/nix/apps.nix @@ -11,6 +11,9 @@ "llama-server" "quantize" "train-text-from-scratch" + "llama-bench" + "imatrix" + "perplexity" ]; mkApp = name: { type = "app"; diff --git a/.devops/nix/package.nix b/.devops/nix/package.nix index e8d5b0bd..483fa92f 100644 --- a/.devops/nix/package.nix +++ b/.devops/nix/package.nix @@ -30,8 +30,15 @@ useMpi ? false, # Increases the runtime closure size by ~700M useOpenCL ? false, useRocm ? config.rocmSupport, + rocmTargets ? [ "gfx1030" ], useVulkan ? false, llamaVersion ? "0.0.0", # Arbitrary version, substituted by the flake + llamaNative ? true, + llamaLTO ? true, + llamaAVX ? true, + llamaAVX2 ? true, + llamaFMA ? true, + llamaF16C ? true, # It's necessary to consistently use backendStdenv when building with CUDA support, # otherwise we get libstdc++ errors downstream. @@ -205,7 +212,12 @@ effectiveStdenv.mkDerivation ( cmakeFlags = [ - (cmakeBool "LLAMA_NATIVE" false) + (cmakeBool "LLAMA_NATIVE" llamaNative) + (cmakeBool "LLAMA_LTO" llamaLTO) + (cmakeBool "LLAMA_AVX" llamaAVX) + (cmakeBool "LLAMA_AVX2" llamaAVX2) + (cmakeBool "LLAMA_FMA" llamaFMA) + (cmakeBool "LLAMA_F16C" llamaF16C) (cmakeBool "LLAMA_BUILD_SERVER" true) (cmakeBool "BUILD_SHARED_LIBS" (!enableStatic)) (cmakeBool "CMAKE_SKIP_BUILD_RPATH" true) @@ -227,7 +239,7 @@ effectiveStdenv.mkDerivation ( ] ++ optionals useRocm [ (cmakeFeature "CMAKE_HIP_COMPILER" "${rocmPackages.llvm.clang}/bin/clang") - (cmakeFeature "CMAKE_HIP_ARCHITECTURES" (builtins.concatStringsSep ";" rocmPackages.clr.gpuTargets)) + (cmakeFeature "CMAKE_HIP_ARCHITECTURES" (builtins.concatStringsSep ";" rocmTargets)) ] ++ optionals useMetalKit [ (lib.cmakeFeature "CMAKE_C_FLAGS" "-D__ARM_FEATURE_DOTPROD=1")