diff --git a/ggml-common.h b/ggml-common.h index 9c9cf4ec6..4b6d248b6 100644 --- a/ggml-common.h +++ b/ggml-common.h @@ -5,32 +5,32 @@ #define GGML_TABLE_BEGIN(type, name, size) static const type name[size] = { #define GGML_TABLE_END() }; + +#define GGML_COMMON_IMPL #elif defined(GGML_COMMON_IMPL_METAL) #include #define GGML_TABLE_BEGIN(type, name, size) static const constant type name[size] = { #define GGML_TABLE_END() }; + +#define GGML_COMMON_IMPL #elif defined(GGML_COMMON_IMPL_CUDA) #include #define GGML_TABLE_BEGIN(type, name, size) static const __device__ __constant__ type name[size] = { #define GGML_TABLE_END() }; + +#define GGML_COMMON_IMPL #elif defined(GGML_COMMON_IMPL_SYCL) #include #define GGML_TABLE_BEGIN(type, name, size) static dpct::global_memory name(sycl::range<1>(size), { #define GGML_TABLE_END() }); -#else -#pragma message("Before including ggml-common.h you should define GGML_COMMON_IMPL_XXX") -#include - -#define GGML_TABLE_BEGIN(type, name, size) static const type name[size] = { -#define GGML_TABLE_END() }; +#define GGML_COMMON_IMPL #endif -// shared constants and structs across ggml backends -// TODO: move quantum block declarations here +#if defined(GGML_COMMON_IMPL) GGML_TABLE_BEGIN(uint8_t, kmask_iq2xs, 8) 1, 2, 4, 8, 16, 32, 64, 128 @@ -775,3 +775,5 @@ GGML_TABLE_BEGIN(uint64_t, iq1s_grid, NGRID_IQ2XXS) 0x010101ff010101ff, 0x01010100ffffffff, 0x01010100ff000001, 0x010101000000ff00, 0x0101010001010000, 0x0101010100ff0001, 0x010101010001ff01, 0x010101010101ffff, GGML_TABLE_END() + +#endif // GGML_COMMON_IMPL diff --git a/ggml-quants.h b/ggml-quants.h index 316e35687..d2d25eb44 100644 --- a/ggml-quants.h +++ b/ggml-quants.h @@ -1,9 +1,9 @@ #pragma once -#include "ggml-impl.h" - // GGML internal header +#include "ggml-impl.h" + #include #include