Skip to content

Commit 09d2e0d

Browse files
rauletorrescwangweixuan
authored andcommitted
CANN: Define cann_graph_update_required before macro (ggml-org#17434)
**Description of the problem** `cann_graph_update_required` is redundantly defined and initialized as `false` inside two mutually exclusive macro branches. **Proposed solution** Define it right before the macro so that it could serve both branches.
1 parent 0a3bd6a commit 09d2e0d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ggml/src/ggml-cann/ggml-cann.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,10 +2324,11 @@ static enum ggml_status ggml_backend_cann_graph_compute(
23242324
ggml_backend_cann_context* cann_ctx =
23252325
(ggml_backend_cann_context*)backend->context;
23262326
ggml_cann_set_device(cann_ctx->device);
2327-
release_nz_workspace();
2328-
#ifdef USE_ACL_GRAPH
2329-
bool use_cann_graph = true;
2327+
g_nz_workspaces[cann_ctx->device].clear();
2328+
23302329
bool cann_graph_update_required = false;
2330+
#ifdef USE_ACL_GRAPH
2331+
bool use_cann_graph = true;
23312332

23322333
// check environment LLAMA_SET_ROWS
23332334
if (!cann_ctx->support_set_rows) {
@@ -2344,7 +2345,6 @@ static enum ggml_status ggml_backend_cann_graph_compute(
23442345
}
23452346
#else
23462347
bool use_cann_graph = false;
2347-
bool cann_graph_update_required = false;
23482348
#endif // USE_ACL_GRAPH
23492349
evaluate_and_capture_cann_graph(
23502350
cann_ctx,

0 commit comments

Comments
 (0)