Skip to content

LLM inference in C/C++

C++ ggml

ggml : fix c++ odr by properly using GGML_COMMON_DECL_CPP (#29504)

XZiarda89bb3ccc61
diff --git a/ggml/src/ggml-cpu/tiled/tiled-kernel.h b/ggml/src/ggml-cpu/tiled/tiled-kernel.h
index b9df2c93c6..1a97f406a6 100644
--- a/ggml/src/ggml-cpu/tiled/tiled-kernel.h
+++ b/ggml/src/ggml-cpu/tiled/tiled-kernel.h
@@ -9,7 +9,7 @@
// bit unpacking routines: tiled_unpk_nib4, tiled_unpk_2bit, tiled_unpk_or
// LUT value expansion routines: tiled_lut8, tiled_unpk_sign32, tiled_unpk_tern8
-#define GGML_COMMON_DECL_C
+#define GGML_COMMON_DECL_CPP
#include "ggml-common.h"
#include <stddef.h>
diff --git a/ggml/src/ggml-cpu/tiled/tiled.cpp b/ggml/src/ggml-cpu/tiled/tiled.cpp
index 15a1d0c011..77e1a99450 100644
--- a/ggml/src/ggml-cpu/tiled/tiled.cpp
+++ b/ggml/src/ggml-cpu/tiled/tiled.cpp
@@ -35,8 +35,8 @@ static void tiled_unpack_src0(const block_q4_K * rows, int64_t row_stride, int n
const int s_off = r * nb_stride + slab * NB;
const block_q4_K & x = rows[r * row_stride + slab];
- tile->d[d_off] = ggml_fp16_to_fp32(x.d);
- tile->dmin[d_off] = ggml_fp16_to_fp32(x.dmin);
+ tile->d[d_off] = ggml_fp16_to_fp32(x.data.data.d);
+ tile->dmin[d_off] = ggml_fp16_to_fp32(x.data.data.dmin);
uint32_t utmp[4];
memcpy(utmp, x.scales, 12);
@@ -80,8 +80,8 @@ static void tiled_unpack_src0(const block_q5_K * rows, int64_t row_stride, int n
const int s_off = r * nb_stride + slab * NB;
const block_q5_K & x = rows[r * row_stride + slab];
- tile->d[d_off] = ggml_fp16_to_fp32(x.d);
- tile->dmin[d_off] = ggml_fp16_to_fp32(x.dmin);
+ tile->d[d_off] = ggml_fp16_to_fp32(x.data.data.d);
+ tile->dmin[d_off] = ggml_fp16_to_fp32(x.data.data.dmin);
uint32_t utmp[4];
memcpy(utmp, x.scales, 12);
@@ -207,8 +207,8 @@ static void tiled_unpack_src0(const block_q2_K * rows, int64_t row_stride, int n
const int q_off = r * qk_stride + slab * TILED_TILE_K;
const int s_off = r * nb_stride + slab * NB;
const block_q2_K & x = rows[r * row_stride + slab];
- tile->d[d_off] = ggml_fp16_to_fp32(x.d);
- tile->dmin[d_off] = ggml_fp16_to_fp32(x.dmin);
+ tile->d[d_off] = ggml_fp16_to_fp32(x.data.data.d);
+ tile->dmin[d_off] = ggml_fp16_to_fp32(x.data.data.dmin);
// 2-bit code: element e -> half=e>>7, el=e&127
// byte = half*32 + (el & 31), shift = 2*(el >> 5)