Skip to content

Commit 01ad35e

Browse files
authored
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 fcb0138 commit 01ad35e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,9 +2303,9 @@ static enum ggml_status ggml_backend_cann_graph_compute(ggml_backend_t backend,
23032303
// calculate rope cache for fist layer in current device.
23042304
cann_ctx->rope_cache.cached = false;
23052305

2306+
bool cann_graph_update_required = false;
23062307
#ifdef USE_ACL_GRAPH
23072308
bool use_cann_graph = true;
2308-
bool cann_graph_update_required = false;
23092309

23102310
static bool prefill_use_graph = parse_bool(get_env("GGML_CANN_PREFILL_USE_GRAPH").value_or(""));
23112311
if (!prefill_use_graph) {
@@ -2336,7 +2336,6 @@ static enum ggml_status ggml_backend_cann_graph_compute(ggml_backend_t backend,
23362336
}
23372337
#else
23382338
bool use_cann_graph = false;
2339-
bool cann_graph_update_required = false;
23402339
#endif // USE_ACL_GRAPH
23412340
evaluate_and_capture_cann_graph(cann_ctx, cgraph, use_cann_graph, cann_graph_update_required);
23422341

0 commit comments

Comments
 (0)