mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-10 19:06:33 +00:00
perf: accelerate INT8 diffusion inference with CUDA fusions (#2235)
This commit is contained in:
1 parent
8cbe905fdd
commit
77b72a2efe
12 files changed
+113
-128
No files matched your search
+28
-4
@@ -2,18 +2,23 @@
|
||||
|
||||
## Get the Code
|
||||
|
||||
```
|
||||
```shell
|
||||
git clone --recursive https://github.com/leejet/stable-diffusion.cpp
|
||||
cd stable-diffusion.cpp
|
||||
```
|
||||
|
||||
- If you have already cloned the repository, you can use the following command to update the repository to the latest code.
|
||||
If you already cloned the repository without submodules, initialize them from the repository root:
|
||||
|
||||
```shell
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
To update an existing checkout and its submodules:
|
||||
|
||||
```shell
|
||||
cd stable-diffusion.cpp
|
||||
git pull origin master
|
||||
git submodule init
|
||||
git submodule update
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
## Selecting a GGML source tree
|
||||
@@ -102,6 +107,25 @@ cmake .. -DSD_CUDA=ON
|
||||
cmake --build . --config Release
|
||||
```
|
||||
|
||||
CUDA builds with the bundled patched GGML use the CUTLASS submodule by default
|
||||
for eligible INT8 GEMM and CuTe attention operations. If its headers are missing,
|
||||
CMake stops with an initialization hint; it does not download them automatically.
|
||||
Run `git submodule update --init --recursive` from the repository root before
|
||||
configuring.
|
||||
|
||||
To build with the existing CUDA implementations without CUTLASS, configure from
|
||||
the repository root with:
|
||||
|
||||
```shell
|
||||
cmake -S . -B build -DSD_CUDA=ON -DGGML_CUDA_CUTLASS_PATH:PATH=
|
||||
cmake --build build --config Release
|
||||
```
|
||||
|
||||
Alternatively, set `GGML_CUDA_CUTLASS_PATH` to another local CUTLASS source
|
||||
directory (tested with 3.9.2). Existing CMake caches retain their configured path;
|
||||
pass `-UGGML_CUDA_CUTLASS_PATH` when reconfiguring to restore the bundled default.
|
||||
Non-CUDA builds do not require CUTLASS.
|
||||
|
||||
## Build with HipBLAS
|
||||
|
||||
This provides GPU acceleration using AMD GPU. Make sure to have the ROCm toolkit installed.
|
||||
|
||||
+15
-1
@@ -18,12 +18,26 @@ docker run --rm --init -v /path/to/models:/models -v /path/to/output/:/output -p
|
||||
|
||||
## Building using Docker
|
||||
|
||||
Initialize the submodules from the repository root before building. Docker copies
|
||||
the local checkout, so its build context must include the submodule contents:
|
||||
|
||||
```shell
|
||||
git submodule update --init --recursive
|
||||
docker build -f docker/Dockerfile -t sd .
|
||||
```
|
||||
|
||||
## Building variants using Docker
|
||||
|
||||
### CUDA (NVIDIA GPU):
|
||||
|
||||
```shell
|
||||
docker build -f docker/Dockerfile.cuda -t sd-cuda .
|
||||
```
|
||||
|
||||
To select GPU architectures, pass `--build-arg "CUDA_ARCHITECTURES=89"` (for
|
||||
example, RTX 4090). Run the image on a host configured with NVIDIA Container
|
||||
Toolkit, using `docker run --rm --gpus all ... sd-cuda [args...]`.
|
||||
|
||||
### Vulkan:
|
||||
|
||||
```shell
|
||||
@@ -67,4 +81,4 @@ docker run --rm --device=/dev/dri --device=/dev/kfd --group-add video \
|
||||
# -v ./models:/models -v ./build:/output \
|
||||
# sd -m /models/sd-v1-4.ckpt -v -o /output/output.png \
|
||||
# -p "a lovely cat"
|
||||
```
|
||||
```
|
||||
Reference in new issue
Block a user