From 904837e0cb2f5f01bf5d5901b7aa57a026860ae4 Mon Sep 17 00:00:00 2001 From: Dou Xinpeng <15529241576@163.com> Date: Wed, 25 Sep 2024 11:30:38 +0800 Subject: [PATCH] cann: fix crash when llama-bench is running on multiple cann devices (#9627) --- ggml/src/ggml-cann/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ggml/src/ggml-cann/common.h b/ggml/src/ggml-cann/common.h index e6a570107..edfa49614 100644 --- a/ggml/src/ggml-cann/common.h +++ b/ggml/src/ggml-cann/common.h @@ -227,6 +227,7 @@ struct ggml_backend_cann_context { * @brief Destructor for cleaning up resources. */ ~ggml_backend_cann_context() { + ggml_cann_set_device(device); if (copy_event != nullptr) { ACL_CHECK(aclrtDestroyEvent(copy_event)); }