Skip to content
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

[wip] ggml-backend v2 : add ggml_backend_sched #586

Merged
merged 21 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dyn graphs : remove n_tasks from ggml_cplan
  • Loading branch information
slaren committed Oct 21, 2023
commit 45d89367d024b30ae9a02c42f2ce43feebe3cf53
3 changes: 0 additions & 3 deletions include/ggml/ggml.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,6 @@ extern "C" {

int n_threads;

// the `n_tasks` of nodes, 1:1 mapping to cgraph nodes
int n_tasks[GGML_DEFAULT_GRAPH_SIZE]; // FIXME: need to allocate ggml_cplan dynamically?

// abort ggml_graph_compute when true
bool (*abort_callback)(void * data);
void * abort_callback_data;
Expand Down
4 changes: 4 additions & 0 deletions src/ggml-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ ggml_backend_sched_t ggml_backend_sched_new(ggml_backend_t * backends, int n_bac
GGML_ASSERT(n_backends <= GGML_MAX_BACKENDS);

struct ggml_backend_sched * sched = malloc(sizeof(struct ggml_backend_sched));
memset(sched, 0, sizeof(struct ggml_backend_sched));

fprintf(stderr, "ggml_backend_sched size: %lu KB\n", sizeof(struct ggml_backend_sched)/1024);

Expand All @@ -885,6 +886,9 @@ void ggml_backend_sched_free(ggml_backend_sched_t sched) {
for (int i = 0; i < sched->n_backends; i++) {
ggml_allocr_free(sched->allocs[i]);
}
free(sched->hash_set.keys);
free(sched->node_allocr);
free(sched->node_copies);
free(sched);
}

Expand Down
Loading