Skip to content

Commit

Permalink
Sanitize -ngl flag on Apple Metal
Browse files Browse the repository at this point in the history
Passing `-ngl 35` (as shown by examples) to Apple Metal causes weird
output. This should be `-ngl 1` since it enables full GPU offloading
  • Loading branch information
jart committed Jan 23, 2024
1 parent 389c389 commit 79b88f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llamafile/gpu.c
Expand Up @@ -70,7 +70,7 @@ int llamafile_gpu_layers(int n_gpu_layers) {
}

// Apple Metal is safe enough to enable by default.
if (n_gpu_layers == -1 && ggml_metal_supported()) {
if ((n_gpu_layers < 0 || n_gpu_layers > 1) && ggml_metal_supported()) {
n_gpu_layers = 1;
}

Expand Down

0 comments on commit 79b88f8

Please sign in to comment.