Closed momimi25 closed 4 months ago
@momimi25 Please read the code carefully, this modification is wrong
Because the logic of hip and cuda is shared in the code of this code repository.
Sorry for being early. In the code before the change, the following error occurred and the build stopped, so when I tried making the change, the build passed.
lld-link: error: undefined symbol: __declspec(dllimport) ggml_backend_cuda_init
>>> referenced by stable-diffusion.lib(stable-diffusion.cpp.obj):(public: bool __cdecl StableDiffusionGGML::load_from_file(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, bool, enum ggml_type, enum schedule_t, bool))
>>> referenced by stable-diffusion.lib(upscaler.cpp.obj):(public: bool __cdecl UpscalerGGML::load_from_file(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &))
CLANG_~1: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
I would like to review it, including how to use it, and if I find anything, I would like to raise an issue.
Sorry for being early. In the code before the change, the following error occurred and the build stopped, so when I tried making the change, the build passed.
lld-link: error: undefined symbol: __declspec(dllimport) ggml_backend_cuda_init >>> referenced by stable-diffusion.lib(stable-diffusion.cpp.obj):(public: bool __cdecl StableDiffusionGGML::load_from_file(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, bool, enum ggml_type, enum schedule_t, bool)) >>> referenced by stable-diffusion.lib(upscaler.cpp.obj):(public: bool __cdecl UpscalerGGML::load_from_file(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &)) CLANG_~1: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed.
I would like to review it, including how to use it, and if I find anything, I would like to raise an issue.
You can download the program built in the release, It's normal for me:
./sd -m C:\Users\11929\Desktop\stable-diffusion.cpp\models\miniSD.ckpt -p "a cat" -W 256 -H 256
ggml_init_cublas: GGML_CUDA_FORCE_MMQ: no
ggml_init_cublas: CUDA_USE_TENSOR_CORES: yes
ggml_init_cublas: found 1 ROCm devices:
Device 0: AMD Radeon RX 7900 XTX, compute capability 11.0, VMM: no
[INFO ] stable-diffusion.cpp:142 - loading model from 'C:\Users\11929\Desktop\stable-diffusion.cpp\models\miniSD.ckpt'
[INFO ] model.cpp:679 - load C:\Users\11929\Desktop\stable-diffusion.cpp\models\miniSD.ckpt using checkpoint format
[INFO ] stable-diffusion.cpp:164 - Stable Diffusion 1.x
[INFO ] stable-diffusion.cpp:170 - Stable Diffusion weight type: f32
[INFO ] stable-diffusion.cpp:306 - total params memory size = 1408.32MB (clip 469.44MB, unet 2155.33MB, vae 94.47MB, controlnet 0.00MB)
[INFO ] stable-diffusion.cpp:310 - loading model from 'C:\Users\11929\Desktop\stable-diffusion.cpp\models\miniSD.ckpt' completed, taking 10.50s
[INFO ] stable-diffusion.cpp:327 - running in eps-prediction mode
[INFO ] stable-diffusion.cpp:1356 - apply_loras completed, taking 0.00s
[INFO ] stable-diffusion.cpp:1395 - get_learned_condition completed, taking 59 ms
[INFO ] stable-diffusion.cpp:1411 - sampling using Euler A method
[INFO ] stable-diffusion.cpp:1415 - generating image: 1/1 - seed 42
|==================================================| 20/20 - 11.01it/s
[INFO ] stable-diffusion.cpp:1441 - sampling completed, taking 1.91s
[INFO ] stable-diffusion.cpp:1449 - generating 1 latent images completed, taking 1.93s
[INFO ] stable-diffusion.cpp:1451 - decoding 1 latents
[INFO ] stable-diffusion.cpp:1461 - latent 1 decoded, taking 0.14s
[INFO ] stable-diffusion.cpp:1465 - decode_first_stage completed, taking 0.14s
[INFO ] stable-diffusion.cpp:1484 - txt2img completed in 2.14s
save result image to 'output.png'
The build failed when SD_HIPBLAS=ON, so I modified the definition.