diff options
Diffstat (limited to 'misc/ggml')
-rw-r--r-- | misc/ggml/Makefile | 47 | ||||
-rw-r--r-- | misc/ggml/distinfo | 3 | ||||
-rw-r--r-- | misc/ggml/files/patch-src_ggml-cpu_CMakeLists.txt | 30 | ||||
-rw-r--r-- | misc/ggml/files/patch-tests_CMakeLists.txt | 11 | ||||
-rw-r--r-- | misc/ggml/pkg-descr | 13 | ||||
-rw-r--r-- | misc/ggml/pkg-plist | 22 |
6 files changed, 126 insertions, 0 deletions
diff --git a/misc/ggml/Makefile b/misc/ggml/Makefile new file mode 100644 index 000000000000..e6fc07539662 --- /dev/null +++ b/misc/ggml/Makefile @@ -0,0 +1,47 @@ +PORTNAME= ggml +DISTVERSION= g20250916 +PORTREVISION= 1 +CATEGORIES= misc # machine-learning + +MAINTAINER= yuri@FreeBSD.org +COMMENT= Tensor library for machine learning +WWW= https://github.com/ggerganov/ggml + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= cmake:testing compiler:c++17-lang python:run shebangfix +USE_LDCONFIG= yes + +BROKEN_i386= compilation fails: LLVM ERROR: out of memory + +USE_GITHUB= yes +GH_ACCOUNT= ggerganov +GH_TAGNAME= 978f6e1 + +CMAKE_ON= BUILD_SHARED_LIBS +CMAKE_OFF= GGML_BUILD_TESTS \ + GGML_BUILD_EXAMPLES \ + GGML_NATIVE \ + GGML_SSE42 \ + GGML_AVX \ + GGML_AVX2 \ + GGML_BMI2 \ + GGML_FMA \ + GGML_F16C +CMAKE_TESTING_ON= GGML_BUILD_TESTS + +BINARY_ALIAS= git=false + +OPTIONS_DEFINE= VULKAN +OPTIONS_DEFAULT= VULKAN +OPTIONS_SUB= yes + +VULKAN_CMAKE_BOOL= GGML_VULKAN +VULKAN_BUILD_DEPENDS= glslc:graphics/shaderc \ + vulkan-headers>0:graphics/vulkan-headers +VULKAN_LIB_DEPENDS= libvulkan.so:graphics/vulkan-loader + +# tests as of g20250828: 100% tests passed, 0 tests failed out of 21 + +.include <bsd.port.mk> diff --git a/misc/ggml/distinfo b/misc/ggml/distinfo new file mode 100644 index 000000000000..d8983992a40c --- /dev/null +++ b/misc/ggml/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1758234399 +SHA256 (ggerganov-ggml-g20250916-978f6e1_GH0.tar.gz) = 6aed1d94900779583ae4c1981d27827a641aa97562421b24150f24b03a28e3f1 +SIZE (ggerganov-ggml-g20250916-978f6e1_GH0.tar.gz) = 2133677 diff --git a/misc/ggml/files/patch-src_ggml-cpu_CMakeLists.txt b/misc/ggml/files/patch-src_ggml-cpu_CMakeLists.txt new file mode 100644 index 000000000000..a44169da8da7 --- /dev/null +++ b/misc/ggml/files/patch-src_ggml-cpu_CMakeLists.txt @@ -0,0 +1,30 @@ +--- src/ggml-cpu/CMakeLists.txt.orig 2025-09-16 11:42:24 UTC ++++ src/ggml-cpu/CMakeLists.txt +@@ -127,10 +127,6 @@ function(ggml_add_cpu_backend_variant_impl tag_name) + if (NOT ARM_MCPU_RESULT) + string(REGEX MATCH "-mcpu=[^ ']+" ARM_MCPU_FLAG "${ARM_MCPU}") + endif() +- if ("${ARM_MCPU_FLAG}" STREQUAL "") +- set(ARM_MCPU_FLAG -mcpu=native) +- message(STATUS "ARM -mcpu not found, -mcpu=native will be used") +- endif() + + include(CheckCXXSourceRuns) + +@@ -382,13 +378,13 @@ function(ggml_add_cpu_backend_variant_impl tag_name) + string(REGEX REPLACE "POWER *([0-9]+)" "\\1" EXTRACTED_NUMBER "${MATCHED_STRING}") + + if (EXTRACTED_NUMBER GREATER_EQUAL 10) +- list(APPEND ARCH_FLAGS -mcpu=power10 -mpowerpc64) ++ list(APPEND ARCH_FLAGS -mcpu=power10) + elseif (EXTRACTED_NUMBER EQUAL 9) +- list(APPEND ARCH_FLAGS -mcpu=power9 -mpowerpc64) ++ list(APPEND ARCH_FLAGS -mcpu=power9) + elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le") + list(APPEND ARCH_FLAGS -mcpu=powerpc64le -mtune=native) + else() +- list(APPEND ARCH_FLAGS -mcpu=native -mtune=native -mpowerpc64) ++ list(APPEND ARCH_FLAGS -mcpu=native -mtune=native) + endif() + elseif(GGML_CPU_ALL_VARIANTS) + # Begin with the lowest baseline diff --git a/misc/ggml/files/patch-tests_CMakeLists.txt b/misc/ggml/files/patch-tests_CMakeLists.txt new file mode 100644 index 000000000000..d6d713231e9a --- /dev/null +++ b/misc/ggml/files/patch-tests_CMakeLists.txt @@ -0,0 +1,11 @@ +--- tests/CMakeLists.txt.orig 2025-09-04 04:13:15 UTC ++++ tests/CMakeLists.txt +@@ -114,7 +114,7 @@ else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX") + endif() + else() +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma -mf16c -mavx -mavx2") ++ #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma -mf16c -mavx -mavx2") + endif() + endif() + diff --git a/misc/ggml/pkg-descr b/misc/ggml/pkg-descr new file mode 100644 index 000000000000..611fa3ef39ae --- /dev/null +++ b/misc/ggml/pkg-descr @@ -0,0 +1,13 @@ +ggml is a tensor library for machine learning. + +Features: +* Written in C +* 16-bit float support +* Integer quantization support (4-bit, 5-bit, 8-bit, etc.) +* Automatic differentiation +* ADAM and L-BFGS optimizers +* Optimized for Apple Silicon +* On x86 architectures utilizes AVX / AVX2 intrinsics +* On ppc64 architectures utilizes VSX intrinsics +* No third-party dependencies +* Zero memory allocations during runtime diff --git a/misc/ggml/pkg-plist b/misc/ggml/pkg-plist new file mode 100644 index 000000000000..9c74452171bf --- /dev/null +++ b/misc/ggml/pkg-plist @@ -0,0 +1,22 @@ +include/ggml-alloc.h +include/ggml-backend.h +include/ggml-blas.h +include/ggml-cann.h +include/ggml-cpp.h +include/ggml-cpu.h +include/ggml-cuda.h +include/ggml-metal.h +include/ggml-opt.h +include/ggml-rpc.h +include/ggml-sycl.h +include/ggml-vulkan.h +include/ggml-webgpu.h +include/ggml.h +include/gguf.h +lib/cmake/ggml/ggml-config.cmake +lib/cmake/ggml/ggml-version.cmake +lib/libggml-base.so +lib/libggml-cpu.so +%%VULKAN%%lib/libggml-vulkan.so +lib/libggml.so +share/pkgconfig/ggml.pc |