-
Notifications
You must be signed in to change notification settings - Fork 606
feat: support ggml backend select and enhance the build system #1368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Cyberhan123
wants to merge
61
commits into
leejet:master
Choose a base branch
from
Cyberhan123:ggml-new-backend
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 47 commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
b0545ab
Select backend devices via arg
stduhpf f89620c
fix build
stduhpf 61af83e
show backend device description
stduhpf c8ffbd3
CLI: add --list-devices arg
stduhpf 4e7bdb3
null-terminate even if buffer is too small
stduhpf 53d32a9
move stuff to ggml_extend.cpp
stduhpf 1800c9a
--upscaler-backend-device
stduhpf c1fc286
use diffusion_backend for loading LoRAs
stduhpf 9de5032
--photomaker-backend-device (+fixes)
stduhpf a85121f
--vision-backend-device
stduhpf 4d0b24f
check backends at runtime
ead7116
fix missing includes
4597013
fix typo
10763be
multiple clip backend devices
f3076ea
update help message
stduhpf a97a978
Add RPC documentation
stduhpf 20e6ba4
update docs
stduhpf 970304e
update RPC docs
stduhpf a792579
fix apply_loras_immediately when using different non-CPU backends
stduhpf 9e3229b
Force sequencial tensor loading when using RPC
stduhpf 61ed023
fix build
stduhpf 8fe2ccc
Get first stage backend for loading loras
stduhpf ae5b8ab
Fix lora loading when using multiple clip backends
stduhpf 229664d
rm all head code for ggml
Cyberhan123 e302ee5
feat: enhance the build system by adding CMake configuration and back…
Cyberhan123 83f7bab
fix review
Cyberhan123 1556395
format code
Cyberhan123 1428dc1
up date ci job
Cyberhan123 1cf3edc
fix vision_backend null
Cyberhan123 4e5471c
rm -j args
Cyberhan123 7783b32
test ci
Cyberhan123 3d392a1
fix: remove trailing backslashes in CMake commands
Cyberhan123 2579bb1
add cpu on
Cyberhan123 19bc8e2
add rpc and cpu on docker
Cyberhan123 3e07a2b
try fix ci
Cyberhan123 54f2762
add ggml-cpu.h
Cyberhan123 17db074
fix use cpu backend
Cyberhan123 7b5d14f
fix sycl docker build
Cyberhan123 755ee89
Add a Windows ROCm job to use tarball distribution of TheRock
superm1 dbea191
Update HIP target to use 26.Q1 (ROCm 7.1.1)
superm1 f246d83
update rocm new build
Cyberhan123 29576a3
sync and update rocm build
Cyberhan123 ef54ba4
fix and add ccache
Cyberhan123 1e23dd4
fix rocm build
Cyberhan123 5ff332b
fix rocm cache path
Cyberhan123 9f4fc8d
add ninja_job
Cyberhan123 355dcda
rm -j params
Cyberhan123 ca6c96d
fix cr
Cyberhan123 1a31a23
format code
Cyberhan123 e4d143b
fix version backend
Cyberhan123 8c8f2d0
format code
Cyberhan123 0527541
fix hard_code with SD_USE_VULKAN
Cyberhan123 64157ed
Merge branch 'master' into ggml-new-backend
Cyberhan123 717ef5e
format code
Cyberhan123 37891e9
Merge branch 'master' into ggml-new-backend
Cyberhan123 c4ad357
Merge branch 'master' into ggml-new-backend
Cyberhan123 55f8f3f
fix backend has loaded
Cyberhan123 6d6dfbf
feat: add free_sd_images function to manage memory for sd_image_t
Cyberhan123 20910d6
feat: add free_sd_image_data function to manage single image memory
Cyberhan123 28a2eea
Merge remote-tracking branch 'origin/master' into ggml-new-backend
Cyberhan123 80f5e21
refactor: remove unused backend options from CMakeLists.txt
Cyberhan123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| set(BUILD_NUMBER 0) | ||
| set(BUILD_COMMIT "unknown") | ||
| set(BUILD_COMPILER "unknown") | ||
| set(BUILD_TARGET "unknown") | ||
|
|
||
| # Look for git | ||
| find_package(Git) | ||
| if(NOT Git_FOUND) | ||
| find_program(GIT_EXECUTABLE NAMES git git.exe) | ||
| if(GIT_EXECUTABLE) | ||
| set(Git_FOUND TRUE) | ||
| message(STATUS "Found Git: ${GIT_EXECUTABLE}") | ||
| else() | ||
| message(WARNING "Git not found. Build info will not be accurate.") | ||
| endif() | ||
| endif() | ||
|
|
||
| # Get the commit count and hash | ||
| if(Git_FOUND) | ||
| execute_process( | ||
| COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD | ||
| WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
| OUTPUT_VARIABLE HEAD | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| RESULT_VARIABLE RES | ||
| ) | ||
| if (RES EQUAL 0) | ||
| set(BUILD_COMMIT ${HEAD}) | ||
| endif() | ||
| execute_process( | ||
| COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD | ||
| WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
| OUTPUT_VARIABLE COUNT | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| RESULT_VARIABLE RES | ||
| ) | ||
| if (RES EQUAL 0) | ||
| set(BUILD_NUMBER ${COUNT}) | ||
| endif() | ||
| endif() | ||
|
|
||
| set(BUILD_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") | ||
|
|
||
| if(CMAKE_VS_PLATFORM_NAME) | ||
| set(BUILD_TARGET ${CMAKE_VS_PLATFORM_NAME}) | ||
| else() | ||
| set(BUILD_TARGET "${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}") | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| include("ggml/cmake/common.cmake") | ||
|
|
||
| # https://github.com/ggml-org/llama.cpp/blob/master/cmake/common.cmake | ||
|
|
||
| function(sd_add_compile_flags) | ||
| if (SD_FATAL_WARNINGS) | ||
| if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| list(APPEND C_FLAGS -Werror) | ||
| list(APPEND CXX_FLAGS -Werror) | ||
| elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") | ||
| add_compile_options(/WX) | ||
| endif() | ||
| endif() | ||
|
|
||
| if (SD_ALL_WARNINGS) | ||
| if (NOT MSVC) | ||
| list(APPEND C_FLAGS -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes | ||
| -Werror=implicit-int -Werror=implicit-function-declaration) | ||
|
|
||
| list(APPEND CXX_FLAGS -Wmissing-declarations -Wmissing-noreturn) | ||
|
|
||
| list(APPEND WARNING_FLAGS -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function) | ||
|
|
||
| list(APPEND C_FLAGS ${WARNING_FLAGS}) | ||
| list(APPEND CXX_FLAGS ${WARNING_FLAGS}) | ||
|
|
||
| ggml_get_flags(${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}) | ||
|
|
||
| add_compile_options("$<$<COMPILE_LANGUAGE:C>:${C_FLAGS};${GF_C_FLAGS}>" | ||
| "$<$<COMPILE_LANGUAGE:CXX>:${CXX_FLAGS};${GF_CXX_FLAGS}>") | ||
| else() | ||
| # todo : msvc | ||
| set(C_FLAGS "" PARENT_SCOPE) | ||
| set(CXX_FLAGS "" PARENT_SCOPE) | ||
| endif() | ||
| endif() | ||
|
|
||
| if (NOT MSVC) | ||
| if (SD_SANITIZE_THREAD) | ||
| message(STATUS "Using -fsanitize=thread") | ||
|
|
||
| add_compile_options(-fsanitize=thread) | ||
| link_libraries (-fsanitize=thread) | ||
| endif() | ||
|
|
||
| if (SD_SANITIZE_ADDRESS) | ||
| message(STATUS "Using -fsanitize=address") | ||
|
|
||
| add_compile_options(-fsanitize=address -fno-omit-frame-pointer) | ||
| link_libraries (-fsanitize=address) | ||
| endif() | ||
|
|
||
| if (SD_SANITIZE_UNDEFINED) | ||
| message(STATUS "Using -fsanitize=undefined") | ||
|
|
||
| add_compile_options(-fsanitize=undefined) | ||
| link_libraries (-fsanitize=undefined) | ||
| endif() | ||
| endif() | ||
| endfunction() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.