SWDEV-272361 - Dont call memcpy2d if width is 0 or height or depth is 0

Change-Id: I22324a536d2a5e68b9fc3e5ee4ad821b49021a17
This commit is contained in:
Jatin Chaudhary
2021-02-11 06:47:32 -08:00
zatwierdzone przez Jatin Chaudhary
rodzic 564417d00f
commit ec832d42d1
2 zmienionych plików z 8 dodań i 2 usunięć
+1 -1
Wyświetl plik
@@ -590,7 +590,7 @@ HIP_MEMCPY3D getDrvMemcpy3DDesc(const hip_Memcpy2D& desc2D) {
desc3D.WidthInBytes = desc2D.WidthInBytes; desc3D.WidthInBytes = desc2D.WidthInBytes;
desc3D.Height = desc2D.Height; desc3D.Height = desc2D.Height;
desc3D.Depth = 0; desc3D.Depth = 1;
return desc3D; return desc3D;
} }
+7 -1
Wyświetl plik
@@ -1469,6 +1469,12 @@ hipError_t ihipMemcpyAtoH(hipArray* srcArray,
hipError_t ihipMemcpyParam3D(const HIP_MEMCPY3D* pCopy, hipError_t ihipMemcpyParam3D(const HIP_MEMCPY3D* pCopy,
hipStream_t stream, hipStream_t stream,
bool isAsync = false) { bool isAsync = false) {
if(pCopy->WidthInBytes == 0 || pCopy->Height == 0 || pCopy->Depth == 0) {
LogPrintfInfo("Either Width :%d or Height: %d and Depth: %d is zero", pCopy->WidthInBytes,
pCopy->Height, pCopy->Depth);
return hipSuccess;
}
// If {src/dst}MemoryType is hipMemoryTypeUnified, {src/dst}Device and {src/dst}Pitch specify the (unified virtual address space) // If {src/dst}MemoryType is hipMemoryTypeUnified, {src/dst}Device and {src/dst}Pitch specify the (unified virtual address space)
// base address of the source data and the bytes per row to apply. {src/dst}Array is ignored. // base address of the source data and the bytes per row to apply. {src/dst}Array is ignored.
hipMemoryType srcMemoryType = pCopy->srcMemoryType; hipMemoryType srcMemoryType = pCopy->srcMemoryType;
@@ -1506,7 +1512,7 @@ hipError_t ihipMemcpyParam3D(const HIP_MEMCPY3D* pCopy,
amd::Coord3D srcOrigin = {pCopy->srcXInBytes, pCopy->srcY, pCopy->srcZ}; amd::Coord3D srcOrigin = {pCopy->srcXInBytes, pCopy->srcY, pCopy->srcZ};
amd::Coord3D dstOrigin = {pCopy->dstXInBytes, pCopy->dstY, pCopy->dstZ}; amd::Coord3D dstOrigin = {pCopy->dstXInBytes, pCopy->dstY, pCopy->dstZ};
amd::Coord3D copyRegion = {pCopy->WidthInBytes, (pCopy->Height != 0) ? pCopy->Height : 1, (pCopy->Depth != 0) ? pCopy->Depth : 1}; amd::Coord3D copyRegion = {pCopy->WidthInBytes, pCopy->Height, pCopy->Depth};
if ((srcMemoryType == hipMemoryTypeHost) && (dstMemoryType == hipMemoryTypeHost)) { if ((srcMemoryType == hipMemoryTypeHost) && (dstMemoryType == hipMemoryTypeHost)) {
// Host to Host. // Host to Host.