Skip to content

Commit dc4c048

Browse files
committed
metal : final touches
1 parent e5b7f7e commit dc4c048

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ggml/src/ggml-metal/ggml-metal.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,16 +473,19 @@ static void ggml_backend_metal_device_rel(struct ggml_backend_metal_device_conte
473473
//
474474

475475
struct ggml_metal_heap {
476-
int n_unused; // number of times the heap was unused
476+
// number of times the heap was unused
477+
int n_unused;
477478

478-
int64_t n_alloc; // total number of buffer allocations in this heap across all computes
479+
// total number of buffer allocations in this heap across all computes
480+
int64_t n_alloc;
479481

480482
// current offset in the heap - we reset this after each node in order to reuse the memory
481483
size_t offs;
482484

485+
// the currently allocated MTLBuffer objects in this heap
483486
id<MTLHeap> obj;
484487

485-
NSMutableArray * bufs; // the currently allocated MTLBuffer objects in this heap
488+
NSMutableArray * bufs;
486489
};
487490

488491
static struct ggml_metal_heap * ggml_metal_heap_init(id<MTLDevice> device, size_t size) {
@@ -586,7 +589,7 @@ static void ggml_metal_mem_pool_free(struct ggml_metal_mem_pool * mem_pool) {
586589
size_t size_cur = 0;
587590

588591
for (ggml_metal_heap_ptr * ptr in mem_pool->heaps) {
589-
GGML_LOG_DEBUG("%s: heap: %p\n", __func__, (void *) ptr.data);
592+
GGML_LOG_DEBUG("%s: heap: %p\n", __func__, (void *) ptr.data);
590593
GGML_LOG_DEBUG("%s: n_alloc: %" PRId64 "\n", __func__, ptr.data->n_alloc);
591594
GGML_LOG_DEBUG("%s: n_unused: %d\n", __func__, ptr.data->n_unused);
592595
GGML_LOG_DEBUG("%s: size: %.2f MiB\n", __func__, [ptr.data->obj size] / 1024.0 / 1024.0);

0 commit comments

Comments
 (0)