ROCm/hipBLAS

hipBLAS's complex number definition causes compilation failures

cadebrown opened this issue · 3 comments

What is the expected behavior

  • hipBLAS doesn't redefine HIP complex number implementation, and simply uses hip_complex.h to provide hipFloatComplex & hipDoubleComplex

What actually happens

  • hipBLAS redefines HIP complex number definitions in a contradictory way which causes compilation failures

How to reproduce

  • Simply include hipblas.h and hip/hip_complex.h in any project:
/// test.cpp
#include <hipblas.h>
#include <hip/hip_complex.h>

hipcc test.cpp errors

Environment

Software version
HCC 3.0.19493-75ea952e-40756364719e

Why does the hipBLAS library define complex numbers in a way which is incompatible with the rest of HIP?

There are far too many errors for even an example program. The first error is:

/opt/rocm/include/hipblas.h:53:36: error: typedef redefinition with different types ('hip_complex_number<float>' vs 'hipFloatComplex' (aka 'HIP_vector_type<float, 2>'))
typedef hip_complex_number<float>  hipComplex;
                                   ^
/opt/rocm/hip/include/hip/hcc_detail/hip_complex.h:269:25: note: previous definition is here
typedef hipFloatComplex hipComplex;
                        ^

It seems the lines are: https://github.com/ROCmSoftwarePlatform/hipBLAS/tree/develop/library/include#L53

Is there a reason why hipBLAS could not use the HIP standard complex number definition? Or is there some workaround to be able to use both at the same time?

This also tripped me up.

Had the same problem, had to resort to reinterpret_cast to be able to call HIP BLAS API with HIP complex numbers on HIP nvcc platform.

Fixed in #139