leejet / stable-diffusion.cpp

Stable Diffusion in pure C/C++
MIT License
2.91k stars 233 forks source link

HIP build failing #181

Closed daniandtheweb closed 4 months ago

daniandtheweb commented 4 months ago

Starting from today's commits the build fails when trying to use HIP.

In file included from /home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/stable-diffusion.cpp:1:
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/./ggml_extend.hpp:693:12: error: use of undeclared identifier 'ggml_timestep_embedding'; did you mean 'ggml_nn_timestep_embedding'?
    return ggml_timestep_embedding(ctx, timesteps, dim, max_period);
           ^~~~~~~~~~~~~~~~~~~~~~~
           ggml_nn_timestep_embedding
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/./ggml_extend.hpp:688:39: note: 'ggml_nn_timestep_embedding' declared here
__STATIC_INLINE__ struct ggml_tensor* ggml_nn_timestep_embedding(
                                      ^
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/./ggml_extend.hpp:763:26: error: no matching function for call to 'ggml_gallocr_new'
        compute_allocr = ggml_gallocr_new(ggml_backend_get_default_buffer_type(backend));
                         ^~~~~~~~~~~~~~~~
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/ggml/src/../include/ggml/ggml-alloc.h:71:25: note: candidate function not viable: requires 0 arguments, but 1 was provided
GGML_API ggml_gallocr_t ggml_gallocr_new(void);
                        ^
In file included from /home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/stable-diffusion.cpp:1:
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/./ggml_extend.hpp:765:14: error: use of undeclared identifier 'ggml_gallocr_reserve'
        if (!ggml_gallocr_reserve(compute_allocr, gf)) {
             ^
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/./ggml_extend.hpp:773:38: error: use of undeclared identifier 'ggml_gallocr_get_buffer_size'
        size_t compute_buffer_size = ggml_gallocr_get_buffer_size(compute_allocr, 0);
                                     ^
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/./ggml_extend.hpp:869:21: error: no matching function for call to 'ggml_gallocr_alloc_graph'
        GGML_ASSERT(ggml_gallocr_alloc_graph(compute_allocr, gf));
                    ^~~~~~~~~~~~~~~~~~~~~~~~
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/ggml/src/../include/ggml/ggml.h:248:15: note: expanded from macro 'GGML_ASSERT'
        if (!(x)) { \
              ^
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/ggml/src/../include/ggml/ggml-alloc.h:75:17: note: candidate function not viable: requires 3 arguments, but 2 were provided
GGML_API size_t ggml_gallocr_alloc_graph(ggml_gallocr_t galloc, ggml_tallocr_t talloc, struct ggml_cgraph * graph);
                ^
In file included from /home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/stable-diffusion.cpp:14:
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/./tae.hpp:194:17: warning: field 'decode_only' is uninitialized when used here [-Wuninitialized]
          taesd(decode_only),
                ^
In file included from /home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/stable-diffusion.cpp:15:
/home/daniandtheweb/Applications/stable-diffusion/stable-diffusion.cpp/./unet.hpp:114:27: error: use of undeclared identifier 'ggml_arange'
        auto num_frames = ggml_arange(ctx, 0, timesteps, 1);
                          ^
1 warning and 6 errors generated when compiling for gfx1010.
gmake[2]: *** [CMakeFiles/stable-diffusion.dir/build.make:76: CMakeFiles/stable-diffusion.dir/stable-diffusion.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:170: CMakeFiles/stable-diffusion.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
leejet commented 4 months ago

It seems that your ggml is not up to date because the submodule URL has changed. Try executing the following command to update it.

git submodule sync
git submodule update
daniandtheweb commented 4 months ago

Thanks, now the build works correctly. I'm not used to submodules so I still forget to update them at times.