Skip to content

Commit cc9514f

Browse files
committed
ggml/kompute: Remove unused ggml_backend_kompute_device_{ref, unref}()
Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
1 parent f57f8cb commit cc9514f

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

ggml/src/ggml-kompute.cpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ struct ggml_backend_kompute_context {
7979
: device(device), name(ggml_kompute_format_name(device)) { buft.context = nullptr; }
8080
};
8181

82-
// FIXME: It would be good to consolidate the kompute manager and the kompute context into one object
83-
// and consolidate the init functions and simplify object lifetime management. As it currently stands,
84-
// we *have* to have the kompute manager no matter what for device discovery, but the kompute context
85-
// is only created when a device is set and vulkan is explicitly turned on.
86-
static ggml_backend_kompute_context *s_kompute_context = nullptr;
87-
8882

8983
struct ggml_backend_kompute_buffer_type_context {
9084
int device;
@@ -1853,35 +1847,6 @@ kp::TensorT<uint8_t>::dataType()
18531847

18541848
// backend interface
18551849

1856-
1857-
static void ggml_backend_kompute_device_ref(ggml_backend_buffer_type_t buft) {
1858-
auto * ctx = static_cast<ggml_backend_kompute_buffer_type_context *>(buft->context);
1859-
1860-
if (!ctx->device_ref) {
1861-
s_kompute_context->manager.initializeDevice(
1862-
ctx->device, {}, {
1863-
"VK_KHR_shader_float16_int8", "VK_KHR_8bit_storage",
1864-
"VK_KHR_16bit_storage", "VK_KHR_shader_non_semantic_info"
1865-
}
1866-
);
1867-
}
1868-
1869-
assert(ggml_vk_has_device(s_kompute_context));
1870-
ctx->device_ref++;
1871-
}
1872-
1873-
static void ggml_backend_kompute_device_unref(ggml_backend_buffer_type_t buft) {
1874-
auto * ctx = static_cast<ggml_backend_kompute_buffer_type_context *>(buft->context);
1875-
1876-
assert(ctx->device_ref > 0);
1877-
1878-
ctx->device_ref--;
1879-
1880-
if (!ctx->device_ref) {
1881-
s_kompute_context->manager.destroy();
1882-
}
1883-
}
1884-
18851850
static const char * ggml_backend_kompute_buffer_get_name(ggml_backend_buffer_t buffer) {
18861851
auto * ctx = static_cast<ggml_backend_kompute_buffer_type_context *>(buffer->buft->context);
18871852
return ctx->name.c_str();

0 commit comments

Comments
 (0)