Nix fixes

This commit is contained in:
Tristan D. 2024-05-03 22:03:11 +02:00
parent 5442939fcc
commit 5f687d392b
Signed by: tristan
SSH key fingerprint: SHA256:3RU4RLOoM8oAjFU19f1W6t8uouZbA7GWkaSW6rjp1k8
2 changed files with 17 additions and 2 deletions

View file

@ -11,6 +11,9 @@
"llama-server" "llama-server"
"quantize" "quantize"
"train-text-from-scratch" "train-text-from-scratch"
"llama-bench"
"imatrix"
"perplexity"
]; ];
mkApp = name: { mkApp = name: {
type = "app"; type = "app";

View file

@ -30,8 +30,15 @@
useMpi ? false, # Increases the runtime closure size by ~700M useMpi ? false, # Increases the runtime closure size by ~700M
useOpenCL ? false, useOpenCL ? false,
useRocm ? config.rocmSupport, useRocm ? config.rocmSupport,
rocmTargets ? [ "gfx1030" ],
useVulkan ? false, useVulkan ? false,
llamaVersion ? "0.0.0", # Arbitrary version, substituted by the flake 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, # It's necessary to consistently use backendStdenv when building with CUDA support,
# otherwise we get libstdc++ errors downstream. # otherwise we get libstdc++ errors downstream.
@ -205,7 +212,12 @@ effectiveStdenv.mkDerivation (
cmakeFlags = 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 "LLAMA_BUILD_SERVER" true)
(cmakeBool "BUILD_SHARED_LIBS" (!enableStatic)) (cmakeBool "BUILD_SHARED_LIBS" (!enableStatic))
(cmakeBool "CMAKE_SKIP_BUILD_RPATH" true) (cmakeBool "CMAKE_SKIP_BUILD_RPATH" true)
@ -227,7 +239,7 @@ effectiveStdenv.mkDerivation (
] ]
++ optionals useRocm [ ++ optionals useRocm [
(cmakeFeature "CMAKE_HIP_COMPILER" "${rocmPackages.llvm.clang}/bin/clang") (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 [ ++ optionals useMetalKit [
(lib.cmakeFeature "CMAKE_C_FLAGS" "-D__ARM_FEATURE_DOTPROD=1") (lib.cmakeFeature "CMAKE_C_FLAGS" "-D__ARM_FEATURE_DOTPROD=1")