diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d760cd..270f4bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,14 +140,14 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) # Only one CUDA-like GPU backend can be enabled at a time. set(_gpu_backend_count 0) -foreach(_gpu_backend WITH_NVIDIA WITH_ILUVATAR WITH_HYGON WITH_THEAD WITH_METAX WITH_MARS WITH_MOORE WITH_ASCEND) +foreach(_gpu_backend WITH_NVIDIA WITH_ILUVATAR WITH_HYGON WITH_THEAD WITH_METAX WITH_MARS WITH_MOORE WITH_CAMBRICON WITH_ASCEND) if(${_gpu_backend}) math(EXPR _gpu_backend_count "${_gpu_backend_count} + 1") endif() endforeach() if(_gpu_backend_count GREATER 1) - message(FATAL_ERROR "`WITH_NVIDIA`, `WITH_ILUVATAR`, `WITH_HYGON`, `WITH_THEAD`, `WITH_METAX`, `WITH_MARS`, `WITH_MOORE`, and `WITH_ASCEND` are mutually exclusive. Build one GPU backend at a time.") + message(FATAL_ERROR "GPU backend options are mutually exclusive. Build one GPU backend at a time.") endif() if(WITH_NVIDIA) diff --git a/docs/backends.md b/docs/backends.md index c63b37d..ef10ae0 100644 --- a/docs/backends.md +++ b/docs/backends.md @@ -40,12 +40,19 @@ Current backend capabilities are: | Moore | Yes | Yes | No | Yes | Yes | Yes | Yes | | Hygon | Yes | Yes | Yes | Yes | Yes | Yes | Yes | | Cambricon | Yes | No | No | No | Yes | No | Yes | -| Ascend | Yes | No | No | No | Yes | No | Yes | +| Ascend | Yes | No | No | No | Yes | No | Yes* | | T-Head | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Treat a non-`kSuccess` status as the portable way to detect unsupported operations. +\* Ascend Graph capture and replay require the runtime `aclmdlRI*` symbols +(`aclmdlRICaptureBegin`, `aclmdlRICaptureGetInfo`, `aclmdlRICaptureEnd`, +`aclmdlRIExecuteAsync`, and `aclmdlRIDestroy`). The Graph replay test is +registered for Ascend builds and passes on CANN 9.0 with 910B hardware. On a +CANN installation without these symbols, the runtime reports Graph capture as +unsupported. + ## Header Dependencies Backend public wrappers may include vendor headers. For example, an NVIDIA diff --git a/src/native/ascend/runtime_.h b/src/native/ascend/runtime_.h index 35f3005..6503279 100644 --- a/src/native/ascend/runtime_.h +++ b/src/native/ascend/runtime_.h @@ -197,7 +197,8 @@ struct Runtime bool Available() const { return CaptureBegin != nullptr && CaptureGetInfo != nullptr && - CaptureEnd != nullptr && ExecuteAsync != nullptr; + CaptureEnd != nullptr && ExecuteAsync != nullptr && + Destroy != nullptr; } }; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bb05ed2..bf759d2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -143,7 +143,9 @@ if(WITH_ASCEND) add_infini_rt_backend_runtime_test( ASCEND infini::rt::Device::Type::kAscend infini/rt/ascend/runtime_.h - 1 0 0 0 0 0 0 0) + 1 0 0 0 1 0 0 0) + add_infini_rt_backend_graph_test( + ASCEND infini::rt::Device::Type::kAscend 1) endif() if(INFINI_RT_TEST_HAS_RUNTIME_BACKEND) diff --git a/tests/test_native_graph.cc b/tests/test_native_graph.cc index 17a51c8..1c429d9 100644 --- a/tests/test_native_graph.cc +++ b/tests/test_native_graph.cc @@ -110,9 +110,13 @@ void RunGraphReplayTest(infini::rt::test::TestContext* context) { "Failed to record device-to-device copy."); ExpectSuccess(context, runtime::StreamEndCapture(stream, &graph), "Failed to end stream capture."); + context->Expect(graph != nullptr, + "Stream capture should produce a graph handle."); ExpectSuccess(context, runtime::GraphInstantiate(&graph_exec, graph), "Failed to instantiate graph."); + context->Expect(graph_exec != nullptr, + "Graph instantiation should produce an executable handle."); } std::array replay_input_1{}; diff --git a/tests/test_runtime_dispatch.cc b/tests/test_runtime_dispatch.cc index 637efe2..a234f51 100644 --- a/tests/test_runtime_dispatch.cc +++ b/tests/test_runtime_dispatch.cc @@ -447,7 +447,7 @@ int main() { #if defined(INFINI_RT_TEST_WITH_ASCEND) TestDispatch(&context, infini::rt::Device::Type::kAscend, "ASCEND", - {true, false, false, false, false, false, false, false}); + {true, false, false, false, true, false, false, false}); #endif return context.ExitCode();