diff --git a/LLama/LLamaSharp.Runtime.targets b/LLama/LLamaSharp.Runtime.targets index 10140cc06..2523e55c1 100644 --- a/LLama/LLamaSharp.Runtime.targets +++ b/LLama/LLamaSharp.Runtime.targets @@ -263,6 +263,14 @@ PreserveNewest runtimes/osx-arm64/native/libggml-cpu.dylib + + PreserveNewest + runtimes/osx-arm64/native/libggml-metal.dylib + + + PreserveNewest + runtimes/osx-arm64/native/libggml-blas.dylib + PreserveNewest runtimes/osx-arm64/native/libggml.dylib @@ -288,6 +296,10 @@ PreserveNewest runtimes/osx-x64/native/libggml-cpu.dylib + + PreserveNewest + runtimes/osx-x64/native/libggml-blas.dylib + PreserveNewest runtimes/osx-x64/native/libggml.dylib @@ -309,6 +321,10 @@ PreserveNewest runtimes/osx-x64/native/rosetta2/libggml-cpu.dylib + + PreserveNewest + runtimes/osx-x64/native/rosetta2/libggml-blas.dylib + PreserveNewest runtimes/osx-x64/native/rosetta2/libggml.dylib diff --git a/LLama/LLamaSharp.csproj b/LLama/LLamaSharp.csproj index 4d0d19eb3..784f77221 100644 --- a/LLama/LLamaSharp.csproj +++ b/LLama/LLamaSharp.csproj @@ -56,7 +56,7 @@ - 0827b2c1da-v2 + 0827b2c1da-v5 diff --git a/LLama/Native/Load/NativeLibraryUtils.cs b/LLama/Native/Load/NativeLibraryUtils.cs index 0414e1fde..d0d853f63 100644 --- a/LLama/Native/Load/NativeLibraryUtils.cs +++ b/LLama/Native/Load/NativeLibraryUtils.cs @@ -71,16 +71,29 @@ internal static IntPtr TryLoadLibrary(NativeLibraryConfig config, out INativeLib { if (systemInfo.OSPlatform == OSPlatform.OSX) { - // // ggml-metal (uncomment if needed, requires testing) - // if (os == "osx-arm64") - // dependencyPaths.Add(Path.Combine(currentRuntimeDirectory, $"{libPrefix}ggml-metal{ext}")); + // On OSX, we should load the CPU backend from the current directory // ggml-cpu - // On OSX, we should load the CPU backend from the current directory dependencyPaths.Add(Path.Combine(currentRuntimeDirectory, $"{libPrefix}ggml-cpu{ext}")); + + // ggml-metal (only supported on osx-arm64) + if (os == "osx-arm64") + dependencyPaths.Add(Path.Combine(currentRuntimeDirectory, $"{libPrefix}ggml-metal{ext}")); + + // ggml-blas (osx-x64, osx-x64-rosetta2 and osx-arm64 all have blas) + dependencyPaths.Add(Path.Combine(currentRuntimeDirectory, $"{libPrefix}ggml-blas{ext}")); } else { + // On other platforms (Windows, Linux), we need to load the CPU backend from the specified AVX level directory + // We are using the AVX level supplied by NativeLibraryConfig, which automatically detects the highest supported AVX level for us + + // ggml-cpu + dependencyPaths.Add(Path.Combine( + $"runtimes/{os}/native/{NativeLibraryConfig.AvxLevelToString(library.Metadata.AvxLevel)}", + $"{libPrefix}ggml-cpu{ext}" + )); + // ggml-cuda if (library.Metadata.UseCuda) dependencyPaths.Add(Path.Combine(currentRuntimeDirectory, $"{libPrefix}ggml-cuda{ext}")); @@ -88,14 +101,6 @@ internal static IntPtr TryLoadLibrary(NativeLibraryConfig config, out INativeLib // ggml-vulkan if (library.Metadata.UseVulkan) dependencyPaths.Add(Path.Combine(currentRuntimeDirectory, $"{libPrefix}ggml-vulkan{ext}")); - - // ggml-cpu - // On other platforms (Windows, Linux), we need to load the CPU backend from the specified AVX level directory - // We are using the AVX level supplied by NativeLibraryConfig, which automatically detects the highest supported AVX level for us - dependencyPaths.Add(Path.Combine( - $"runtimes/{os}/native/{NativeLibraryConfig.AvxLevelToString(library.Metadata.AvxLevel)}", - $"{libPrefix}ggml-cpu{ext}" - )); } } diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Cpu.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Cpu.nuspec index ab8d11c04..382eb2ae8 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Cpu.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Cpu.nuspec @@ -18,53 +18,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - - - - - - - - - - + diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.Linux.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.Linux.nuspec index 7b4f959f4..6abd16ccc 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.Linux.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.Linux.nuspec @@ -7,18 +7,27 @@ llama.cpp Authors false MIT + icon512.png https://github.com/SciSharp/LLamaSharp LLamaSharp.Backend.Cuda11.Linux contains the Linux binaries for LLamaSharp with Cuda11 support. Copyright 2023 The llama.cpp Authors. All rights reserved. LLamaSharp LLama LLM GPT AI ChatBot SciSharp + + + + - + + + + + diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.Windows.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.Windows.nuspec index 34bc6781d..a412e2e6f 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.Windows.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.Windows.nuspec @@ -7,18 +7,27 @@ llama.cpp Authors false MIT + icon512.png https://github.com/SciSharp/LLamaSharp LLamaSharp.Backend.Cuda11.Windows contains the Windows binaries for LLamaSharp with Cuda11 support. Copyright 2023 The llama.cpp Authors. All rights reserved. LLamaSharp LLama LLM GPT AI ChatBot SciSharp + + + + - + + + + + diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.nuspec index 1beeeaafc..5ac473914 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Cuda11.nuspec @@ -22,6 +22,7 @@ + diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Cuda12.Linux.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Cuda12.Linux.nuspec index 8834ae413..687283221 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Cuda12.Linux.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Cuda12.Linux.nuspec @@ -7,19 +7,27 @@ llama.cpp Authors false MIT + icon512.png https://github.com/SciSharp/LLamaSharp LLamaSharp.Backend.Cuda12.Linux contains the Linux binaries for LLamaSharp with Cuda12 support. Copyright 2023 The llama.cpp Authors. All rights reserved. LLamaSharp LLama LLM GPT AI ChatBot SciSharp + + + + - - + + + + + diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Cuda12.Windows.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Cuda12.Windows.nuspec index 3d37accec..1fd01edb9 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Cuda12.Windows.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Cuda12.Windows.nuspec @@ -7,19 +7,27 @@ llama.cpp Authors false MIT + icon512.png https://github.com/SciSharp/LLamaSharp LLamaSharp.Backend.Cuda12.Windows contains the Windows binaries for LLamaSharp with Cuda12 support. Copyright 2023 The llama.cpp Authors. All rights reserved. LLamaSharp LLama LLM GPT AI ChatBot SciSharp + + + + - - + + + + + diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.Linux.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.Linux.nuspec index 725764097..3f2202db4 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.Linux.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.Linux.nuspec @@ -7,18 +7,27 @@ llama.cpp Authors false MIT + icon512.png https://github.com/SciSharp/LLamaSharp LLamaSharp.Backend.Vulkan.Linux contains the Linux binaries for LLamaSharp with Vulkan support. Copyright 2023 The llama.cpp Authors. All rights reserved. LLamaSharp LLama LLM GPT AI ChatBot SciSharp + + + + - + + + + + diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.Windows.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.Windows.nuspec index 5c5b83f94..3f7487bcd 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.Windows.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.Windows.nuspec @@ -7,18 +7,28 @@ llama.cpp Authors false MIT + icon512.png https://github.com/SciSharp/LLamaSharp LLamaSharp.Backend.Vulkan.Windows contains the Windows binaries for LLamaSharp with Vulkan support. Copyright 2023 The llama.cpp Authors. All rights reserved. LLamaSharp LLama LLM GPT AI ChatBot SciSharp + + + + - + + + + + + diff --git a/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.nuspec b/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.nuspec index b4f26ec97..c972ad0fc 100644 --- a/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.nuspec +++ b/LLama/runtimes/build/LLamaSharp.Backend.Vulkan.nuspec @@ -22,6 +22,7 @@ + - + \ No newline at end of file