llama-cpp: compiler optimizations
This commit is contained in:
parent
d5ac5c8cd8
commit
6cc3d96362
@ -5,6 +5,23 @@
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
||||
# stolen from: https://stackoverflow.com/a/42398526
|
||||
optimizeWithFlags =
|
||||
pkg: flags:
|
||||
pkgs.lib.overrideDerivation pkg (
|
||||
old:
|
||||
let
|
||||
newflags = pkgs.lib.foldl' (acc: x: "${acc} ${x}") "" flags;
|
||||
oldflags = if (pkgs.lib.hasAttr "NIX_CFLAGS_COMPILE" old) then "${old.NIX_CFLAGS_COMPILE}" else "";
|
||||
in
|
||||
{
|
||||
NIX_CFLAGS_COMPILE = "${oldflags} ${newflags}";
|
||||
stdenv = pkgs.clang19Stdenv;
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
services.llama-cpp = {
|
||||
enable = true;
|
||||
@ -16,7 +33,13 @@
|
||||
);
|
||||
port = service_configs.ports.llama_cpp;
|
||||
host = "0.0.0.0";
|
||||
package = inputs.llamacpp.packages.${pkgs.system}.default;
|
||||
package = (
|
||||
optimizeWithFlags inputs.llamacpp.packages.${pkgs.system}.default [
|
||||
"-O3"
|
||||
"-march=znver2"
|
||||
"-mtune=znver2"
|
||||
]
|
||||
);
|
||||
extraFlags = [
|
||||
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user