Skip to content

Commit defbeec

Browse files
sync: update submodule
1 parent 3e2d98b commit defbeec

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,71 @@ CMAKE_ARGS="-DCMAKE_C_COMPILER=/usr/local/musa/bin/clang -DCMAKE_CXX_COMPILER=/u
178178

179179
</details>
180180

181+
<!-- OpenCL -->
182+
<details>
183+
<summary>Using OpenCL (Adreno GPU)</summary>
184+
185+
Currently, it only supports Adreno GPUs and is primarily optimized for Q4_0 type.
186+
187+
To build for Windows ARM please refers to [Windows 11 Arm64](https://github.com/ggml-org/llama.cpp/blob/master/docs/backend/OPENCL.md#windows-11-arm64)
188+
189+
Building for Android:
190+
191+
Android NDK:
192+
193+
- Download and install the Android NDK from the [official Android developer site](https://developer.android.com/ndk/downloads).
194+
195+
Setup OpenCL Dependencies for NDK:
196+
You need to provide OpenCL headers and the ICD loader library to your NDK sysroot.
197+
198+
- OpenCL Headers:
199+
200+
```bash
201+
# In a temporary working directory
202+
git clone https://github.com/KhronosGroup/OpenCL-Headers
203+
cd OpenCL-Headers
204+
205+
# Replace <YOUR_NDK_PATH> with your actual NDK installation path
206+
# e.g., cp -r CL /path/to/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include
207+
sudo cp -r CL <YOUR_NDK_PATH>/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include
208+
cd ..
209+
```
210+
211+
- OpenCL ICD Loader:
212+
213+
```bash
214+
# In the same temporary working directory
215+
git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
216+
cd OpenCL-ICD-Loader
217+
mkdir build_ndk && cd build_ndk
218+
219+
# Replace <YOUR_NDK_PATH> in the CMAKE_TOOLCHAIN_FILE and OPENCL_ICD_LOADER_HEADERS_DIR
220+
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release \
221+
-DCMAKE_TOOLCHAIN_FILE=<YOUR_NDK_PATH>/build/cmake/android.toolchain.cmake \
222+
-DOPENCL_ICD_LOADER_HEADERS_DIR=<YOUR_NDK_PATH>/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include \
223+
-DANDROID_ABI=arm64-v8a \
224+
-DANDROID_PLATFORM=24 \
225+
-DANDROID_STL=c++_shared
226+
227+
ninja
228+
# Replace <YOUR_NDK_PATH>
229+
# e.g., cp libOpenCL.so /path/to/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android
230+
sudo cp libOpenCL.so <YOUR_NDK_PATH>/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android
231+
cd ../..
232+
```
233+
234+
Build `stable-diffusion-cpp-python` for Android with (untested):
235+
236+
```bash
237+
# Replace <YOUR_NDK_PATH> with your actual NDK installation path
238+
# e.g., -DCMAKE_TOOLCHAIN_FILE=/path/to/android-ndk-r26c/build/cmake/android.toolchain.cmake
239+
CMAKE_ARGS="-G Ninja -DCMAKE_TOOLCHAIN_FILE=<YOUR_NDK_PATH>/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-28 -DGGML_OPENMP=OFF -DSD_OPENCL=ON
240+
```
241+
242+
_(Note: Don't forget to include `LD_LIBRARY_PATH=/vendor/lib64` in your command line before running the binary)_
243+
244+
</details>
245+
181246
### Upgrading and Reinstalling
182247
183248
To upgrade and rebuild `stable-diffusion-cpp-python` add `--upgrade --force-reinstall --no-cache-dir` flags to the `pip install` command to ensure the package is rebuilt from source.

stable_diffusion_cpp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
# isort: on
66

7-
__version__ = "0.2.8"
7+
__version__ = "0.2.9"

0 commit comments

Comments
 (0)