HIP
HIP copied to clipboard
ambiguous operator *= with hipFloatComplex
Tested with ROCm 5.2.
> hipcc --version
HIP version: 5.2.21151-afdc89f8
AMD clang version 14.0.0 (https://github.com/RadeonOpenCompute/llvm-project roc-5.2.0 22204 50d6d5d5b608d2abd6af44314abc6ad20036af3b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/rocm-5.2.0/llvm/bin
Reproducer:
// File complex.hip.cc
#include <hip/hip_runtime.h>
#include <hip/hip_complex.h>
__global__
void kernel( hipFloatComplex x, hipFloatComplex y )
{
// This next line produces a compile error,
// because hipFloatComplex is simply a typedef of HIP_vector_type.
x *= y;
// This works.
x = x * y;
}
void driver( hipFloatComplex x, hipFloatComplex y, hipStream_t stream )
{
hipLaunchKernelGGL( kernel, dim3(1), dim3(1), 0, stream, x, y );
}
int main( int argc, char** argv )
{
hipFloatComplex x, y;
hipStream_t stream;
driver( x, y, stream );
return 0;
}
Compile error:
> hipcc -o complex complex.hip.cc
complex.hip.cc:9:7: error: use of overloaded operator '*=' is ambiguous (with operand types 'hipFloatComplex' (aka 'HIP_vector_type<float, 2>') and 'hipFloatComplex')
x *= y;
~ ^ ~
/opt/rocm/include/hip/amd_detail/amd_hip_vector_types.h:838:26: note: candidate function
HIP_vector_type& operator*=(const HIP_vector_type& x) noexcept
^
/opt/rocm/include/hip/amd_detail/amd_hip_complex.h:236:1: note: candidate function
COMPLEX_MUL_PREOP_OVERLOAD(hipFloatComplex)
^
/opt/rocm/include/hip/amd_detail/amd_hip_complex.h:110:41: note: expanded from macro 'COMPLEX_MUL_PREOP_OVERLOAD'
__HOST_DEVICE__ static inline type& operator*=(type& lhs, const type& rhs) { \
^
1 error generated when compiling for gfx90a.