danbev commited on
Commit
1a776cc
·
1 Parent(s): f819a74

ggml-alloc : remove buffer_id from leaf_alloc (ggml/987)

Browse files

This commit removes the buffer_id field from the leaf_alloc struct.

The motivation for is that this field is only written to and never
read/used as far as I can tell. Each tensor_alloc has a buffer_id field
and this is what caused me to look into this more closely, to
understand what the buffer_id in leaf_alloc was used for.

Files changed (1) hide show
  1. ggml/src/ggml-alloc.c +0 -2
ggml/src/ggml-alloc.c CHANGED
@@ -348,7 +348,6 @@ struct tensor_alloc {
348
  };
349
 
350
  struct leaf_alloc {
351
- int buffer_id;
352
  struct tensor_alloc leaf;
353
  };
354
 
@@ -740,7 +739,6 @@ bool ggml_gallocr_reserve_n(ggml_gallocr_t galloc, struct ggml_cgraph * graph, c
740
  for (int i = 0; i < graph->n_leafs; i++) {
741
  struct ggml_tensor * leaf = graph->leafs[i];
742
  struct hash_node * hn = ggml_gallocr_hash_get(galloc, leaf);
743
- galloc->leaf_allocs[i].buffer_id = hn->buffer_id;
744
  if (leaf->view_src || leaf->data) {
745
  galloc->leaf_allocs[i].leaf.buffer_id = -1;
746
  galloc->leaf_allocs[i].leaf.offset = SIZE_MAX;
 
348
  };
349
 
350
  struct leaf_alloc {
 
351
  struct tensor_alloc leaf;
352
  };
353
 
 
739
  for (int i = 0; i < graph->n_leafs; i++) {
740
  struct ggml_tensor * leaf = graph->leafs[i];
741
  struct hash_node * hn = ggml_gallocr_hash_get(galloc, leaf);
 
742
  if (leaf->view_src || leaf->data) {
743
  galloc->leaf_allocs[i].leaf.buffer_id = -1;
744
  galloc->leaf_allocs[i].leaf.offset = SIZE_MAX;