Skip to content

Commit a6b9535

Browse files
committed
Merge branch 'master' of https://github.com/ggerganov/llama.cpp into pr-3296
2 parents 45aa01e + f5ef5cf commit a6b9535

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+11415
-4136
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ jobs:
3838
- name: Build
3939
id: make_build
4040
run: |
41-
CC=gcc-8 make
41+
CC=gcc-8 make -j $(nproc)
4242
4343
- name: Test
4444
id: make_test
4545
run: |
46-
CC=gcc-8 make tests
47-
make test
46+
CC=gcc-8 make tests -j $(nproc)
47+
make test -j $(nproc)
4848
4949
ubuntu-latest-cmake:
5050
runs-on: ubuntu-latest
@@ -66,7 +66,7 @@ jobs:
6666
mkdir build
6767
cd build
6868
cmake ..
69-
cmake --build . --config Release
69+
cmake --build . --config Release -j $(nproc)
7070
7171
- name: Test
7272
id: cmake_test
@@ -101,7 +101,7 @@ jobs:
101101
mkdir build
102102
cd build
103103
cmake .. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
104-
cmake --build . --config ${{ matrix.build_type }}
104+
cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
105105
106106
- name: Test
107107
id: cmake_test
@@ -135,7 +135,7 @@ jobs:
135135
mkdir build
136136
cd build
137137
cmake -DLLAMA_MPI=ON ..
138-
cmake --build . --config Release
138+
cmake --build . --config Release -j $(nproc)
139139
140140
- name: Test
141141
id: cmake_test
@@ -160,13 +160,13 @@ jobs:
160160
- name: Build
161161
id: make_build
162162
run: |
163-
make
163+
make -j $(sysctl -n hw.logicalcpu)
164164
165165
- name: Test
166166
id: make_test
167167
run: |
168-
make tests
169-
make test
168+
make tests -j $(sysctl -n hw.logicalcpu)
169+
make test -j $(sysctl -n hw.logicalcpu)
170170
171171
macOS-latest-cmake:
172172
runs-on: macos-latest
@@ -189,7 +189,7 @@ jobs:
189189
mkdir build
190190
cd build
191191
cmake -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF ..
192-
cmake --build . --config Release
192+
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
193193
194194
- name: Test
195195
id: cmake_test
@@ -223,7 +223,7 @@ jobs:
223223
-DLLAMA_BUILD_SERVER=OFF \
224224
-DCMAKE_SYSTEM_NAME=iOS \
225225
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0
226-
cmake --build . --config Release
226+
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
227227
228228
macOS-latest-cmake-tvos:
229229
runs-on: macos-latest
@@ -251,7 +251,7 @@ jobs:
251251
-DLLAMA_BUILD_SERVER=OFF \
252252
-DCMAKE_SYSTEM_NAME=tvOS \
253253
-DCMAKE_OSX_DEPLOYMENT_TARGET=14.0
254-
cmake --build . --config Release
254+
cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
255255
256256
windows-latest-cmake:
257257
runs-on: windows-latest
@@ -324,7 +324,7 @@ jobs:
324324
mkdir build
325325
cd build
326326
cmake .. ${{ matrix.defines }}
327-
cmake --build . --config Release
327+
cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
328328
329329
- name: Add clblast.dll
330330
id: add_clblast_dll
@@ -415,7 +415,7 @@ jobs:
415415
mkdir build
416416
cd build
417417
cmake .. -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON -DBUILD_SHARED_LIBS=ON
418-
cmake --build . --config Release
418+
cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
419419
420420
- name: Determine tag name
421421
id: tag
@@ -457,22 +457,22 @@ jobs:
457457
path: |
458458
cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
459459
460-
freeBSD-latest:
461-
runs-on: macos-12
462-
steps:
463-
- name: Clone
464-
uses: actions/checkout@v3
465-
466-
- name: Build
467-
uses: cross-platform-actions/[email protected]
468-
with:
469-
operating_system: freebsd
470-
version: '13.2'
471-
hypervisor: 'qemu'
472-
run: |
473-
sudo pkg update
474-
sudo pkg install -y gmake automake autoconf pkgconf llvm15 clinfo clover opencl clblast openblas
475-
gmake CC=/usr/local/bin/clang15 CXX=/usr/local/bin/clang++15
460+
# freeBSD-latest:
461+
# runs-on: macos-12
462+
# steps:
463+
# - name: Clone
464+
# uses: actions/checkout@v3
465+
#
466+
# - name: Build
467+
# uses: cross-platform-actions/[email protected]
468+
# with:
469+
# operating_system: freebsd
470+
# version: '13.2'
471+
# hypervisor: 'qemu'
472+
# run: |
473+
# sudo pkg update
474+
# sudo pkg install -y gmake automake autoconf pkgconf llvm15 clinfo clover opencl clblast openblas
475+
# gmake CC=/usr/local/bin/clang15 CXX=/usr/local/bin/clang++15 -j `sysctl -n hw.ncpu`
476476

