metal : report OOM errors (#16274)

This commit is contained in:
Georgi Gerganov
2025-09-26 14:14:28 +03:00
committed by GitHub
parent b995a10760
commit 54dbc37053
2 changed files with 30 additions and 1 deletions

View File

@@ -1176,6 +1176,8 @@ void ggml_metal_buffer_set_tensor(ggml_metal_buffer_t buf, struct ggml_tensor *
options:MTLResourceStorageModeShared
deallocator:nil];
GGML_ASSERT(buf_src);
// dst
struct ggml_metal_buffer_id bid_dst = ggml_metal_buffer_get_id(buf, tensor);
bid_dst.offs += offset;
@@ -1232,6 +1234,8 @@ void ggml_metal_buffer_get_tensor(ggml_metal_buffer_t buf, const struct ggml_ten
options:MTLResourceStorageModeShared
deallocator:nil];
GGML_ASSERT(buf_dst);
id<MTLCommandQueue> queue = buf->queue;
id<MTLCommandBuffer> cmd_buf = [queue commandBufferWithUnretainedReferences];