pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

llama.cpp: add support for the Vulkan backend



Module Name:	pkgsrc-wip
Committed By:	Pierre Pronchery <khorben%defora.org@localhost>
Pushed By:	khorben
Date:		Wed Oct 28 02:37:35 2026 +0100
Changeset:	fc707093457c6d95a27bcbcb1ca9f192eaf3cef6

Modified Files:
	llama.cpp/Makefile
	llama.cpp/PLIST
Added Files:
	llama.cpp/options.mk

Log Message:
llama.cpp: add support for the Vulkan backend

Tested on NetBSD/amd64.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=fc707093457c6d95a27bcbcb1ca9f192eaf3cef6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 llama.cpp/Makefile   |  7 +++----
 llama.cpp/PLIST      | 32 ++++++++++++++++++++++++++++++++
 llama.cpp/options.mk | 30 ++++++++++++++++++++++++++++++
 3 files changed, 65 insertions(+), 4 deletions(-)

diffs:
diff --git a/llama.cpp/Makefile b/llama.cpp/Makefile
index 4109bbed1a..66a2db3d52 100644
--- a/llama.cpp/Makefile
+++ b/llama.cpp/Makefile
@@ -11,7 +11,7 @@ HOMEPAGE=	https://github.com/ggerganov/llama.cpp/
 COMMENT=	LLM inference in C/C++
 LICENSE=	mit
 
-USE_TOOLS+=		pkg-config
+USE_TOOLS+=		gmake pkg-config
 USE_LANGUAGES=		c c++
 USE_CXX_FEATURES=	c++17
 
@@ -20,13 +20,12 @@ PKGCONFIG_OVERRIDE+=	cmake/llama.pc.in
 CMAKE_CONFIGURE_ARGS+=	-DLLAMA_BUILD_NUMBER=${LLAMA_BUILD_NUMBER}
 CMAKE_CONFIGURE_ARGS+=	-DLLAMA_BUILD_COMMIT=${LLAMA_BUILD_COMMIT}
 CMAKE_CONFIGURE_ARGS+=	-DLLAMA_BUILD_TESTS=NO
-CMAKE_CONFIGURE_ARGS+=	-DLLAMA_USE_SYSTEM_GGML=YES
+
+.include "options.mk"
 
 post-extract:
 	${LN} -s ${WRKDIR}/llama-b${LLAMA_BUILD_NUMBER} ${WRKSRC}/tools/ui/dist
 
 .include "../../www/curl/buildlink3.mk"
-BUILDLINK_API_DEPENDS.ggml+=	ggml>=0.27.0
-.include "../../math/ggml/buildlink3.mk"
 .include "../../devel/cmake/build.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/llama.cpp/PLIST b/llama.cpp/PLIST
index 5fe7d987fe..a73881d5c0 100644
--- a/llama.cpp/PLIST
+++ b/llama.cpp/PLIST
@@ -39,13 +39,45 @@ bin/llama-speculative
 bin/llama-speculative-simple
 bin/llama-tokenize
 bin/llama-tts
+${PLIST.vulkan}include/ggml-alloc.h
+${PLIST.vulkan}include/ggml-backend.h
+${PLIST.vulkan}include/ggml-blas.h
+${PLIST.vulkan}include/ggml-cann.h
+${PLIST.vulkan}include/ggml-cpp.h
+${PLIST.vulkan}include/ggml-cpu.h
+${PLIST.vulkan}include/ggml-cuda.h
+${PLIST.vulkan}include/ggml-metal.h
+${PLIST.vulkan}include/ggml-openvino.h
+${PLIST.vulkan}include/ggml-opt.h
+${PLIST.vulkan}include/ggml-rpc.h
+${PLIST.vulkan}include/ggml-sycl.h
+${PLIST.vulkan}include/ggml-virtgpu.h
+${PLIST.vulkan}include/ggml-vulkan.h
+${PLIST.vulkan}include/ggml-webgpu.h
+${PLIST.vulkan}include/ggml-zendnn.h
+${PLIST.vulkan}include/ggml.h
+${PLIST.vulkan}include/gguf.h
 include/llama-cpp.h
 include/llama.h
 include/mtmd-debug.h
 include/mtmd-helper.h
 include/mtmd.h
+${PLIST.vulkan}lib/cmake/ggml/ggml-config-version.cmake
+${PLIST.vulkan}lib/cmake/ggml/ggml-config.cmake
 lib/cmake/llama/llama-config-version.cmake
 lib/cmake/llama/llama-config.cmake
+${PLIST.vulkan}lib/libggml-base.so
+${PLIST.vulkan}lib/libggml-base.so.0
+${PLIST.vulkan}lib/libggml-base.so.0.27.0
+${PLIST.vulkan}lib/libggml-cpu.so
+${PLIST.vulkan}lib/libggml-cpu.so.0
+${PLIST.vulkan}lib/libggml-cpu.so.0.27.0
+${PLIST.vulkan}lib/libggml-vulkan.so
+${PLIST.vulkan}lib/libggml-vulkan.so.0
+${PLIST.vulkan}lib/libggml-vulkan.so.0.27.0
+${PLIST.vulkan}lib/libggml.so
+${PLIST.vulkan}lib/libggml.so.0
+${PLIST.vulkan}lib/libggml.so.0.27.0
 lib/libllama-batched-bench-impl.so
 lib/libllama-bench-impl.so
 lib/libllama-cli-impl.so
diff --git a/llama.cpp/options.mk b/llama.cpp/options.mk
new file mode 100644
index 0000000000..567f72a19f
--- /dev/null
+++ b/llama.cpp/options.mk
@@ -0,0 +1,30 @@
+# $NetBSD$
+
+PKG_OPTIONS_VAR=		PKG_OPTIONS.llama.cpp
+PKG_OPTIONS_OPTIONAL_GROUPS=	target
+PKG_OPTIONS_GROUP.target+=	cuda ggml vulkan
+PKG_SUGGESTED_OPTIONS+=		ggml
+
+.include "../../mk/bsd.options.mk"
+
+PLIST_VARS+=	vulkan
+.if !empty(PKG_OPTIONS:Mcuda)
+CMAKE_CONFIGURE_ARGS+=	-DGGML_CUDA=ON
+CMAKE_CONFIGURE_ARGS+=	-DGGML_NATIVE=ON
+CMAKE_CONFIGURE_ARGS+=	-DGGML_CUDA_FA=ON
+CMAKE_CONFIGURE_ARGS+=	-DGGML_CUDA_FA_ALL_QUANTS=ON
+CMAKE_CONFIGURE_ARGS+=	-DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc
+.elif !empty(PKG_OPTIONS:Mggml)
+CMAKE_CONFIGURE_ARGS+=	-DLLAMA_USE_SYSTEM_GGML=YES
+
+BUILDLINK_API_DEPENDS.ggml+=	ggml>=0.27.0
+.include "../../math/ggml/buildlink3.mk"
+.elif !empty(PKG_OPTIONS:Mvulkan)
+PLIST.vulkan=		yes
+CMAKE_CONFIGURE_ARGS+=	-DGGML_VULKAN=ON
+CMAKE_CONFIGURE_ARGS+=	-DGGML_OPENMP=OFF
+
+.include "../../graphics/shaderc/buildlink3.mk"
+.include "../../graphics/vulkan-loader/buildlink3.mk"
+.include "../../parallel/spirv-headers/buildlink3.mk"
+.endif


Home | Main Index | Thread Index | Old Index