Ver Fonte

cann: fix crash when llama-bench is running on multiple cann devices (#9627)

Dou Xinpeng há 1 ano atrás
pai
commit
904837e0cb
1 ficheiros alterados com 1 adições e 0 exclusões
  1. 1 0
      ggml/src/ggml-cann/common.h

+ 1 - 0
ggml/src/ggml-cann/common.h

@@ -227,6 +227,7 @@ struct ggml_backend_cann_context {
      * @brief Destructor for cleaning up resources.
      * @brief Destructor for cleaning up resources.
      */
      */
     ~ggml_backend_cann_context() {
     ~ggml_backend_cann_context() {
+        ggml_cann_set_device(device);
         if (copy_event != nullptr) {
         if (copy_event != nullptr) {
             ACL_CHECK(aclrtDestroyEvent(copy_event));
             ACL_CHECK(aclrtDestroyEvent(copy_event));
         }
         }