ggml icon indicating copy to clipboard operation
ggml copied to clipboard

ggml : remove `src0` and `src1` from `ggml_tensor` and rename `opt` to `src`

Open ggerganov opened this issue 1 year ago • 2 comments

https://github.com/ggerganov/ggml/blob/b98cd8689f74ed69432323ef5a15369d96086ae1/include/ggml/ggml.h#L415-L420

ggerganov avatar Jul 04 '23 18:07 ggerganov

I would suggest considering using an array for all src nodes instead. This will simplify the code when we need to look at the list of parents of a node. This already happens when printing to dot, internally in ggml-cuda, and will also happen when we implement the improved memory management. Having each parent in a different variable forces us to look at each one separately instead of just looping over an array.

slaren avatar Jul 04 '23 18:07 slaren

I updated the issue

ggerganov avatar Jul 04 '23 19:07 ggerganov

How would the new src indexing work in cases where a 4D tensor is created, but opt[0-2] is being written? It would be out of bounds. for ex: https://github.com/ggerganov/ggml/blob/master/src/ggml.c#L7268

nullhook avatar Jul 06 '23 21:07 nullhook

@nullhook I am not sure if I understand what you mean, the total number of source tensors available to ops will be the same, and can be increased as needed.

For instance, see how it is being done in https://github.com/ggerganov/ggml/pull/346: https://github.com/ggerganov/ggml/blob/b7fd1a4cf637ac747796403c7e2c6209b397c4af/src/ggml.c#L7260-L7266

slaren avatar Jul 06 '23 21:07 slaren

I was looking at the PR linked to this issue. So it seems like GGML_MAX_OPT needed to be increased

nullhook avatar Jul 06 '23 22:07 nullhook

Fixed via https://github.com/ggerganov/llama.cpp/pull/2178

ggerganov avatar Jul 11 '23 16:07 ggerganov