Skip to content

Commit dcf91f9

Browse files
committed
chore: change SD_CUBLAS/SD_USE_CUBLAS to SD_CUDA/SD_USE_CUDA
1 parent 348a54e commit dcf91f9

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ jobs:
163163
- build: "avx512"
164164
defines: "-DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON"
165165
- build: "cuda12"
166-
defines: "-DSD_CUBLAS=ON -DSD_BUILD_SHARED_LIBS=ON"
166+
defines: "-DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON"
167167
# - build: "rocm5.5"
168168
# defines: '-G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSD_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS="gfx1100;gfx1102;gfx1030" -DSD_BUILD_SHARED_LIBS=ON'
169169
- build: 'vulkan'

CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ endif()
2424
# general
2525
#option(SD_BUILD_TESTS "sd: build tests" ${SD_STANDALONE})
2626
option(SD_BUILD_EXAMPLES "sd: build examples" ${SD_STANDALONE})
27-
option(SD_CUBLAS "sd: cuda backend" OFF)
27+
option(SD_CUDA "sd: cuda backend" OFF)
2828
option(SD_HIPBLAS "sd: rocm backend" OFF)
2929
option(SD_METAL "sd: metal backend" OFF)
3030
option(SD_VULKAN "sd: vulkan backend" OFF)
@@ -34,10 +34,10 @@ option(SD_FAST_SOFTMAX "sd: x1.5 faster softmax, indeterministic (
3434
option(SD_BUILD_SHARED_LIBS "sd: build shared libs" OFF)
3535
#option(SD_BUILD_SERVER "sd: build server example" ON)
3636

37-
if(SD_CUBLAS)
38-
message("-- Use CUBLAS as backend stable-diffusion")
37+
if(SD_CUDA)
38+
message("-- Use CUDA as backend stable-diffusion")
3939
set(GGML_CUDA ON)
40-
add_definitions(-DSD_USE_CUBLAS)
40+
add_definitions(-DSD_USE_CUDA)
4141
endif()
4242

4343
if(SD_METAL)
@@ -55,7 +55,7 @@ endif ()
5555
if (SD_HIPBLAS)
5656
message("-- Use HIPBLAS as backend stable-diffusion")
5757
set(GGML_HIPBLAS ON)
58-
add_definitions(-DSD_USE_CUBLAS)
58+
add_definitions(-DSD_USE_CUDA)
5959
if(SD_FAST_SOFTMAX)
6060
set(GGML_CUDA_FAST_SOFTMAX ON)
6161
endif()

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ cmake .. -DGGML_OPENBLAS=ON
113113
cmake --build . --config Release
114114
```
115115
116-
##### Using CUBLAS
116+
##### Using CUDA
117117
118118
This provides BLAS acceleration using the CUDA cores of your Nvidia GPU. Make sure to have the CUDA toolkit installed. You can download it from your Linux distro's package manager (e.g. `apt install nvidia-cuda-toolkit`) or from here: [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads). Recommended to have at least 4 GB of VRAM.
119119
120120
```
121-
cmake .. -DSD_CUBLAS=ON
121+
cmake .. -DSD_CUDA=ON
122122
cmake --build . --config Release
123123
```
124124

ggml_extend.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
#include "model.h"
2929

30-
#ifdef SD_USE_CUBLAS
30+
#ifdef SD_USE_CUDA
3131
#include "ggml-cuda.h"
3232
#endif
3333

@@ -708,7 +708,7 @@ __STATIC_INLINE__ struct ggml_tensor* ggml_nn_attention(struct ggml_context* ctx
708708
struct ggml_tensor* k,
709709
struct ggml_tensor* v,
710710
bool mask = false) {
711-
#if defined(SD_USE_FLASH_ATTENTION) && !defined(SD_USE_CUBLAS) && !defined(SD_USE_METAL) && !defined(SD_USE_VULKAN) && !defined(SD_USE_SYCL)
711+
#if defined(SD_USE_FLASH_ATTENTION) && !defined(SD_USE_CUDA) && !defined(SD_USE_METAL) && !defined(SD_USE_VULKAN) && !defined(SD_USE_SYCL)
712712
struct ggml_tensor* kqv = ggml_flash_attn(ctx, q, k, v, false); // [N * n_head, n_token, d_head]
713713
#else
714714
float d_head = (float)q->ne[0];
@@ -864,7 +864,7 @@ __STATIC_INLINE__ struct ggml_tensor* ggml_nn_group_norm(struct ggml_context* ct
864864
}
865865

866866
__STATIC_INLINE__ void ggml_backend_tensor_get_and_sync(ggml_backend_t backend, const struct ggml_tensor* tensor, void* data, size_t offset, size_t size) {
867-
#if defined(SD_USE_CUBLAS) || defined(SD_USE_SYCL)
867+
#if defined(SD_USE_CUDA) || defined(SD_USE_SYCL)
868868
if (!ggml_backend_is_cpu(backend)) {
869869
ggml_backend_tensor_get_async(backend, tensor, data, offset, size);
870870
ggml_backend_synchronize(backend);

stable-diffusion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class StableDiffusionGGML {
159159
bool vae_on_cpu,
160160
bool diffusion_flash_attn) {
161161
use_tiny_autoencoder = taesd_path.size() > 0;
162-
#ifdef SD_USE_CUBLAS
162+
#ifdef SD_USE_CUDA
163163
LOG_DEBUG("Using CUDA backend");
164164
backend = ggml_backend_cuda_init(0);
165165
#endif

upscaler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct UpscalerGGML {
1515
}
1616

1717
bool load_from_file(const std::string& esrgan_path) {
18-
#ifdef SD_USE_CUBLAS
18+
#ifdef SD_USE_CUDA
1919
LOG_DEBUG("Using CUDA backend");
2020
backend = ggml_backend_cuda_init(0);
2121
#endif

0 commit comments

Comments
 (0)