Skip to content

Commit

Permalink
add metal backend (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamlemec committed Oct 17, 2024
1 parent f50c46c commit 9000953
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gadget/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ggml_build_forward_expand,
ggml_backend_cpu_init,
ggml_backend_cuda_init,
ggml_backend_metal_init,
ggml_backend_free,
ggml_backend_alloc_ctx_tensors,
ggml_backend_get_default_buffer_type,
Expand Down Expand Up @@ -84,6 +85,9 @@ def create_backend(self, name):
num = 0 if num is None else str(num)
self.backend = ggml_backend_cuda_init(num)
self.backend_type = 'cuda'
elif name == 'metal':
self.backend = ggml_backend_metal_init()
self.backend_type = 'metal'
else:
raise ValueError(f'unknown backend: {name}')

Expand Down

0 comments on commit 9000953

Please sign in to comment.