Unverified Commit 2da41055 authored by DontEatOreo's avatar DontEatOreo
Browse files

koboldcpp: remove march, mtune and mtune

After going over a detailed conversation with @SomeoneSerge about
`cc-warpper`, `march` `mtune` and `mcpu`, I've come to the conclusion that
it is unnecessary to have those flags as ad hoc options. Instead, it's
best for users to "merge" their own `env` on top of the current one

Refs: https://github.com/NixOS/nixpkgs/pull/325540#discussion_r1674917673
Refs: https://github.com/NixOS/nixpkgs/pull/325540#discussion_r1676059901
Refs: https://github.com/NixOS/nixpkgs/pull/325540#discussion_r1676556732
Refs: https://github.com/NixOS/nixpkgs/pull/325540#discussion_r1676560445



Co-authored-by: default avatarSomeoneSerge <sergei.kozlukov@aalto.fi>
parent 4a10d41b
Loading
Loading
Loading
Loading
+3 −19
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@
  openblas,

  cublasSupport ? config.cudaSupport,
  # You can find a full list here: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
  # For example if you're on an GTX 1080 that means you're using "Pascal" and you need to pass "sm_60"
  arches ? cudaPackages.cudaFlags.arches or [ ],

  clblastSupport ? stdenv.isLinux,
  clblast,
@@ -28,19 +31,6 @@
  vulkan-loader,

  metalSupport ? stdenv.isDarwin && stdenv.isAarch64,

  # You can find a full list here: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
  # For example if you're on an GTX 1080 that means you're using "Pascal" and you need to pass "sm_60"
  arches ? cudaPackages.cudaFlags.arches or [ ],

  # You can find list of x86_64 options here: https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
  # For ARM here: https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
  # If you set "march" to "native", specify "mtune" as well; otherwise, it will be set to "generic". (credit to: https://lemire.me/blog/2018/07/25/it-is-more-complicated-than-i-thought-mtune-march-in-gcc/)
  march ? "",
  # Apple Silicon Chips (M1, M2, M3 and so on DO NOT use mtune)
  # For example, if you have an AMD Ryzen CPU, you will set "mtune" to "znver2"
  mtune ? "",
  mcpu ? "",
}:

let
@@ -116,12 +106,6 @@ effectiveStdenv.mkDerivation (finalAttrs: {

  env.NIX_LDFLAGS = lib.concatStringsSep " " (finalAttrs.darwinLdFlags ++ finalAttrs.metalLdFlags);

  env.NIX_CFLAGS_COMPILE = lib.concatStringsSep " " [
    (lib.optionalString (march != "") "-march=${march}")
    (lib.optionalString (mtune != "") "-mtune=${mtune}")
    (lib.optionalString (mcpu != "") "-mcpu=${mcpu}")
  ];

  makeFlags = [
    (makeBool "LLAMA_OPENBLAS" openblasSupport)
    (makeBool "LLAMA_CUBLAS" cublasSupport)