]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
ggml : restore ggml_type_sizef() to aboid major version bump (#1441)
authorGeorgi Gerganov <redacted>
Mon, 16 Mar 2026 18:09:25 +0000 (20:09 +0200)
committerGitHub <redacted>
Mon, 16 Mar 2026 18:09:25 +0000 (20:09 +0200)
include/ggml.h
src/ggml.c

index 25f9601e9b5e74af84da0d5b1058633e01b8fa38..669f66b650fb812ef9e394679de4f0bb62e8987e 100644 (file)
@@ -733,6 +733,10 @@ extern "C" {
     GGML_API size_t  ggml_type_size(enum ggml_type type);             // size in bytes for all elements in a block
     GGML_API size_t  ggml_row_size (enum ggml_type type, int64_t ne); // size in bytes for all elements in a row
 
+    GGML_DEPRECATED(
+    GGML_API double ggml_type_sizef(enum ggml_type type), // ggml_type_size()/ggml_blck_size() as float
+    "use ggml_row_size() instead");
+
     GGML_API const char * ggml_type_name(enum ggml_type type);
     GGML_API const char * ggml_op_name  (enum ggml_op   op);
     GGML_API const char * ggml_op_symbol(enum ggml_op   op);
index e5b83e144799ee70009c9286c10eb9f363d426ff..4c0764a0ac52d9da2dd81db10444f1e44feebbae 100644 (file)
@@ -1294,6 +1294,12 @@ size_t ggml_row_size(enum ggml_type type, int64_t ne) {
     return ggml_type_size(type)*ne/ggml_blck_size(type);
 }
 
+double ggml_type_sizef(enum ggml_type type) {
+    assert(type >= 0);
+    assert(type < GGML_TYPE_COUNT);
+    return ((double)(type_traits[type].type_size))/type_traits[type].blck_size;
+}
+
 const char * ggml_type_name(enum ggml_type type) {
     assert(type >= 0);
     assert(type < GGML_TYPE_COUNT);