detect linker version instead of compiler version
This commit is contained in:
parent
63c950c5b7
commit
7962d0a789
3 changed files with 16 additions and 2 deletions
|
@ -458,6 +458,15 @@ if (LLAMA_LTO)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# this version of Apple ld64 is buggy
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_C_COMPILER} ${CMAKE_EXE_LINKER_FLAGS} -Wl,-v
|
||||||
|
ERROR_VARIABLE output
|
||||||
|
)
|
||||||
|
if (output MATCHES "dyld-1015\.7")
|
||||||
|
add_compile_definitions(-DBUGGY_APPLE_LINKER)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Architecture specific
|
# Architecture specific
|
||||||
# TODO: probably these flags need to be tweaked on some architectures
|
# TODO: probably these flags need to be tweaked on some architectures
|
||||||
# feel free to update the Makefile for your architecture and send a pull request or issue
|
# feel free to update the Makefile for your architecture and send a pull request or issue
|
||||||
|
|
5
Makefile
5
Makefile
|
@ -239,6 +239,11 @@ else
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# this version of Apple ld64 is buggy
|
||||||
|
ifneq '' '$(findstring dyld-1015.7,$(shell $(CC) $(LDFLAGS) -Wl,-v 2>&1))'
|
||||||
|
MK_CPPFLAGS += -DBUGGY_APPLE_LINKER
|
||||||
|
endif
|
||||||
|
|
||||||
# OS specific
|
# OS specific
|
||||||
# TODO: support Windows
|
# TODO: support Windows
|
||||||
ifneq '' '$(filter $(UNAME_S),Linux Darwin FreeBSD NetBSD OpenBSD Haiku)'
|
ifneq '' '$(filter $(UNAME_S),Linux Darwin FreeBSD NetBSD OpenBSD Haiku)'
|
||||||
|
|
|
@ -1273,8 +1273,8 @@ static float make_qkx2_quants(int n, int nmax, const float * restrict x, const f
|
||||||
float max = x[0];
|
float max = x[0];
|
||||||
float sum_w = weights[0];
|
float sum_w = weights[0];
|
||||||
float sum_x = sum_w * x[0];
|
float sum_x = sum_w * x[0];
|
||||||
#if defined(__APPLE__) && defined(__clang_major__) && __clang_major__ >= 15
|
#ifdef BUGGY_APPLE_LINKER
|
||||||
// use 'volatile' to prevent unroll and work around a bug in Apple clang 15.x.x with -O3 flag
|
// use 'volatile' to prevent unroll and work around a bug in Apple ld64 1015.7
|
||||||
for (volatile int i = 1; i < n; ++i) {
|
for (volatile int i = 1; i < n; ++i) {
|
||||||
#else
|
#else
|
||||||
for (int i = 1; i < n; ++i) {
|
for (int i = 1; i < n; ++i) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue