ggml : minor style changes
This commit is contained in:
parent
90a0e65c67
commit
d0e3596350
1 changed files with 16 additions and 10 deletions
10
ggml.c
10
ggml.c
|
@ -16342,6 +16342,7 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
|
|||
/*.wsize =*/ cgraph->work ? ggml_nbytes(cgraph->work) : 0,
|
||||
/*.wdata =*/ cgraph->work ? cgraph->work->data : NULL,
|
||||
};
|
||||
|
||||
if (node_n != -1) {
|
||||
/* FINALIZE */
|
||||
struct ggml_tensor * node = state->shared->cgraph->nodes[node_n];
|
||||
|
@ -16349,6 +16350,7 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
|
|||
ggml_compute_forward(¶ms, node);
|
||||
ggml_graph_compute_perf_stats_node(node, state->shared);
|
||||
}
|
||||
|
||||
// distribute new work or execute it direct if 1T
|
||||
while (++node_n < cgraph->n_nodes) {
|
||||
GGML_PRINT_DEBUG_5("%s: %d/%d\n", __func__, node_n, cgraph->n_nodes);
|
||||
|
@ -16368,6 +16370,7 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
|
|||
// they do something more efficient than spinning (?)
|
||||
params.type = GGML_TASK_COMPUTE;
|
||||
ggml_compute_forward(¶ms, node);
|
||||
|
||||
params.type = GGML_TASK_FINALIZE;
|
||||
ggml_compute_forward(¶ms, node);
|
||||
ggml_graph_compute_perf_stats_node(node, state->shared);
|
||||
|
@ -16375,6 +16378,7 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
atomic_store(&state->shared->n_active, n_threads);
|
||||
atomic_store(&state->shared->node_n, node_n);
|
||||
} else {
|
||||
|
@ -16387,8 +16391,9 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
|
|||
}
|
||||
// check if we should stop
|
||||
if (node_n >= cgraph->n_nodes) break;
|
||||
struct ggml_tensor * node = cgraph->nodes[node_n];
|
||||
|
||||
/* COMPUTE */
|
||||
struct ggml_tensor * node = cgraph->nodes[node_n];
|
||||
struct ggml_compute_params params = {
|
||||
/*.type =*/ GGML_TASK_COMPUTE,
|
||||
/*.ith =*/ state->ith,
|
||||
|
@ -16396,12 +16401,14 @@ static thread_ret_t ggml_graph_compute_thread(void * data) {
|
|||
/*.wsize =*/ cgraph->work ? ggml_nbytes(cgraph->work) : 0,
|
||||
/*.wdata =*/ cgraph->work ? cgraph->work->data : NULL,
|
||||
};
|
||||
|
||||
if(state->ith < node->n_tasks) {
|
||||
ggml_compute_forward(¶ms, node);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -16778,7 +16785,6 @@ void ggml_graph_compute(struct ggml_context * ctx, struct ggml_cgraph * cgraph)
|
|||
workers[0].ith = 0;
|
||||
workers[0].shared = &state_shared;
|
||||
|
||||
|
||||
const int64_t perf_start_cycles = ggml_perf_cycles();
|
||||
const int64_t perf_start_time_us = ggml_perf_time_us();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue