1313 cudaPackages ,
1414 darwin ,
1515 rocmPackages ,
16+ vulkan-headers ,
17+ vulkan-loader ,
1618 clblast ,
1719 useBlas ? builtins . all ( x : ! x ) [
1820 useCuda
1921 useMetalKit
2022 useOpenCL
2123 useRocm
24+ useVulkan
2225 ] ,
2326 useCuda ? config . cudaSupport ,
2427 useMetalKit ? stdenv . isAarch64 && stdenv . isDarwin && ! useOpenCL ,
2528 useMpi ? false , # Increases the runtime closure size by ~700M
2629 useOpenCL ? false ,
2730 useRocm ? config . rocmSupport ,
31+ useVulkan ? false ,
2832 llamaVersion ? "0.0.0" , # Arbitrary version, substituted by the flake
2933} @inputs :
3034
4852 ++ lib . optionals useMetalKit [ "MetalKit" ]
4953 ++ lib . optionals useMpi [ "MPI" ]
5054 ++ lib . optionals useOpenCL [ "OpenCL" ]
51- ++ lib . optionals useRocm [ "ROCm" ] ;
55+ ++ lib . optionals useRocm [ "ROCm" ]
56+ ++ lib . optionals useVulkan [ "Vulkan" ] ;
5257
5358 pnameSuffix =
5459 strings . optionalString ( suffices != [ ] )
108113 hipblas
109114 rocblas
110115 ] ;
116+
117+ vulkanBuildInputs = [
118+ vulkan-headers
119+ vulkan-loader
120+ ] ;
111121in
112122
113123effectiveStdenv . mkDerivation (
@@ -164,7 +174,8 @@ effectiveStdenv.mkDerivation (
164174 ++ optionals useCuda cudaBuildInputs
165175 ++ optionals useMpi [ mpi ]
166176 ++ optionals useOpenCL [ clblast ]
167- ++ optionals useRocm rocmBuildInputs ;
177+ ++ optionals useRocm rocmBuildInputs
178+ ++ optionals useVulkan vulkanBuildInputs ;
168179
169180 cmakeFlags =
170181 [
@@ -178,6 +189,7 @@ effectiveStdenv.mkDerivation (
178189 ( cmakeBool "LLAMA_HIPBLAS" useRocm )
179190 ( cmakeBool "LLAMA_METAL" useMetalKit )
180191 ( cmakeBool "LLAMA_MPI" useMpi )
192+ ( cmakeBool "LLAMA_VULKAN" useVulkan )
181193 ]
182194 ++ optionals useCuda [
183195 (
@@ -218,6 +230,7 @@ effectiveStdenv.mkDerivation (
218230 useMpi
219231 useOpenCL
220232 useRocm
233+ useVulkan
221234 ;
222235
223236 shell = mkShell {
@@ -242,11 +255,11 @@ effectiveStdenv.mkDerivation (
242255 # Configurations we don't want even the CI to evaluate. Results in the
243256 # "unsupported platform" messages. This is mostly a no-op, because
244257 # cudaPackages would've refused to evaluate anyway.
245- badPlatforms = optionals ( useCuda || useOpenCL ) lib . platforms . darwin ;
258+ badPlatforms = optionals ( useCuda || useOpenCL || useVulkan ) lib . platforms . darwin ;
246259
247260 # Configurations that are known to result in build failures. Can be
248261 # overridden by importing Nixpkgs with `allowBroken = true`.
249- broken = ( useMetalKit && ! effectiveStdenv . isDarwin ) ;
262+ broken = ( useMetalKit && ! effectiveStdenv . isDarwin ) || ( useVulkan && effectiveStdenv . isDarwin ) ;
250263
251264 description = "Inference of LLaMA model in pure C/C++${ descriptionSuffix } " ;
252265 homepage = "https://github.com/ggerganov/llama.cpp/" ;
0 commit comments