Skip to content

Commit 195674a

Browse files
committed
rename to acl_graph_mode
Signed-off-by: noemotiovon <[email protected]>
1 parent 1148325 commit 195674a

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

docs/backend/CANN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ Controls automatic cleanup of the memory pool. This option is only effective whe
314314

315315
Converting the matmul weight format from ND to NZ can significantly improve performance on the 310I DUO NPU.
316316

317-
### GGML_CANN_EAGER_MODE
317+
### GGML_CANN_DISABLE_ACL_GRAPH
318318

319-
Enabling eager execution mode will bypass ACL graph execution and submit operators directly.
320-
This is useful for debugging or scenarios where graph building overhead is undesirable.
319+
When this variable is set, ACL graph execution is disabled and operators are executed in an op-by-op (eager) mode.
320+
This mode is mainly intended for debugging or for cases where the overhead of graph construction and execution is not desirable.

ggml/src/ggml-cann/common.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,17 +395,16 @@ struct ggml_backend_cann_context {
395395
#ifdef USE_ACL_GRAPH
396396
/// Cached CANN ACL graph used for executing the current ggml computation graph.
397397
std::unique_ptr<ggml_cann_graph> cann_graph;
398+
bool acl_graph_mode = true;
398399
#endif
399400
cann_task_queue task_queue;
400401
bool async_mode;
401-
bool eager_mode; // not use acl graph
402402
// Rope Cache
403403
ggml_cann_rope_cache rope_cache;
404404
// Constant Pool
405405
ggml_cann_tensor_cache rms_norm_one_tensor_cache;
406406
ggml_cann_tensor_cache rms_norm_zero_tensor_cache;
407407

408-
409408
aclrtStream streams[GGML_CANN_MAX_STREAMS] = {nullptr}; /**< Array of streams for the device. */
410409

411410
/**
@@ -420,10 +419,13 @@ struct ggml_backend_cann_context {
420419
async_mode = parse_bool(get_env("GGML_CANN_ASYNC_MODE").value_or(""));
421420
GGML_LOG_INFO("%s: device %d async operator submission is %s\n", __func__,
422421
device, async_mode ? "ON" : "OFF");
423-
424-
eager_mode = parse_bool(get_env("GGML_CANN_EAGER_MODE").value_or(""));
425-
GGML_LOG_INFO("%s: device %d eager execution mode is %s (acl graph disabled)\n",
426-
__func__, device, eager_mode ? "ON" : "OFF");
422+
#ifdef USE_ACL_GRAPH
423+
acl_graph_mode = !(parse_bool(get_env("GGML_CANN_DISABLE_ACL_GRAPH").value_or("")));
424+
GGML_LOG_INFO("%s: device %d execution mode is %s (%s)\n",
425+
__func__, device,
426+
acl_graph_mode ? "GRAPH" : "EAGER",
427+
acl_graph_mode ? "acl graph enabled" : "acl graph disabled");
428+
#endif
427429
}
428430

429431
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ static enum ggml_status ggml_backend_cann_graph_compute(
22522252
bool use_cann_graph = true;
22532253
bool cann_graph_update_required = false;
22542254

2255-
if (cann_ctx->eager_mode) {
2255+
if (!cann_ctx->acl_graph_mode) {
22562256
use_cann_graph = false;
22572257
}
22582258

0 commit comments

Comments
 (0)