From 15d8e4b07f072d7652913d36f963b921554c258a Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 23 Jan 2018 10:40:39 -0500 Subject: [PATCH] P4 to Git Change 1506644 by wchau@wchau_OCL_boltzmann on 2018/01/23 10:34:36 SWDEV-140733 - Raven Bring Up - OCLCreateImage Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#32 edit [ROCm/clr commit: 6a82783a0be34698175e2a57787cf09e1da2749b] --- .../rocclr/runtime/device/rocm/rocmemory.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp index 835ff96ea8..cd6a901686 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp @@ -991,6 +991,10 @@ bool Image::createView(const Memory& parent) { kind_ = parent.getKind(); version_ = parent.version(); + if (parent.isHostMemDirectAccess()) { + flags_ |= HostMemoryDirectAccess; + } + hsa_status_t status; if (linearLayout) { size_t rowPitch; @@ -1064,14 +1068,18 @@ void* Image::allocMapTarget(const amd::Coord3D& origin, const amd::Coord3D& regi pHostMem = mapMemory_->getHostMem(); - *rowPitch = region[0] * elementSize; + size_t rowPitchTemp = 0; + if (rowPitch != nullptr) { + *rowPitch = region[0] * elementSize; + rowPitchTemp = *rowPitch; + } size_t slicePitchTmp = 0; if (imageDescriptor_.geometry == HSA_EXT_IMAGE_GEOMETRY_1DA) { - slicePitchTmp = *rowPitch; + slicePitchTmp = rowPitchTemp; } else { - slicePitchTmp = *rowPitch * region[1]; + slicePitchTmp = rowPitchTemp * region[1]; } if (slicePitch != nullptr) { *slicePitch = slicePitchTmp; @@ -1086,7 +1094,10 @@ void* Image::allocMapTarget(const amd::Coord3D& origin, const amd::Coord3D& regi // Adjust offset with Z dimension offset += image->getSlicePitch() * origin[2]; - *rowPitch = image->getRowPitch(); + if (rowPitch != nullptr) { + *rowPitch = image->getRowPitch(); + } + if (slicePitch != nullptr) { *slicePitch = image->getSlicePitch(); }