477477
release:
478478
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,18 @@ models-mnt
4646
/main
4747
/metal
4848
/perplexity
49+
/q8dot
4950
/quantize
5051
/quantize-stats
5152
/result
5253
/save-load-state
5354
/server
5455
/simple
56+
/batched
57+
/export-lora
58+
/finetune
5559
/speculative
60+
/parallel
5661
/train-text-from-scratch
5762
/vdot
5863
build-info.h

CMakeLists.txt

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
118118
add_custom_command(
119119
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/build-info.h"
120120
COMMENT "Generating build details from Git"
121-
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_SOURCE_DIR}/scripts/build-info.cmake"
121+
COMMAND ${CMAKE_COMMAND} -DMSVC=${MSVC} -DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION} -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} -DCMAKE_VS_PLATFORM_NAME=${CMAKE_VS_PLATFORM_NAME} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -P "${CMAKE_CURRENT_SOURCE_DIR}/scripts/build-info.cmake"
122122
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
123123
DEPENDS "${GIT_DIR}/index"
124124
VERBATIM
@@ -162,6 +162,8 @@ if (APPLE AND LLAMA_ACCELERATE)
162162
message(STATUS "Accelerate framework found")
163163

164164
add_compile_definitions(GGML_USE_ACCELERATE)
165+
add_compile_definitions(ACCELERATE_NEW_LAPACK)
166+
add_compile_definitions(ACCELERATE_LAPACK_ILP64)
165167
set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} ${ACCELERATE_FRAMEWORK})
166168
else()
167169
message(WARNING "Accelerate framework not found")
@@ -412,37 +414,38 @@ endif()
412414

413415
if (LLAMA_ALL_WARNINGS)
414416
if (NOT MSVC)
415-
set(c_flags
416-
-Wall
417-
-Wextra
418-
-Wpedantic
419-
-Wcast-qual
420-
-Wdouble-promotion
421-
-Wshadow
422-
-Wstrict-prototypes
423-
-Wpointer-arith
424-
-Wmissing-prototypes
425-
-Werror=implicit-int
426-
-Wno-unused-function
427-
)
428-
set(cxx_flags
429-
-Wall
430-
-Wextra
431-
-Wpedantic
432-
-Wcast-qual
433-
-Wmissing-declarations
434-
-Wno-unused-function
435-
-Wno-multichar
436-
)
437-
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
438-
# g++ only
439-
set(cxx_flags ${cxx_flags} -Wno-format-truncation -Wno-array-bounds)
417+
set(warning_flags -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function)
418+
set(c_flags -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int
419+
-Werror=implicit-function-declaration)
420+
set(cxx_flags -Wmissing-declarations -Wmissing-noreturn)
421+
422+
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
423+
set(warning_flags ${warning_flags} -Wunreachable-code-break -Wunreachable-code-return)
424+
set(cxx_flags ${cxx_flags} -Wmissing-prototypes -Wextra-semi)
425+
426+
if (
427+
(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.8.0) OR
428+
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 7.3.0)
429+
)
430+
set(c_flags ${c_flags} -Wdouble-promotion)
431+
endif()
432+
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
433+
set(c_flags ${c_flags} -Wdouble-promotion)
434+
set(cxx_flags ${cxx_flags} -Wno-array-bounds)
435+
436+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.1.0)
437+
set(cxx_flags ${cxx_flags} -Wno-format-truncation)
438+
endif()
439+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1.0)
440+
set(cxx_flags ${cxx_flags} -Wextra-semi)
441+
endif()
440442
endif()
441443
else()
442444
# todo : msvc
443445
endif()
444446

445447
add_compile_options(
448+
${warning_flags}
446449
"$<$<COMPILE_LANGUAGE:C>:${c_flags}>"
447450
"$<$<COMPILE_LANGUAGE:CXX>:${cxx_flags}>"
448451
)

0 commit comments

Comments
 (0)