Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure: llama-cpp (with opencl support) #286114

Open
jalil-salame opened this issue Feb 3, 2024 · 2 comments
Open

Build failure: llama-cpp (with opencl support) #286114

jalil-salame opened this issue Feb 3, 2024 · 2 comments
Labels
0.kind: build failure A package fails to build

Comments

@jalil-salame
Copy link
Contributor

Steps To Reproduce

Steps to reproduce the behavior:

  1. build llama-cpp with openclSupport (pkgs.llama-cpp.override { openclSupport = true; })
Simple flake

flake.nix

{
  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
      };
    in
    {
      packages.${system}.default = pkgs.llama-cpp.override { openclSupport = true; };
    };
}

flake.lock

{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1706550542,
        "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=",
        "path": "/nix/store/5gc4ncnkzcgma8fl1qabm8v9kj7w68gl-source",
        "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652",
        "type": "path"
      },
      "original": {
        "id": "nixpkgs",
        "type": "indirect"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

Build log

nix log
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/l209qvmnwfgzjkim5fvkgfi0mmi7fcq9-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
substituteStream(): WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. (file './ggml-metal.m')
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/share/doc/llama-cpp -DCMAKE_INSTALL_INFODIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/include -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/include -DCMAKE_INSTALL_SBINDIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_OSX_SYSROOT= -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/khkhbch4p1wjfl1g89gw1mszvvr7bzv0-gcc-wrapper-13.2.0/bin/strip -DCMAKE_RANLIB=/nix/store/khkhbch4p1wjfl1g89gw1mszvvr7bzv0-gcc-wrapper-13.2.0/bin/ranlib -DCMAKE_AR=/nix/store/khkhbch4p1wjfl1g89gw1mszvvr7bzv0-gcc-wrapper-13.2.0/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/11ihc1l38dj74x22dkgry7y2537dp401-llama-cpp-1892 -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CLBLAST=ON -DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS 
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/khkhbch4p1wjfl1g89gw1mszvvr7bzv0-gcc-wrapper-13.2.0/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/khkhbch4p1wjfl1g89gw1mszvvr7bzv0-gcc-wrapper-13.2.0/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Git (missing: GIT_EXECUTABLE) 
CMake Warning at scripts/build-info.cmake:14 (message):
  Git not found.  Build info will not be accurate.
Call Stack (most recent call first):
  CMakeLists.txt:111 (include)


-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Found BLAS: /nix/store/w069g7s2fghlxsvhd1ryb4rm3bmndlym-openblas-0.3.25/lib/libopenblas.so  
-- BLAS found, Libraries: /nix/store/w069g7s2fghlxsvhd1ryb4rm3bmndlym-openblas-0.3.25/lib/libopenblas.so
-- Found PkgConfig: /nix/store/01nygk9550khsba4msxd751bvgs8jj23-pkg-config-wrapper-0.29.2/bin/pkg-config (found version "0.29.2") 
-- Checking for module 'openblas64'
--   Found openblas64, version 0.3.25
-- BLAS found, Includes: /nix/store/gpwmdjhnzf0xirjycm02048r0h6wjhim-openblas-0.3.25-dev/include
-- CLBlast found
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
CMake Warning at common/CMakeLists.txt:24 (message):
  Git repository not found; to enable automatic generation of build info,
  make sure Git is installed and the project is a Git repository.


-- Configuring done (0.6s)
-- Generating done (0.0s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_POLICY_DEFAULT_CMP0025


-- Build files have been written to: /build/source/build
cmake: enabled parallel building
cmake: enabled parallel installing
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
build flags: -j16 SHELL=/nix/store/cjbyb45nxiqidj95c4k1mh65azn1x896-bash-5.2-p21/bin/bash
[  1%] Generating build details from Git
-- Could NOT find Git (missing: GIT_EXECUTABLE) 
CMake Warning at scripts/build-info.cmake:14 (message):
  Git not found.  Build info will not be accurate.
Call Stack (most recent call first):
  scripts/gen-build-info-cpp.cmake:1 (include)


[  3%] Building C object CMakeFiles/ggml.dir/ggml-alloc.c.o
[  3%] Building C object CMakeFiles/ggml.dir/ggml.c.o
[  5%] Building C object CMakeFiles/ggml.dir/ggml-backend.c.o
[  5%] Building CXX object CMakeFiles/ggml.dir/ggml-opencl.cpp.o
[  6%] Building C object CMakeFiles/ggml.dir/ggml-quants.c.o
[  7%] Building CXX object common/CMakeFiles/build_info.dir/build-info.cpp.o
[  7%] Built target build_info
/build/source/ggml.c: In function 'ggml_init':
/build/source/ggml.c:2296:9: error: implicit declaration of function 'ggml_cl_init'; did you mean 'ggml_opt_init'? [-Werror=implicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]]
 2296 |         ggml_cl_init();
      |         ^~~~~~~~~~~~
      |         ggml_opt_init
/build/source/ggml.c: In function 'ggml_compute_forward_mul_f32':
/build/source/ggml.c:7966:13: error: implicit declaration of function 'ggml_cl_mul'; did you mean 'ggml_clamp'? [-Werror=implicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]]
 7966 |             ggml_cl_mul(src0, src1, dst);
      |             ^~~~~~~~~~~
      |             ggml_clamp
