Closed jakub-homola closed 1 year ago
The following example line of code
hipMalloc(&d_x, count * sizeof(float));
fails to compile (using g++ 9.4.0) with error
saxpy.hip.cpp:46:15: error: invalid conversion from ‘float**’ to ‘void**’ [-fpermissive] 46 | hipMalloc(&d_x, count * sizeof(float)); | ^~~~ | | | float**
I know the fix is to just cast the pointer,
hipMalloc((void**)&d_x, count * sizeof(float));
but who likes that? CUDA and HIP don't require the cast, so neither should HIP-CPU. In the classic HIP (include/hip_runtime_api.h right at the bottom in 4.3) there is the function
include/hip_runtime_api.h
template <class T> static inline hipError_t hipMalloc(T** devPtr, size_t size) { return hipMalloc((void**)devPtr, size); }
so please do something similar in HIP-CPU too, for all similar functions. If there are any cons to this, please explain or point me to an explanation.
Thanks, Jakub Homola
Edit: I am using the current HIP-CPU master branch, changelog says version 0.1.4142 from December 2020
The following example line of code
fails to compile (using g++ 9.4.0) with error
I know the fix is to just cast the pointer,
but who likes that? CUDA and HIP don't require the cast, so neither should HIP-CPU. In the classic HIP (
include/hip_runtime_api.h
right at the bottom in 4.3) there is the functionso please do something similar in HIP-CPU too, for all similar functions. If there are any cons to this, please explain or point me to an explanation.
Thanks, Jakub Homola
Edit: I am using the current HIP-CPU master branch, changelog says version 0.1.4142 from December 2020