Skip to content

Commit fed26f7

Browse files
committed
remane USE_CANN_GRAPH to USE_ACL_GRAPH
Signed-off-by: noemotiovon <[email protected]>
1 parent 2022946 commit fed26f7

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

ggml/src/ggml-cann/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ string(REGEX MATCH "[0-9]+[a-zA-Z]" SOC_TYPE_MAJOR_SN "${SOC_VERSION}")
3131
set(SOC_TYPE_COMPILE_OPTION "ASCEND_${SOC_TYPE_MAJOR_SN}")
3232
string(TOUPPER ${SOC_TYPE_COMPILE_OPTION} SOC_TYPE_COMPILE_OPTION)
3333
message(STATUS "CANN: SOC_VERSION = ${SOC_VERSION}")
34-
option(CANN_GRAPH "Enable CANN graph execution (ACL graph mode)" OFF)
34+
option(USE_ACL_GRAPH "Enable CANN graph execution (ACL graph mode)" OFF)
3535

36-
if(CANN_GRAPH AND (SOC_TYPE_MAJOR_SN STREQUAL "310P" OR SOC_TYPE_COMPILE_OPTION STREQUAL "ASCEND_310P"))
36+
if(USE_ACL_GRAPH AND (SOC_TYPE_MAJOR_SN STREQUAL "310P" OR SOC_TYPE_COMPILE_OPTION STREQUAL "ASCEND_310P"))
3737
message(FATAL_ERROR
3838
"CANN Graph (ACL graph mode) is not supported on 310P devices. "
39-
"Please build with -DCANN_GRAPH=OFF or use a supported SOC.")
39+
"Please build with -DUSE_ACL_GRAPH=OFF or use a supported SOC.")
4040
endif()
4141

4242
if (CANN_INSTALL_DIR)
@@ -75,11 +75,11 @@ if (CANN_INSTALL_DIR)
7575

7676
target_compile_definitions(ggml-cann PRIVATE "-D${SOC_TYPE_COMPILE_OPTION}")
7777

78-
if (CANN_GRAPH)
79-
target_compile_definitions(ggml-cann PRIVATE CANN_GRAPH)
80-
message(STATUS "CANN: CANN_GRAPH is enabled.")
78+
if (USE_ACL_GRAPH)
79+
target_compile_definitions(ggml-cann PRIVATE USE_ACL_GRAPH)
80+
message(STATUS "CANN: USE_ACL_GRAPH is enabled.")
8181
else()
82-
message(STATUS "CANN: CANN_GRAPH is disabled.")
82+
message(STATUS "CANN: USE_ACL_GRAPH is disabled.")
8383
endif()
8484

8585
message(STATUS "CANN: CANN_INCLUDE_DIRS = ${CANN_INCLUDE_DIRS}")

ggml/src/ggml-cann/common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class cann_task_queue {
337337
int32_t device_;
338338
};
339339