/build/source/ggml.c: In function 'ggml_compute_forward_mul_mat':
/build/source/ggml.c:9828:9: error: implicit declaration of function 'ggml_cl_can_mul_mat'; did you mean 'ggml_can_mul_mat'? [-Werror=implicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]]
 9828 |     if (ggml_cl_can_mul_mat(src0, src1, dst)) {
      |         ^~~~~~~~~~~~~~~~~~~
      |         ggml_can_mul_mat
/build/source/ggml.c:9830:13: error: implicit declaration of function 'ggml_cl_mul_mat'; did you mean 'ggml_can_mul_mat'? [-Werror=implicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]]
 9830 |             ggml_cl_mul_mat(src0, src1, dst, params->wdata, params->wsize);
      |             ^~~~~~~~~~~~~~~
      |             ggml_can_mul_mat
/build/source/ggml.c: In function 'ggml_graph_plan':
/build/source/ggml.c:16706:31: error: implicit declaration of function 'ggml_cl_mul_mat_get_wsize'; did you mean 'ggml_mul_mat_set_prec'? [-Werror=implicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]]
16706 |                         cur = ggml_cl_mul_mat_get_wsize(node->src[0], node->src[1], node);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                               ggml_mul_mat_set_prec
cc1: some warnings being treated as errors
make[2]: *** [CMakeFiles/ggml.dir/build.make:76: CMakeFiles/ggml.dir/ggml.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:688: CMakeFiles/ggml.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Additional context

Notify maintainers

@dit7ya @elohmeier

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.75, NixOS, 24.05 (Uakari), 24.05.20240129.97b17f3`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a 👍 reaction to issues you find important.

@jalil-salame jalil-salame added the 0.kind: build failure A package fails to build label Feb 3, 2024
@jalil-salame jalil-salame changed the title Build failure: llama-cpp Build failure: llama-cpp (with opencl support) Feb 3, 2024
@jalil-salame
Copy link
Contributor Author

jalil-salame commented Feb 6, 2024

Might be related to #272569, I will test that and report back.

The upstream package.nix uses:

{
  useBlas ? builtins.all (x: !x) [
    useCuda
    useMetalKit
    useOpenCL
    useRocm
    useVulkan
  ],
  ...
}: ...

So it seems blas conflicts with all other options. We might want to do that in the nixpkgs package too.

@jalil-salame
Copy link
Contributor Author

Yes, blasSupport and openclSupport conflict. I think an assertion should be added to the package, or blasSupport should be disabled when openclSupport is selected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure A package fails to build
Projects
None yet
Development

No branches or pull requests

1 participant