-
Notifications
You must be signed in to change notification settings - Fork 966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ggml_allocr_alloc_graph allocated overlapping tensor memory #700
Comments
This is not bug, it is actually the main function of ggml-alloc. The memory of the tensors with intermediate results is reused as soon as they aren't needed anymore to reduce the size of the compute buffers. If you want every tensor to have a different address, you can use a context without for (int i = 0; i < g1->n_nodes; i++) {
struct ggml_tensor * t1 = g1->nodes[i];
struct ggml_cgraph g1v = ggml_graph_view(g1, i, i + 1);
ggml_backend_graph_compute(backend, &g1v);
} There was also a callback added to |
Thanks for the quick response. Sorry I am new to |
I don't know much about training, but I believe that the way the training examples in llama.cpp handle this is by adding dependencies at the end of the graph with |
Thanks for the suggestions. |
Hi, I have encountered a strange issue using
ggml_allocr_alloc_graph
to allocate tensor data. When building the graph, I usedno-alloca
context and later usedggml_allocr_alloc_graph
to allocate all tensors' data. However, I noticed two particular tensors have exactly the same memory address for theirdata
member. Is this a bug?You can replicate the issue using my branch here. After building
ggml
, run./bin/test-alloc-graph
.The graph is a simple one:
The text was updated successfully, but these errors were encountered: