From 84fb7f516cbeb16ef072d30d1a87cae2d6c924e2 Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Tue, 14 Mar 2023 21:14:29 +0100 Subject: [PATCH] Nix: fix ARM neon dotproduct on macOS --- flake.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index db9d75ea0..dae4ff60f 100644 --- a/flake.nix +++ b/flake.nix @@ -18,21 +18,26 @@ { packages.default = pkgs.stdenv.mkDerivation { name = "llama.cpp"; + src = ./.; + nativeBuildInputs = with pkgs; [ cmake ]; buildInputs = with pkgs; lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Accelerate ]; - src = ./.; + cmakeFlags = with pkgs; lib.optionals (system == "aarch64-darwin") [ + "-DCMAKE_C_FLAGS=-D__ARM_FEATURE_DOTPROD=1" + ]; installPhase = '' mkdir -p $out/bin - mv main $out/bin/llama-cpp - mv quantize $out/bin/llama-cpp-quantize + mv llama $out/bin/llama + mv quantize $out/bin/quantize echo "#!${llama-python}/bin/python" > $out/bin/convert-pth-to-ggml - cat convert-pth-to-ggml.py >> $out/bin/convert-pth-to-ggml + cat ${./convert-pth-to-ggml.py} >> $out/bin/convert-pth-to-ggml chmod +x $out/bin/convert-pth-to-ggml ''; }; devShells.default = pkgs.mkShell { packages = with pkgs; [ + cmake llama-python ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Accelerate