Skip to content

Commit de9b0bb

Browse files
committed
add sanity check and fix kompute teardown order
1 parent 50579f2 commit de9b0bb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ggml-kompute.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ ggml_vk_device ggml_vk_current_device() {
301301
}
302302

303303
ggml_kompute_context *ggml_vk_init() {
304+
GGML_ASSERT(s_kompute_context == nullptr);
304305
s_kompute_context = new ggml_kompute_context;
305306
return s_kompute_context;
306307
}
@@ -1824,8 +1825,8 @@ static const char * ggml_backend_kompute_name(ggml_backend_t backend) {
18241825

18251826
static void ggml_backend_kompute_free(ggml_backend_t backend) {
18261827
struct ggml_kompute_context * ctx = (struct ggml_kompute_context *)backend->context;
1827-
ggml_vk_free_device();
18281828
ggml_vk_free(ctx);
1829+
ggml_vk_free_device();
18291830
delete backend;
18301831
}
18311832

0 commit comments

Comments
 (0)