]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
Build with clang
authorMathieu Baudier <redacted>
Mon, 4 May 2026 13:25:22 +0000 (15:25 +0200)
committerMathieu Baudier <redacted>
Mon, 4 May 2026 16:27:07 +0000 (18:27 +0200)
debian/argeo-libggml-base0.lintian-overrides
debian/argeo-libggml0.lintian-overrides
debian/control
debian/rules

index 8f2c09e3b59d292af5072f7afcca40abcf9fb76e..317dfc2df06dc964893d8aa9baf689cc6048c165 100644 (file)
@@ -1,3 +1,3 @@
 # According to https://wiki.debian.org/UsingSymbolsFiles
 # "For C++ libraries it is often better not to ship symbols files."
-libggml-base0: no-symbols-control-file
+argeo-libggml-base0: no-symbols-control-file
index c83a4bafef69a4025909168d46ab2e834b375033..bb0aa3d8c054d8fef933137819f1ff2fbb5a36ed 100644 (file)
@@ -1,7 +1,7 @@
 # Debian hardening flags are applied,
 # so it seems a false positive
-libggml0: hardening-no-fortify-functions
+argeo-libggml0: hardening-no-fortify-functions
 
 # According to https://wiki.debian.org/UsingSymbolsFiles
 # "For C++ libraries it is often better not to ship symbols files."
-libggml0: no-symbols-control-file
+argeo-libggml0: no-symbols-control-file
index 7123ef38e0b702a3bd3c9d5cb8cb8870cd1298e4..7fa28f8b2c2825c5d262055507565a5d1b23644e 100644 (file)
@@ -6,10 +6,15 @@ Standards-Version: 4.7.2
 Vcs-Browser: https://git.djapps.eu/?p=pkg/ggml/sources/ggml;a=summary
 Vcs-Git: https://git.djapps.eu/pkg/ggml/sources/ggml
 Homepage: https://github.com/ggml-org/ggml
-Build-Depends: cmake,
+Build-Depends: debhelper-compat (= 13),
                lsb-release,
-               debhelper-compat (= 13),
+               cmake,
                pkgconf,
+               clang,
+               lld,
+               llvm,
+               libc++-dev,
+               libomp-dev,
                libvulkan-dev       <!pkg.ggml.novulkan>,
                glslc               <!pkg.ggml.novulkan>,
                cuda-nvcc-13-2      <!pkg.ggml.nocuda>,
@@ -44,8 +49,8 @@ Conflicts: libggml-dev
 Section: libdevel
 Architecture: any
 Multi-Arch: same
-Depends: libggml0 (= ${binary:Version}),
-         libggml-base0 (= ${binary:Version}),
+Depends: argeo-libggml0 (= ${binary:Version}),
+         argeo-libggml-base0 (= ${binary:Version}),
          ${misc:Depends},
 Description: Tensor library for machine learning (development files)
  This developments package provides the files required to build
index 8542bb5c5d7f6e606d0e3bc83632ac600e57aff0..631c954bc54c973d4f56a40ded44c0e30a25262c 100755 (executable)
@@ -1,6 +1,11 @@
 #!/usr/bin/make -f
 #export DH_VERBOSE = 1
 
+# clang build
+export CC = clang
+export CXX = clang++
+export LD = ld.lld
+
 export DEB_BUILD_MAINT_OPTIONS = hardening=-all
 
 # Derivative
@@ -27,6 +32,15 @@ CMAKE_OPTS  = -DCMAKE_BUILD_TYPE=RelWithDebInfo \
               -DGGML_BACKEND_DL=ON \
               -DGGML_BACKEND_DIR=/usr/lib/${DEB_HOST_MULTIARCH}/ggml/backends0 \
 
+# clang build
+CMAKE_OPTS += -DCMAKE_C_COMPILER=clang \
+              -DCMAKE_CXX_COMPILER=clang++ \
+              -DCMAKE_CXX_FLAGS=-stdlib=libc++ \
+              -DCMAKE_LINKER_TYPE=LLD \
+
+# OpenMP seems to work better with clang than with gcc
+CMAKE_OPTS += -DGGML_OPENMP=ON
+
 # Common backends
 CMAKE_OPTS += -DGGML_RPC=ON \
 
@@ -34,8 +48,8 @@ FLAGS_ARGEO=-O3 -g -DNDEBUG
 
 ifeq ($(DEB_TARGET_ARCH),arm64)
 
-CMAKE_OPTS += -DGGML_CPU_ALL_VARIANTS=OFF
-CMAKE_OPTS += -DGGML_CPU_ARM_ARCH=armv8.4-a
+CMAKE_OPTS += -DGGML_CPU_ALL_VARIANTS=ON
+#CMAKE_OPTS += -DGGML_CPU_ARM_ARCH=armv8.4-a
 
 else # amd64
 
@@ -43,16 +57,28 @@ CMAKE_OPTS += -DGGML_CPU_ALL_VARIANTS=ON
 
 endif # arm64
 
+##
+## VULKAN
+##
 ifeq ($(filter pkg.ggml.novulkan,$(DEB_BUILD_PROFILES)),)
 CMAKE_OPTS += -DGGML_VULKAN=ON
 endif
 
+##
+## CUDA
+##
 ifeq ($(filter pkg.ggml.nocuda,$(DEB_BUILD_PROFILES)),)
 CMAKE_OPTS += -DGGML_CUDA=ON \
               -DCMAKE_CUDA_FLAGS_RELWITHDEBINFO="$(FLAGS_ARGEO)" \
               -DCMAKE_CUDA_COMPILER=/usr/local/cuda-13/bin/nvcc
+# Compute capabilities supported by Argeo
+# cf. https://developer.nvidia.com/cuda/gpus
+CMAKE_OPTS += -DCMAKE_CUDA_ARCHITECTURES="121;120;89;86"
+# All K/V cache combinations
+CMAKE_OPTS += -DGGML_CUDA_FA_ALL_QUANTS=ON
 endif
 
+# Add Argeo optimization flags
 CMAKE_OPTS += -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(FLAGS_ARGEO)" \
               -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(FLAGS_ARGEO)" \
 
@@ -66,3 +92,7 @@ override_dh_auto_configure:
 
 override_dh_installexamples:
        dh_installexamples --exclude=.gitignore
+
+override_dh_dwz:
+       # Skip dwz optimization when using clang
+       
\ No newline at end of file