slaren commited on
Commit
673df39
·
1 Parent(s): 6b63eb1

ggml-alloc : fix list of allocated tensors with GGML_ALLOCATOR_DEBUG (llama/9573)

Browse files
Files changed (1) hide show
  1. ggml/src/ggml-alloc.c +6 -0
ggml/src/ggml-alloc.c CHANGED
@@ -294,6 +294,12 @@ static void ggml_dyn_tallocr_reset(struct ggml_dyn_tallocr * alloc) {
294
  alloc->free_blocks[0].offset = 0;
295
  alloc->free_blocks[0].size = SIZE_MAX/2; // restrict maximum size of a measure allocator to half size_t max to avoid overflows
296
  alloc->max_size = 0;
 
 
 
 
 
 
297
  }
298
 
299
  static struct ggml_dyn_tallocr * ggml_dyn_tallocr_new(size_t alignment) {
 
294
  alloc->free_blocks[0].offset = 0;
295
  alloc->free_blocks[0].size = SIZE_MAX/2; // restrict maximum size of a measure allocator to half size_t max to avoid overflows
296
  alloc->max_size = 0;
297
+
298
+ #ifdef GGML_ALLOCATOR_DEBUG
299
+ for (int i = 0; i < 1024; i++) {
300
+ alloc->allocated_tensors[i].tensor = NULL;
301
+ }
302
+ #endif
303
  }
304
 
305
  static struct ggml_dyn_tallocr * ggml_dyn_tallocr_new(size_t alignment) {