aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKawrakow <48489457+ikawrakow@users.noreply.github.com>2023-06-18 10:52:10 +0300
committerGitHub <noreply@github.com>2023-06-18 10:52:10 +0300
commit90cc59d6ab1363a5c69c60c4b94db647d3a54a18 (patch)
tree51fd1eb8532cbf231e7a0a428783d0f3185a700b /examples
parentce2c7d72e2d06988b5ddec6811ab923254542077 (diff)
examples : fix examples/metal (#1920)
Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/metal/metal.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/metal/metal.cpp b/examples/metal/metal.cpp
index 77aca94..cdfe4bf 100644
--- a/examples/metal/metal.cpp
+++ b/examples/metal/metal.cpp
@@ -40,8 +40,10 @@ int main(int argc, char ** argv) {
// this allocates all Metal resources and memory buffers
auto * ctx_metal = ggml_metal_init();
- ggml_metal_add_buffer(ctx_metal, "data", ggml_get_mem_buffer(ctx_data), ggml_get_mem_size(ctx_data));
- ggml_metal_add_buffer(ctx_metal, "eval", ggml_get_mem_buffer(ctx_eval), ggml_get_mem_size(ctx_eval));
+ const size_t max_size_data = ggml_get_max_tensor_size(ctx_data);
+ const size_t max_size_eval = ggml_get_max_tensor_size(ctx_eval);
+ ggml_metal_add_buffer(ctx_metal, "data", ggml_get_mem_buffer(ctx_data), ggml_get_mem_size(ctx_data), max_size_data);
+ ggml_metal_add_buffer(ctx_metal, "eval", ggml_get_mem_buffer(ctx_eval), ggml_get_mem_size(ctx_eval), max_size_eval);
// main
{