340-
#ifdef CANN_GRAPH
340+
#ifdef USE_ACL_GRAPH
341341
struct ggml_graph_node_properties {
342342
void * node_address;
343343
ggml_op node_op;
@@ -358,7 +358,7 @@ struct ggml_cann_graph {
358358

359359
std::vector<ggml_graph_node_properties> ggml_graph_properties;
360360
};
361-
#endif // CANN_GRAPH
361+
#endif // USE_ACL_GRAPH
362362

363363
/**
364364
* @brief Context for managing CANN backend operations.
@@ -368,7 +368,7 @@ struct ggml_backend_cann_context {
368368
std::string name; /**< Name of the device. */
369369
std::string description; /**< Description of the device. */
370370
aclrtEvent copy_event = nullptr; /**< Event for managing copy operations. */
371-
#ifdef CANN_GRAPH
371+
#ifdef USE_ACL_GRAPH
372372
/// Cached CANN ACL graph used for executing the current ggml computation graph.
373373
std::unique_ptr<ggml_cann_graph> cann_graph;
374374
#endif

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,7 @@ static void ggml_backend_cann_synchronize(ggml_backend_t backend) {
20752075
ACL_CHECK(aclrtSynchronizeStream(cann_ctx->stream()));
20762076
}
20772077

2078-
#ifdef CANN_GRAPH
2078+
#ifdef USE_ACL_GRAPH
20792079
/**
20802080
* @brief Populate the internal CANN graph node properties from the ggml computation graph.
20812081
*
@@ -2171,7 +2171,7 @@ static bool is_cann_graph_update_required(ggml_backend_cann_context * cann_ctx,
21712171
}
21722172
return false;
21732173
}
2174-
#endif // CANN_GRAPH
2174+
#endif // USE_ACL_GRAPH
21752175

21762176
/**
21772177
* @brief Evaluate the computation graph and optionally capture or execute it using CANN graph API.
@@ -2188,15 +2188,15 @@ static bool is_cann_graph_update_required(ggml_backend_cann_context * cann_ctx,
21882188
*/
21892189
static void evaluate_and_capture_cann_graph(ggml_backend_cann_context * cann_ctx, ggml_cgraph * cgraph,
21902190
bool & use_cann_graph, bool & cann_graph_update_required) {
2191-
#ifdef CANN_GRAPH
2191+
#ifdef USE_ACL_GRAPH
21922192
if (use_cann_graph && cann_graph_update_required) {
21932193
if (cann_ctx->cann_graph->graph != nullptr) {
21942194
ACL_CHECK(aclmdlRIDestroy(cann_ctx->cann_graph->graph));
21952195
cann_ctx->cann_graph->graph = nullptr;
21962196
}
21972197
ACL_CHECK(aclmdlRICaptureBegin(cann_ctx->stream(), ACL_MODEL_RI_CAPTURE_MODE_GLOBAL));
21982198
}
2199-
#endif // CANN_GRAPH
2199+
#endif // USE_ACL_GRAPH
22002200

22012201
// Only perform the graph execution if CANN graphs are not enabled, or we are capturing the graph.
22022202
// With the use of CANN graphs, the execution will be performed by the graph launch.
@@ -2216,7 +2216,7 @@ static void evaluate_and_capture_cann_graph(ggml_backend_cann_context * cann_ctx
22162216
}
22172217
}
22182218

2219-
#ifdef CANN_GRAPH
2219+
#ifdef USE_ACL_GRAPH
22202220
if (use_cann_graph && cann_graph_update_required) { // End CANN graph capture
22212221
ACL_CHECK(aclmdlRICaptureEnd(cann_ctx->stream(), &cann_ctx->cann_graph->graph));
22222222
}
@@ -2225,7 +2225,7 @@ static void evaluate_and_capture_cann_graph(ggml_backend_cann_context * cann_ctx
22252225
// Execute graph
22262226
ACL_CHECK(aclmdlRIExecuteAsync(cann_ctx->cann_graph->graph, cann_ctx->stream()));
22272227
}
2228-
#endif
2228+
#endif // USE_ACL_GRAPH
22292229
}
22302230

22312231

@@ -2247,7 +2247,7 @@ static enum ggml_status ggml_backend_cann_graph_compute(
22472247
(ggml_backend_cann_context*)backend->context;
22482248
ggml_cann_set_device(cann_ctx->device);
22492249
release_nz_workspace();
2250-
#ifdef CANN_GRAPH
2250+
#ifdef USE_ACL_GRAPH
22512251
bool use_cann_graph = true;
22522252
bool cann_graph_update_required = false;
22532253

@@ -2268,7 +2268,7 @@ static enum ggml_status ggml_backend_cann_graph_compute(
22682268
#else
22692269
bool use_cann_graph = false;
22702270
bool cann_graph_update_required = false;
2271-
#endif // CANN_GRAPH
2271+
#endif // USE_ACL_GRAPH
22722272

22732273
evaluate_and_capture_cann_graph(
22742274
cann_ctx,

0 commit comments

Comments
 (0)