metal : fix more leaks
This commit is contained in:
parent
e7c4cccef6
commit
67dd7463ce
1 changed files with 6 additions and 6 deletions
12
ggml-metal.m
12
ggml-metal.m
|
@ -1177,15 +1177,11 @@ void ggml_metal_graph_compute(
|
||||||
// wait for all threads to finish
|
// wait for all threads to finish
|
||||||
dispatch_barrier_sync(queue, ^{});
|
dispatch_barrier_sync(queue, ^{});
|
||||||
|
|
||||||
[command_buffers[n_cb - 1] waitUntilCompleted];
|
|
||||||
|
|
||||||
// release resources
|
|
||||||
[edesc release];
|
|
||||||
[queue release];
|
|
||||||
|
|
||||||
// check status of command buffers
|
// check status of command buffers
|
||||||
// needed to detect if the device ran out-of-memory for example (#1881)
|
// needed to detect if the device ran out-of-memory for example (#1881)
|
||||||
for (int i = 0; i < n_cb; i++) {
|
for (int i = 0; i < n_cb; i++) {
|
||||||
|
[command_buffers[i] waitUntilCompleted];
|
||||||
|
|
||||||
MTLCommandBufferStatus status = (MTLCommandBufferStatus) [command_buffers[i] status];
|
MTLCommandBufferStatus status = (MTLCommandBufferStatus) [command_buffers[i] status];
|
||||||
if (status != MTLCommandBufferStatusCompleted) {
|
if (status != MTLCommandBufferStatusCompleted) {
|
||||||
fprintf(stderr, "%s: command buffer %d failed with status %lu\n", __func__, i, status);
|
fprintf(stderr, "%s: command buffer %d failed with status %lu\n", __func__, i, status);
|
||||||
|
@ -1196,6 +1192,10 @@ void ggml_metal_graph_compute(
|
||||||
[command_buffers[i] release];
|
[command_buffers[i] release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// release resources
|
||||||
|
[edesc release];
|
||||||
|
[queue release];
|
||||||
|
|
||||||
[command_encoders release];
|
[command_encoders release];
|
||||||
[command_buffers release];
|
[command_buffers release];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue