Closed ueqri closed 2 years ago
According to HIP API docs, hipMallocPitch and related hipMemcpy2D are fully supported by HIP.
hipMallocPitch
hipMemcpy2D
But when I build the HIP codes with HIP-CPU, the errors occur on hipMallocPitch and hipMemcpy2D, which are not declared in HIP-CPU runtime library.
The minimal code is here:
#include <hip/hip_runtime_api.h> int main() { int row = 10, col = 10; float h_ptr[row][col]; float *d_ptr; size_t pitch; hipMallocPitch(&d_ptr, &pitch, col*sizeof(float), row); hipMemcpy2D(d_ptr, pitch, h_ptr, col*sizeof(float), col*sizeof(float), row, hipMemcpyHostToDevice); return 0; }
After looking through the src/include/hip/detail/api.hpp & include/hip/hip_api.h, I found hipMemcpy2DAsync is the only implemented function related to the problem.
hipMemcpy2DAsync
Since we could use the trivial way to implement those pitched memory in CPU simulation, could we just add the wrap for hipMallocPitch and hipMemcpy2D in HIP-CPU to avoid compiler errors? I'd be glad to contribute for this.
Thank you for the patch!
According to HIP API docs,
hipMallocPitch
and relatedhipMemcpy2D
are fully supported by HIP.But when I build the HIP codes with HIP-CPU, the errors occur on
hipMallocPitch
andhipMemcpy2D
, which are not declared in HIP-CPU runtime library.The minimal code is here:
After looking through the src/include/hip/detail/api.hpp & include/hip/hip_api.h, I found
hipMemcpy2DAsync
is the only implemented function related to the problem.Since we could use the trivial way to implement those pitched memory in CPU simulation, could we just add the wrap for
hipMallocPitch
andhipMemcpy2D
in HIP-CPU to avoid compiler errors? I'd be glad to contribute for this.