From cc9514f9416f75165ac1b582b7d053b9d8cddbf4 Mon Sep 17 00:00:00 2001 From: Feng Jiang Date: Wed, 21 Aug 2024 16:41:26 +0800 Subject: [PATCH] ggml/kompute: Remove unused ggml_backend_kompute_device_{ref, unref}() Signed-off-by: Feng Jiang --- ggml/src/ggml-kompute.cpp | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/ggml/src/ggml-kompute.cpp b/ggml/src/ggml-kompute.cpp index 82f681f2d..c0b4a0600 100644 --- a/ggml/src/ggml-kompute.cpp +++ b/ggml/src/ggml-kompute.cpp @@ -79,12 +79,6 @@ struct ggml_backend_kompute_context { : device(device), name(ggml_kompute_format_name(device)) { buft.context = nullptr; } }; -// FIXME: It would be good to consolidate the kompute manager and the kompute context into one object -// and consolidate the init functions and simplify object lifetime management. As it currently stands, -// we *have* to have the kompute manager no matter what for device discovery, but the kompute context -// is only created when a device is set and vulkan is explicitly turned on. -static ggml_backend_kompute_context *s_kompute_context = nullptr; - struct ggml_backend_kompute_buffer_type_context { int device; @@ -1853,35 +1847,6 @@ kp::TensorT::dataType() // backend interface - -static void ggml_backend_kompute_device_ref(ggml_backend_buffer_type_t buft) { - auto * ctx = static_cast(buft->context); - - if (!ctx->device_ref) { - s_kompute_context->manager.initializeDevice( - ctx->device, {}, { - "VK_KHR_shader_float16_int8", "VK_KHR_8bit_storage", - "VK_KHR_16bit_storage", "VK_KHR_shader_non_semantic_info" - } - ); - } - - assert(ggml_vk_has_device(s_kompute_context)); - ctx->device_ref++; -} - -static void ggml_backend_kompute_device_unref(ggml_backend_buffer_type_t buft) { - auto * ctx = static_cast(buft->context); - - assert(ctx->device_ref > 0); - - ctx->device_ref--; - - if (!ctx->device_ref) { - s_kompute_context->manager.destroy(); - } -} - static const char * ggml_backend_kompute_buffer_get_name(ggml_backend_buffer_t buffer) { auto * ctx = static_cast(buffer->buft->context); return ctx->name.c_str();