Package: libamdhip64-dev Version: 5.7.1-6 Severity: important Tags: patch Dear Maintainer,
Newer versions of ggml fail to build from source with HIP <= 6.0, with linking failures such as the following: > /usr/bin/ld: CMakeFiles/ggml-hip.dir/__/ggml-cuda/add-id.cu.o: in function > `__float2bfloat16(float)': > /usr/include/hip/amd_detail/amd_hip_bf16.h:143: multiple definition of > `__float2bfloat16(float)'; > CMakeFiles/ggml-hip.dir/__/ggml-cuda/acc.cu.o:/usr/include/hip/amd_detail/amd_hip_bf16.h:143: > first defined here > /usr/bin/ld: CMakeFiles/ggml-hip.dir/__/ggml-cuda/add-id.cu.o: in function > `__bfloat162float(__hip_bfloat16)': > /usr/include/hip/amd_detail/amd_hip_bf16.h:125: multiple definition of > `__bfloat1622float2(__hip_bfloat162)'; > CMakeFiles/ggml-hip.dir/__/ggml-cuda/acc.cu.o:/usr/include/hip/amd_detail/amd_hip_bf16.h:125: > first defined here > ... According to upstream the upstream fix introduced in a later version [1], this is because the functions in the bf16 header need to static. Marking as important as it blocks the update of another package. The fix seems simple enough, I will submit a PR. > diff --git a/hipamd/include/hip/amd_detail/amd_hip_bf16.h > b/hipamd/include/hip/amd_detail/amd_hip_bf16.h > index 50b8a18..4e4a96e 100644 > --- a/hipamd/include/hip/amd_detail/amd_hip_bf16.h > +++ b/hipamd/include/hip/amd_detail/amd_hip_bf16.h > @@ -91,10 +91,10 @@ > #include "math_fwd.h" // ocml device functions > > #if defined(__HIPCC_RTC__) > -#define __HOST_DEVICE__ __device__ > +#define __HOST_DEVICE__ __device__ static > #else > #include <climits> > -#define __HOST_DEVICE__ __host__ __device__ > +#define __HOST_DEVICE__ __host__ __device__ static inline > #endif > > // Since we are using unsigned short to represent data in bfloat16, it can > be of different sizes on Best, Christian [1]: https://github.com/ROCm/clr/commit/77c581a3ebd47b5e2908973b70adea66891159ee

