leejet / stable-diffusion.cpp

Stable Diffusion and Flux in pure C/C++
MIT License
3.22k stars 272 forks source link

Linking failed when building with ROCM #320

Open stinkepetri opened 1 month ago

stinkepetri commented 1 month ago

Hello guys im trying to build with rocm support but it fails.

Build output:

mott@modesk2:~/Desktop/stable-diffusion.cpp/build$ cmake .. -G "Ninja" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSD_HIPBLAS=ON -DCMAKE_BUILD_TYPE=Release -DAMDGPU_TARGETS=gfx1030
-- The C compiler identification is Clang 14.0.0
-- The CXX compiler identification is Clang 14.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Use HIPBLAS as backend stable-diffusion
Build static library
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) 
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) 
CMake Warning at ggml/src/CMakeLists.txt:151 (message):
  OpenMP not found

-- The HIP compiler identification is Clang 17.0.0
-- Detecting HIP compiler ABI info
-- Detecting HIP compiler ABI info - done
-- Check for working HIP compiler: /opt/rocm-6.0.0/llvm/bin/clang++ - skipped
-- Detecting HIP compile features
-- Detecting HIP compile features - done
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS
-- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS - Failed
-- HIP and hipBLAS found
-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with GGML_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: x86_64
-- x86 detected
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mott/Desktop/stable-diffusion.cpp/build
mott@modesk2:~/Desktop/stable-diffusion.cpp/build$ cmake --build . --config Release
[29/77] Building HIP object ggml/src/CMakeFiles/ggml.dir/ggml-cuda/softmax.cu.o
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
static __global__ void soft_max_f32(const float * x, const T * mask, float * dst, const int ncols_par, const int nrows_y, const float scale, const float max_bias, const float m0, const float m1, uint32_t n_head_log2) {
                       ^
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda/softmax.cu:15:24: warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
12 warnings generated when compiling for gfx1030.
[31/77] Building CXX object CMakeFiles/stable-diffusion.dir/util.cpp.o
In file included from /home/mott/Desktop/stable-diffusion.cpp/util.cpp:29:
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:760:31: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(scale <= 1);
                        ~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:778:31: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(scale <= 1);
                        ~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1041:56: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(in_last_pixel - in_first_pixel <= (int)ceil(stbir__filter_info_table[filter].support(1/scale) * 2)); // Taken directly from stbir__get_coefficient_width() which we can't call because we don't know if we're horizontal or vertical.
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1046:41: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(contributor->n1 >= contributor->n0);
                        ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1064:128: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(stbir__filter_info_table[filter].kernel((float)(in_last_pixel + 1) + 0.5f - in_center_of_out, 1/scale) == 0);
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1066:38: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(total_filter > 0.9);
                        ~~~~~~~~~~~~ ^ ~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1067:38: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(total_filter < 1.1f); // Make sure it's not way off.
                        ~~~~~~~~~~~~ ^ ~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1089:59: warning: expression result unused [-Wunused-value]
     STBIR__DEBUG_ASSERT(out_last_pixel - out_first_pixel <= (int)ceil(stbir__filter_info_table[filter].support(scale_ratio) * 2)); // Taken directly from stbir__get_coefficient_width() which we can't call because we don't know if we're horizontal or vertical.
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1094:41: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(contributor->n1 >= contributor->n0);
                        ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1103:133: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(stbir__filter_info_table[filter].kernel((float)(out_last_pixel + 1) + 0.5f - out_center_of_in, scale_ratio) == 0);
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1138:35: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(total > 0.9f);
                            ~~~~~ ^ ~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1139:35: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(total < 1.1f);
                            ~~~~~ ^ ~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1427:47: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(ring_buffer_index != stbir_info->ring_buffer_begin_index);
                            ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1459:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n1 >= n0);
                            ~~ ^  ~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1460:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n0 >= -stbir_info->horizontal_filter_pixel_margin);
                            ~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1461:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n1 >= -stbir_info->horizontal_filter_pixel_margin);
                            ~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1462:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n0 < stbir_info->input_w + stbir_info->horizontal_filter_pixel_margin);
                            ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1463:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n1 < stbir_info->input_w + stbir_info->horizontal_filter_pixel_margin);
                            ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1471:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1480:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1490:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1501:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1514:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1537:25: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(!stbir__use_width_upsampling(stbir_info));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1555:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1576:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1598:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1621:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1646:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2005:25: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(!stbir__use_height_upsampling(stbir_info));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2079:66: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(in_last_scanline - in_first_scanline <= stbir_info->vertical_filter_pixel_width);
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2171:25: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(!stbir__use_height_upsampling(stbir_info));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2180:68: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(out_last_scanline - out_first_scanline <= stbir_info->vertical_filter_pixel_width);
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2382:92: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT((size_t)STBIR__NEXT_MEMPTR(info->encode_buffer, unsigned char) == (size_t)tempmem + tempmem_size_in_bytes);
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2390:90: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT((size_t)STBIR__NEXT_MEMPTR(info->ring_buffer, unsigned char) == (size_t)tempmem + tempmem_size_in_bytes);
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 warnings generated.
[34/77] Building HIP object ggml/src/CMakeFiles/ggml.dir/ggml-cuda.cu.o
In file included from /home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda.cu:1:
In file included from /home/mott/Desktop/stable-diffusion.cpp/ggml/src/../include/ggml-cuda.h:3:
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/../include/ggml.h:580:12: warning: 'backend' is deprecated: use the buffer type to find the storage location of the tensor [-Wdeprecated-declarations]
    struct ggml_tensor {
           ^
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda.cu:2022:28: note: in implicit copy constructor for 'ggml_tensor' first required here
    ggml_tensor src0_row = *src0;
                           ^
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/../include/ggml.h:583:9: note: 'backend' has been explicitly marked deprecated here
        GGML_DEPRECATED(enum ggml_backend_type backend, "use the buffer type to find the storage location of the tensor");
        ^
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/../include/ggml.h:202:61: note: expanded from macro 'GGML_DEPRECATED'
#    define GGML_DEPRECATED(func, hint) func __attribute__((deprecated(hint)))
                                                            ^
1 warning generated when compiling for gfx1030.
In file included from /home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda.cu:1:
In file included from /home/mott/Desktop/stable-diffusion.cpp/ggml/src/../include/ggml-cuda.h:3:
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/../include/ggml.h:580:12: warning: 'backend' is deprecated: use the buffer type to find the storage location of the tensor [-Wdeprecated-declarations]
    struct ggml_tensor {
           ^
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/ggml-cuda.cu:2022:28: note: in implicit copy constructor for 'ggml_tensor' first required here
    ggml_tensor src0_row = *src0;
                           ^
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/../include/ggml.h:583:9: note: 'backend' has been explicitly marked deprecated here
        GGML_DEPRECATED(enum ggml_backend_type backend, "use the buffer type to find the storage location of the tensor");
        ^
/home/mott/Desktop/stable-diffusion.cpp/ggml/src/../include/ggml.h:202:61: note: expanded from macro 'GGML_DEPRECATED'
#    define GGML_DEPRECATED(func, hint) func __attribute__((deprecated(hint)))
                                                            ^
1 warning generated when compiling for host.
[50/77] Building C object thirdparty/CMakeFiles/zip.dir/zip.c.o
In file included from /home/mott/Desktop/stable-diffusion.cpp/thirdparty/zip.c:40:
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/./miniz.h:4988:9: warning: Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files. [-W#pragma-messages]
#pragma message(                                                               \
        ^
1 warning generated.
[53/77] Building CXX object CMakeFiles/stable-diffusion.dir/stable-diffusion.cpp.o
In file included from /home/mott/Desktop/stable-diffusion.cpp/stable-diffusion.cpp:16:
/home/mott/Desktop/stable-diffusion.cpp/./tae.hpp:194:17: warning: field 'decode_only' is uninitialized when used here [-Wuninitialized]
          taesd(decode_only),
                ^
1 warning generated.
[55/77] Building CXX object examples/cli/CMakeFiles/sd.dir/main.cpp.o
In file included from /home/mott/Desktop/stable-diffusion.cpp/examples/cli/main.cpp:24:
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:760:31: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(scale <= 1);
                        ~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:778:31: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(scale <= 1);
                        ~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1041:56: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(in_last_pixel - in_first_pixel <= (int)ceil(stbir__filter_info_table[filter].support(1/scale) * 2)); // Taken directly from stbir__get_coefficient_width() which we can't call because we don't know if we're horizontal or vertical.
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1046:41: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(contributor->n1 >= contributor->n0);
                        ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1064:128: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(stbir__filter_info_table[filter].kernel((float)(in_last_pixel + 1) + 0.5f - in_center_of_out, 1/scale) == 0);
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1066:38: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(total_filter > 0.9);
                        ~~~~~~~~~~~~ ^ ~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1067:38: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(total_filter < 1.1f); // Make sure it's not way off.
                        ~~~~~~~~~~~~ ^ ~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1089:59: warning: expression result unused [-Wunused-value]
     STBIR__DEBUG_ASSERT(out_last_pixel - out_first_pixel <= (int)ceil(stbir__filter_info_table[filter].support(scale_ratio) * 2)); // Taken directly from stbir__get_coefficient_width() which we can't call because we don't know if we're horizontal or vertical.
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1094:41: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(contributor->n1 >= contributor->n0);
                        ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1103:133: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(stbir__filter_info_table[filter].kernel((float)(out_last_pixel + 1) + 0.5f - out_center_of_in, scale_ratio) == 0);
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1138:35: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(total > 0.9f);
                            ~~~~~ ^ ~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1139:35: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(total < 1.1f);
                            ~~~~~ ^ ~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1427:47: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(ring_buffer_index != stbir_info->ring_buffer_begin_index);
                            ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1459:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n1 >= n0);
                            ~~ ^  ~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1460:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n0 >= -stbir_info->horizontal_filter_pixel_margin);
                            ~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1461:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n1 >= -stbir_info->horizontal_filter_pixel_margin);
                            ~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1462:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n0 < stbir_info->input_w + stbir_info->horizontal_filter_pixel_margin);
                            ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1463:32: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(n1 < stbir_info->input_w + stbir_info->horizontal_filter_pixel_margin);
                            ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1471:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1480:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1490:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1501:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1514:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1537:25: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(!stbir__use_width_upsampling(stbir_info));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1555:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1576:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1598:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1621:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:1646:53: warning: expression result unused [-Wunused-value]
                    STBIR__DEBUG_ASSERT(coefficient != 0);
                                        ~~~~~~~~~~~ ^  ~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2005:25: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(!stbir__use_height_upsampling(stbir_info));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2079:66: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(in_last_scanline - in_first_scanline <= stbir_info->vertical_filter_pixel_width);
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2171:25: warning: expression result unused [-Wunused-value]
    STBIR__DEBUG_ASSERT(!stbir__use_height_upsampling(stbir_info));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2180:68: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT(out_last_scanline - out_first_scanline <= stbir_info->vertical_filter_pixel_width);
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2382:92: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT((size_t)STBIR__NEXT_MEMPTR(info->encode_buffer, unsigned char) == (size_t)tempmem + tempmem_size_in_bytes);
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mott/Desktop/stable-diffusion.cpp/thirdparty/stb_image_resize.h:2390:90: warning: expression result unused [-Wunused-value]
        STBIR__DEBUG_ASSERT((size_t)STBIR__NEXT_MEMPTR(info->ring_buffer, unsigned char) == (size_t)tempmem + tempmem_size_in_bytes);
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 warnings generated.
[77/77] Linking CXX executable bin/sd
FAILED: bin/sd 
: && /usr/bin/clang++ -O3 -DNDEBUG  examples/cli/CMakeFiles/sd.dir/main.cpp.o -o bin/sd  -Wl,-rpath,/opt/rocm-6.0.0/lib:/opt/rocm/lib:  libstable-diffusion.a  ggml/src/libggml.a  /opt/rocm-6.0.0/lib/libhipblas.so.2.0.60000  /opt/rocm-6.0.0/lib/librocblas.so.4.0.60000  /opt/rocm/lib/libamdhip64.so.6.0.60000  /usr/lib/llvm-14/lib/clang/14.0.0/lib/linux/libclang_rt.builtins-x86_64.a  -lm  /opt/rocm-6.0.0/lib/libamdhip64.so.6.0.60000 && :
/usr/bin/ld: ggml/src/libggml.a(ggml-cuda.cu.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

my ROCm config :



HIP version  : 6.0.32830-d62f6a171

== hipconfig
HIP_PATH     : /opt/rocm-6.0.0
ROCM_PATH    : /opt/rocm-6.0.0
HIP_COMPILER : clang
HIP_PLATFORM : amd
HIP_RUNTIME  : rocclr
CPP_CONFIG   :  -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__= -I/opt/rocm-6.0.0/include -I/opt/rocm-6.0.0/lib/llvm/lib/clang/17.0.0

== hip-clang
HIP_CLANG_PATH   : /opt/rocm-6.0.0/llvm/bin
AMD clang version 17.0.0 (https://github.com/RadeonOpenCompute/llvm-project roc-6.0.0 23483 7208e8d15fbf218deb74483ea8c549c67ca4985e)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm-6.0.0/llvm/bin
Configuration file: /opt/rocm-6.0.0/lib/llvm/bin/clang++.cfg
AMD LLVM version 17.0.0git
  Optimized build.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: znver2

  Registered Targets:
    amdgcn - AMD GCN GPUs
    r600   - AMD GPUs HD2XXX-HD6XXX
    x86    - 32-bit X86: Pentium-Pro and above
    x86-64 - 64-bit X86: EM64T and AMD64
hip-clang-cxxflags :  -isystem "/opt/rocm-6.0.0/include" -O3
hip-clang-ldflags  : --driver-mode=g++ -O3 --hip-link --rtlib=compiler-rt -unwindlib=libgcc

=== Environment Variables
PATH=/home/mott/miniconda3/condabin:/home/mott/.nvm/versions/node/v20.11.1/bin:/home/mott/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

== Linux Kernel
Hostname     : modesk2
Linux modesk2 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:    22.04
Codename:   jammy

``
newfla commented 1 month ago

Specifying -DSD_BUILD_SHARED_LIBS=ON worked for me