13
13
cudaPackages ,
14
14
darwin ,
15
15
rocmPackages ,
16
+ vulkan-headers ,
17
+ vulkan-loader ,
16
18
clblast ,
17
19
useBlas ? builtins . all ( x : ! x ) [
18
20
useCuda
19
21
useMetalKit
20
22
useOpenCL
21
23
useRocm
24
+ useVulkan
22
25
] ,
23
26
useCuda ? config . cudaSupport ,
24
27
useMetalKit ? stdenv . isAarch64 && stdenv . isDarwin && ! useOpenCL ,
25
28
useMpi ? false , # Increases the runtime closure size by ~700M
26
29
useOpenCL ? false ,
27
30
useRocm ? config . rocmSupport ,
31
+ useVulkan ? false ,
28
32
llamaVersion ? "0.0.0" , # Arbitrary version, substituted by the flake
29
33
} @inputs :
30
34
48
52
++ lib . optionals useMetalKit [ "MetalKit" ]
49
53
++ lib . optionals useMpi [ "MPI" ]
50
54
++ lib . optionals useOpenCL [ "OpenCL" ]
51
- ++ lib . optionals useRocm [ "ROCm" ] ;
55
+ ++ lib . optionals useRocm [ "ROCm" ]
56
+ ++ lib . optionals useVulkan [ "Vulkan" ] ;
52
57
53
58
pnameSuffix =
54
59
strings . optionalString ( suffices != [ ] )
108
113
hipblas
109
114
rocblas
110
115
] ;
116
+
117
+ vulkanBuildInputs = [
118
+ vulkan-headers
119
+ vulkan-loader
120
+ ] ;
111
121
in
112
122
113
123
effectiveStdenv . mkDerivation (
@@ -164,7 +174,8 @@ effectiveStdenv.mkDerivation (
164
174
++ optionals useCuda cudaBuildInputs
165
175
++ optionals useMpi [ mpi ]
166
176
++ optionals useOpenCL [ clblast ]
167
- ++ optionals useRocm rocmBuildInputs ;
177
+ ++ optionals useRocm rocmBuildInputs
178
+ ++ optionals useVulkan vulkanBuildInputs ;
168
179
169
180
cmakeFlags =
170
181
[
@@ -178,6 +189,7 @@ effectiveStdenv.mkDerivation (
178
189
( cmakeBool "LLAMA_HIPBLAS" useRocm )
179
190
( cmakeBool "LLAMA_METAL" useMetalKit )
180
191
( cmakeBool "LLAMA_MPI" useMpi )
192
+ ( cmakeBool "LLAMA_VULKAN" useVulkan )
181
193
]
182
194
++ optionals useCuda [
183
195
(
@@ -218,6 +230,7 @@ effectiveStdenv.mkDerivation (
218
230
useMpi
219
231
useOpenCL
220
232
useRocm
233
+ useVulkan
221
234
;
222
235
223
236
shell = mkShell {
@@ -242,11 +255,11 @@ effectiveStdenv.mkDerivation (
242
255
# Configurations we don't want even the CI to evaluate. Results in the
243
256
# "unsupported platform" messages. This is mostly a no-op, because
244
257
# cudaPackages would've refused to evaluate anyway.
245
- badPlatforms = optionals ( useCuda || useOpenCL ) lib . platforms . darwin ;
258
+ badPlatforms = optionals ( useCuda || useOpenCL || useVulkan ) lib . platforms . darwin ;
246
259
247
260
# Configurations that are known to result in build failures. Can be
248
261
# overridden by importing Nixpkgs with `allowBroken = true`.
249
- broken = ( useMetalKit && ! effectiveStdenv . isDarwin ) ;
262
+ broken = ( useMetalKit && ! effectiveStdenv . isDarwin ) || ( useVulkan && effectiveStdenv . isDarwin ) ;
250
263
251
264
description = "Inference of LLaMA model in pure C/C++${ descriptionSuffix } " ;
252
265
homepage = "https://github.com/ggerganov/llama.cpp/" ;
0 commit comments