aboutsummaryrefslogtreecommitdiff
path: root/ggml.c
diff options
context:
space:
mode:
authorStephan Walter <stephan@walter.name>2023-04-11 15:03:51 +0000
committerGitHub <noreply@github.com>2023-04-11 15:03:51 +0000
commit3e6e70d8e8917b5bd14c7c9f9b89a585f1ff0b31 (patch)
tree35dc380c6585d36941e155b9aae949e757af2b02 /ggml.c
parent2663d2c6784ad7b77998c6874df25648d597f74b (diff)
Add enum llama_ftype, sync ggml_type to model files (#709)
Diffstat (limited to 'ggml.c')
-rw-r--r--ggml.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/ggml.c b/ggml.c
index 897b67d..31947c4 100644
--- a/ggml.c
+++ b/ggml.c
@@ -2560,29 +2560,26 @@ inline static void ggml_vec_norm_inv_f32(const int n, float * s, const float * x
//
static const int GGML_BLCK_SIZE[GGML_TYPE_COUNT] = {
- QK,
- QK,
- 1,
- 1,
- 1,
- 1,
- 1,
+ [GGML_TYPE_F32] = 1,
+ [GGML_TYPE_F16] = 1,
+ [GGML_TYPE_Q4_0] = QK,
+ [GGML_TYPE_Q4_1] = QK,
+ [GGML_TYPE_I8] = 1,
+ [GGML_TYPE_I16] = 1,
+ [GGML_TYPE_I32] = 1,
};
-
-static_assert(GGML_TYPE_COUNT == 7, "GGML_TYPE_COUNT != 5");
+static_assert(GGML_TYPE_COUNT == 7, "GGML_BLCK_SIZE is outdated");
static const size_t GGML_TYPE_SIZE[GGML_TYPE_COUNT] = {
- sizeof(block_q4_0),
- sizeof(block_q4_1),
- sizeof(int8_t ),
- sizeof(int16_t),
- sizeof(int32_t),
- sizeof(ggml_fp16_t),
- sizeof(float ),
+ [GGML_TYPE_F32] = sizeof(float),
+ [GGML_TYPE_F16] = sizeof(ggml_fp16_t),
+ [GGML_TYPE_Q4_0] = sizeof(block_q4_0),
+ [GGML_TYPE_Q4_1] = sizeof(block_q4_1),
+ [GGML_TYPE_I8] = sizeof(int8_t),
+ [GGML_TYPE_I16] = sizeof(int16_t),
+ [GGML_TYPE_I32] = sizeof(int32_t),
};
-
-// don't forget to update the array above when adding new types
-static_assert(GGML_TYPE_COUNT == 7, "GGML_TYPE_COUNT != 5");
+static_assert(GGML_TYPE_COUNT == 7, "GGML_TYPE_SIZE is outdated");
static const char * GGML_OP_LABEL[GGML_OP_COUNT] = {
"NONE",