Skip to content
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

Allow building ggml as a separate shared lib #468

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cmdr2
Copy link

@cmdr2 cmdr2 commented Nov 19, 2024

Hi, this PR allows the creation of two separate libs (e.g. ggml.dll and stable-diffusion.dll) via a build option (SD_BUILD_SHARED_GGML_LIB). By default, it continues to make a single shared lib (like it does today).

cmake -B build -DSD_BUILD_SHARED_LIBS=1 -DSD_BUILD_SHARED_GGML_LIB=1

This option is useful when distributing updates to programs that use sd.cpp internally. For e.g. when targeting CUDA, with this PR, new versions of stable-diffusion.cpp can be distributed with a 4 MB DLL update, instead of re-distributing 347 MB (that includes ggml with compiled ggml CUDA kernels).

ggml doesn't need to change frequently, so there isn't much point wasting bandwidth redistributing the entire static-ly built ggml (with cuda), each time stable-diffusion.dll needs to be updated.

I've tested this on Windows, Mac and Linux (Ubuntu).

Please let me know if this PR needs anything else, thanks!

@ItzCrazyKns
Copy link

+1

…ing to stable-diffusion.cpp as a static library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants