]> git.djapps.eu Git - pkg/ggml/sources/ggml/commit
ggml : fix calloc argument ordering. (llama/6820)
authorDave Airlie <redacted>
Mon, 22 Apr 2024 14:05:06 +0000 (00:05 +1000)
committerGeorgi Gerganov <redacted>
Sat, 11 May 2024 18:30:08 +0000 (21:30 +0300)
commit479a83975386632ac4d964ab09cad56eea9faf84
tree057cc1aa13f88bd945efac4a31b222d3f7176879
parent26b64e5ac7a0e222c3cb3d0fe05da750766b5f18
ggml : fix calloc argument ordering. (llama/6820)

Latest gcc complains here:
/home/airlied/devel/llama.cpp/src/ggml-alloc.c: In function ‘ggml_gallocr_new_n’:
/home/airlied/devel/llama.cpp/src/ggml-alloc.c:374:59: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
  374 |     ggml_gallocr_t galloc = (ggml_gallocr_t)calloc(sizeof(struct ggml_gallocr), 1);
      |                                                           ^~~~~~
/home/airlied/devel/llama.cpp/src/ggml-alloc.c:374:59: note: earlier argument should specify number of elements, later size of each element

and a bunch more.

calloc is specified to take nmemb first then size, so realign the code.

In a couple of places there was a * x, 1 so I fixed those to use calloc properly.
src/ggml-alloc.c
src/ggml-backend.c