HIP icon indicating copy to clipboard operation
HIP copied to clipboard

Built-in vector types float2, float3 and float4 are not trivially copyable

Open dcampora opened this issue 2 years ago • 1 comments

float2, float3 and float4 are trivially copyable in CUDA, but they are not in HIP.

This results in the following piece of code working in CUDA, but failing in HIP:

static_assert(std::is_trivially_copyable_v<float2>);

It transitively applies to any class that uses such a data member as well.

dcampora avatar Apr 04 '22 10:04 dcampora

This seems due to the assignment operator and similar ones:

https://github.com/ROCm-Developer-Tools/hipamd/blob/rocm-5.1.x/include/hip/amd_detail/amd_hip_vector_types.h#L487

data is builtin vector type for clang and array type for GCC. It seems to me in either case the default assignment operator should work.

yxsamliu avatar Apr 04 '22 19:04 yxsamliu