Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions ggml/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,16 @@ if (GGML_BLAS)
endif()

set (GGML_SOURCES_IQK iqk/iqk_quantize.cpp)

# iqk_quantize.cpp defines large static tables which can exceed the
# 2GB limit imposed by the default small code model on x86_64.
# When this happens, the linker reports relocation truncation errors.
# Use the "medium" code model for this file so that references to the
# large data sections are encoded with 64-bit relocations.
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|AMD64)" AND NOT MSVC)
set_source_files_properties(iqk/iqk_quantize.cpp
PROPERTIES COMPILE_OPTIONS "-mcmodel=medium")
endif()
set (GGML_HEADERS_IQK iqk/iqk_config.h)
if (GGML_IQK_MUL_MAT)
message(STATUS "Using optimized iqk matrix multiplications")
Expand Down
5 changes: 5 additions & 0 deletions ggml/src/ggml-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,11 @@ static inline ggml_fp16_t ggml_compute_fp32_to_fp16(float f) {
#include <arm_sve.h>
#endif // __ARM_FEATURE_SVE

#if defined(__loongarch64)
#define GGML_FP16_TO_FP32(x) GGML_COMPUTE_FP16_TO_FP32(x)
#define GGML_FP32_TO_FP16(x) GGML_COMPUTE_FP32_TO_FP16(x)
#endif

// precomputed f32 table for f16 (256 KB)
// defined in ggml.c, initialized in ggml_init()
extern float ggml_table_f32_f16[1 << 16];
Expand Down