SWDEV-437817 - Fix hipMemCpy2D case that erroneously fails with invalid argument error

When an offset is applied to the source or destination pointers plus the kind is set to
hipMemcpyDefault and the source or destination is allocated with hipMallocManaged
hipMemCpy2D erroneously fails with hipErrorInvalidValue.

Change-Id: I0db4c17514f743652d8f9a2691da6601a2abb2a1


[ROCm/clr commit: d3bfb55d7a]
Этот коммит содержится в:
Ioannis Assiouras
2023-12-17 22:56:11 +00:00
родитель 5355857116
Коммит e51c2f6097
+2 -2
Просмотреть файл
@@ -2149,13 +2149,13 @@ void ihipCopyMemParamSet(const HIP_MEMCPY3D* pCopy, hipMemoryType& srcMemType,
memObj->getMemFlags()) ? hipMemoryTypeHost : hipMemoryTypeDevice;
} else {
srcMemoryType = hipMemoryTypeHost;
const_cast<HIP_MEMCPY3D*>(pCopy)->srcXInBytes += offset;
}
if (srcMemoryType == hipMemoryTypeHost) {
// {src/dst}Host may be unitialized. Copy over {src/dst}Device into it if we
// detect system memory.
const_cast<HIP_MEMCPY3D*>(pCopy)->srcHost = pCopy->srcDevice;
const_cast<HIP_MEMCPY3D*>(pCopy)->srcXInBytes += offset;
// We don't need detect memory type again for hipMemoryTypeUnified
const_cast<HIP_MEMCPY3D*>(pCopy)->srcMemoryType = srcMemoryType;
}
@@ -2169,11 +2169,11 @@ void ihipCopyMemParamSet(const HIP_MEMCPY3D* pCopy, hipMemoryType& srcMemType,
memObj->getMemFlags()) ? hipMemoryTypeHost : hipMemoryTypeDevice;
} else {
dstMemoryType = hipMemoryTypeHost;
const_cast<HIP_MEMCPY3D*>(pCopy)->dstXInBytes += offset;
}
if (dstMemoryType == hipMemoryTypeHost) {
const_cast<HIP_MEMCPY3D*>(pCopy)->dstHost = pCopy->dstDevice;
const_cast<HIP_MEMCPY3D*>(pCopy)->dstXInBytes += offset;
// We don't need detect memory type again for hipMemoryTypeUnified
const_cast<HIP_MEMCPY3D*>(pCopy)->dstMemoryType = dstMemoryType;
}