Skip to content

Commit ad1e27a

Browse files
committed
metal : export ggml_backend_get_features()
ggml-ci
1 parent 808d434 commit ad1e27a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

ggml/src/ggml-metal/ggml-metal.m

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4372,11 +4372,36 @@ static ggml_backend_dev_t ggml_backend_metal_reg_device_get(ggml_backend_reg_t r
43724372
GGML_UNUSED(index);
43734373
}
43744374

4375+
static struct ggml_backend_feature g_ggml_backend_metal_features[] = {
4376+
#if defined(GGML_METAL_EMBED_LIBRARY)
4377+
{ "EMBED_LIBRARY", "1" },
4378+
#endif
4379+
#if defined(GGML_METAL_USE_BF16)
4380+
{ "BF16", "1" },
4381+
#endif
4382+
{ nil, nil },
4383+
};
4384+
4385+
static struct ggml_backend_feature * ggml_backend_metal_get_features(ggml_backend_reg_t reg) {
4386+
return g_ggml_backend_metal_features;
4387+
4388+
GGML_UNUSED(reg);
4389+
}
4390+
4391+
static void * ggml_backend_metal_get_proc_address(ggml_backend_reg_t reg, const char * name) {
4392+
if (strcmp(name, "ggml_backend_get_features") == 0) {
4393+
return (void *)ggml_backend_metal_get_features;
4394+
}
4395+
4396+
return NULL;
4397+
4398+
GGML_UNUSED(reg);
4399+
}
43754400
static struct ggml_backend_reg_i ggml_backend_metal_reg_i = {
43764401
/* .get_name = */ ggml_backend_metal_reg_get_name,
43774402
/* .device_count = */ ggml_backend_metal_reg_device_count,
43784403
/* .device_get = */ ggml_backend_metal_reg_device_get,
4379-
/* .get_proc_address = */ NULL,
4404+
/* .get_proc_address = */ ggml_backend_metal_get_proc_address,
43804405
};
43814406

43824407
ggml_backend_reg_t ggml_backend_metal_reg(void) {

0 commit comments

Comments
 (0)