MCPcopy Create free account
hub / github.com/ROCm/clr / hipMemcpy2DValidateArray

Function hipMemcpy2DValidateArray

hipamd/src/hip_memory.cpp:2453–2472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2451}
2452
2453hipError_t hipMemcpy2DValidateArray(hipArray_const_t arr, size_t wOffset, size_t hOffset,
2454 size_t width, size_t height) {
2455 if (arr == nullptr) {
2456 return hipErrorInvalidHandle;
2457 }
2458
2459 int FormatSize = hip::getElementSize(arr);
2460 if ((width + wOffset) > (arr->width * FormatSize)) {
2461 return hipErrorInvalidValue;
2462 }
2463 if (arr->height == 0) { // 1D hipArray
2464 if (height + hOffset > 1) {
2465 return hipErrorInvalidValue;
2466 }
2467 } else if ((height + hOffset) > (arr->height)) { // 2D hipArray
2468 return hipErrorInvalidValue;
2469 }
2470
2471 return hipSuccess;
2472}
2473
2474hipError_t hipMemcpy2D_common(void* dst, size_t dpitch, const void* src, size_t spitch,
2475 size_t width, size_t height, hipMemcpyKind kind,

Calls 1

getElementSizeFunction · 0.85

Tested by

no test coverage detected