Use main ggml repo (#45)
This commit is contained in:
parent
1198892888
commit
06dac0f80d
|
@ -76,7 +76,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DBUILD_SHARED_LIBS=ON ..
|
cmake ..
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
|
@ -135,7 +135,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DBUILD_SHARED_LIBS=ON -DRWKV_AVX2=OFF -DRWKV_FMA=OFF ..
|
cmake -DRWKV_AVX2=OFF -DRWKV_FMA=OFF ..
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
|
@ -197,7 +197,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake .. -DBUILD_SHARED_LIBS=ON ${{ matrix.defines }}
|
cmake .. ${{ matrix.defines }}
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
|
|
||||||
- name: Check AVX512F support
|
- name: Check AVX512F support
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[submodule "ggml"]
|
[submodule "ggml"]
|
||||||
path = ggml
|
path = ggml
|
||||||
url = https://github.com/saharNooby/ggml
|
url = https://github.com/ggerganov/ggml
|
||||||
branch = master-2023-04-29
|
branch = master
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.12) # Don't bump this version for no reason
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
project("rwkv.cpp" C CXX)
|
project("rwkv.cpp" C CXX)
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
@ -10,23 +11,12 @@ endif()
|
||||||
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
|
||||||
if (EMSCRIPTEN)
|
|
||||||
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
|
||||||
|
|
||||||
option(RWKV_WASM_SINGLE_FILE "rwkv: embed WASM inside the generated rwkv.js" ON)
|
|
||||||
else()
|
|
||||||
if (MINGW)
|
|
||||||
set(BUILD_SHARED_LIBS_DEFAULT OFF)
|
|
||||||
else()
|
|
||||||
set(BUILD_SHARED_LIBS_DEFAULT ON)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Option list
|
# Option list
|
||||||
#
|
#
|
||||||
|
|
||||||
# General
|
# General
|
||||||
|
option(RWKV_BUILD_SHARED_LIBRARY "rwkv: build as a shared library" ON)
|
||||||
option(RWKV_STATIC "rwkv: static link libraries" OFF)
|
option(RWKV_STATIC "rwkv: static link libraries" OFF)
|
||||||
option(RWKV_NATIVE "rwkv: enable -march=native flag" OFF)
|
option(RWKV_NATIVE "rwkv: enable -march=native flag" OFF)
|
||||||
option(RWKV_LTO "rwkv: enable link time optimization" OFF)
|
option(RWKV_LTO "rwkv: enable link time optimization" OFF)
|
||||||
|
@ -54,26 +44,25 @@ option(RWKV_OPENBLAS "rwkv: use OpenBLAS"
|
||||||
# Compile flags
|
# Compile flags
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED true)
|
set(CMAKE_CXX_STANDARD_REQUIRED true)
|
||||||
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED true)
|
set(CMAKE_C_STANDARD_REQUIRED true)
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
if (RWKV_SANITIZE_THREAD)
|
if (RWKV_SANITIZE_THREAD)
|
||||||
message(STATUS "Using RWKV_SANITIZE_THREAD")
|
|
||||||
add_compile_options(-fsanitize=thread)
|
add_compile_options(-fsanitize=thread)
|
||||||
link_libraries(-fsanitize=thread)
|
link_libraries(-fsanitize=thread)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (RWKV_SANITIZE_ADDRESS)
|
if (RWKV_SANITIZE_ADDRESS)
|
||||||
message(STATUS "Using RWKV_SANITIZE_ADDRESS")
|
|
||||||
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
||||||
link_libraries(-fsanitize=address)
|
link_libraries(-fsanitize=address)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (RWKV_SANITIZE_UNDEFINED)
|
if (RWKV_SANITIZE_UNDEFINED)
|
||||||
message(STATUS "Using RWKV_SANITIZE_UNDEFINED")
|
|
||||||
add_compile_options(-fsanitize=undefined)
|
add_compile_options(-fsanitize=undefined)
|
||||||
link_libraries(-fsanitize=undefined)
|
link_libraries(-fsanitize=undefined)
|
||||||
endif()
|
endif()
|
||||||
|
@ -127,6 +116,7 @@ if (RWKV_ALL_WARNINGS)
|
||||||
-Wpedantic
|
-Wpedantic
|
||||||
-Wcast-qual
|
-Wcast-qual
|
||||||
-Wno-unused-function
|
-Wno-unused-function
|
||||||
|
-Wno-multichar
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
# TODO [llama.cpp]: msvc
|
# TODO [llama.cpp]: msvc
|
||||||
|
@ -201,9 +191,7 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(x86_64|i686|AMD64)$")
|
||||||
endif()
|
endif()
|
||||||
if (RWKV_AVX512)
|
if (RWKV_AVX512)
|
||||||
add_compile_options(-mavx512f)
|
add_compile_options(-mavx512f)
|
||||||
# add_compile_options(-mavx512cd)
|
add_compile_options(-mavx512bw)
|
||||||
# add_compile_options(-mavx512dq)
|
|
||||||
# add_compile_options(-mavx512bw)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
@ -221,17 +209,21 @@ endif()
|
||||||
|
|
||||||
add_subdirectory(ggml)
|
add_subdirectory(ggml)
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (RWKV_BUILD_SHARED_LIBRARY)
|
||||||
set_target_properties(ggml PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
set_target_properties(ggml PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (RWKV_BUILD_SHARED_LIBRARY)
|
||||||
|
add_library(rwkv SHARED rwkv.cpp rwkv.h)
|
||||||
|
else()
|
||||||
add_library(rwkv rwkv.cpp rwkv.h)
|
add_library(rwkv rwkv.cpp rwkv.h)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(rwkv PUBLIC .)
|
target_include_directories(rwkv PUBLIC .)
|
||||||
target_compile_features(rwkv PUBLIC cxx_std_11) # Don't bump
|
target_compile_features(rwkv PUBLIC cxx_std_11)
|
||||||
target_link_libraries(rwkv PRIVATE ggml ${RWKV_EXTRA_LIBS})
|
target_link_libraries(rwkv PRIVATE ggml ${RWKV_EXTRA_LIBS})
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (RWKV_BUILD_SHARED_LIBRARY)
|
||||||
set_target_properties(rwkv PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
set_target_properties(rwkv PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||||
target_compile_definitions(rwkv PRIVATE RWKV_SHARED RWKV_BUILD)
|
target_compile_definitions(rwkv PRIVATE RWKV_SHARED RWKV_BUILD)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -55,7 +55,7 @@ On Windows: to check whether your CPU supports AVX2 or AVX-512, [use CPU-Z](http
|
||||||
**Requirements**: [CMake](https://cmake.org/download/) or [CMake from anaconda](https://anaconda.org/conda-forge/cmake), MSVC compiler.
|
**Requirements**: [CMake](https://cmake.org/download/) or [CMake from anaconda](https://anaconda.org/conda-forge/cmake), MSVC compiler.
|
||||||
|
|
||||||
```commandline
|
```commandline
|
||||||
cmake -DBUILD_SHARED_LIBS=ON .
|
cmake .
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ If everything went OK, `bin\Release\rwkv.dll` file should appear.
|
||||||
**Requirements**: CMake (Linux: `sudo apt install cmake`, MacOS: `brew install cmake`, anaconoda: [cmake package](https://anaconda.org/conda-forge/cmake)).
|
**Requirements**: CMake (Linux: `sudo apt install cmake`, MacOS: `brew install cmake`, anaconoda: [cmake package](https://anaconda.org/conda-forge/cmake)).
|
||||||
|
|
||||||
```commandline
|
```commandline
|
||||||
cmake -DBUILD_SHARED_LIBS=ON .
|
cmake .
|
||||||
cmake --build . --config Release
|
cmake --build . --config Release
|
||||||
```
|
```
|
||||||
|
|
||||||
**Anaconda & M1 users**: please verify that `CMAKE_SYSTEM_PROCESSOR: arm64` after running `cmake -DBUILD_SHARED_LIBS=ON .` — if it detects `x86_64`, edit the `CMakeLists.txt` file under the `# Compile flags` to add `set(CMAKE_SYSTEM_PROCESSOR "arm64")`.
|
**Anaconda & M1 users**: please verify that `CMAKE_SYSTEM_PROCESSOR: arm64` after running `cmake .` — if it detects `x86_64`, edit the `CMakeLists.txt` file under the `# Compile flags` to add `set(CMAKE_SYSTEM_PROCESSOR "arm64")`.
|
||||||
|
|
||||||
If everything went OK, `librwkv.so` (Linux) or `librwkv.dylib` (MacOS) file should appear in the base repo folder.
|
If everything went OK, `librwkv.so` (Linux) or `librwkv.dylib` (MacOS) file should appear in the base repo folder.
|
||||||
|
|
||||||
|
|
2
ggml
2
ggml
|
@ -1 +1 @@
|
||||||
Subproject commit a0687a3a3c4b31811219d7a61adfb66230b09201
|
Subproject commit b237714db49cc09b63a372aeb33ca83bc56b3977
|
Loading…
Reference in New Issue