P4 to Git Change 1352835 by cpaquot@hog-ocl on 2016/12/13 19:59:07

SWDEV-108384 - Force map memory offset to 0
	Copy what we do in ORCA and PAL backend: When mapping an image, default the offset to 0 instead of the map offset for the staging buffer.

	ReviewBoardURL = http://ocltc.amd.com/reviews/r/12010/diff/

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#5 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#25 edit


[ROCm/clr commit: 320d5de3a1]
This commit is contained in:
foreman
2016-12-13 20:42:16 -05:00
szülő 0de79a8432
commit f1aac67ca8
2 fájl változott, egészen pontosan 25 új sor hozzáadva és 11 régi sor törölve
@@ -710,6 +710,12 @@ Image::allocMapTarget(
void* pHostMem = owner()->getHostMem();
amd::Image* image = owner()->asImage();
size_t elementSize = image->getImageFormat().getElementSize();
size_t offset = origin[0] * elementSize;
if (pHostMem == NULL) {
if (indirectMapCount_ == 1) {
if (!allocateMapMemory(owner()->getSize())) {
@@ -726,14 +732,24 @@ Image::allocMapTarget(
}
pHostMem = mapMemory_->getHostMem();
*rowPitch = region[0] * elementSize;
size_t slicePitchTmp = 0;
if (imageDescriptor_.geometry == HSA_EXT_IMAGE_GEOMETRY_1DA) {
slicePitchTmp = *rowPitch;
}
else {
slicePitchTmp = *rowPitch * region[1];
}
if (slicePitch != NULL) {
*slicePitch = slicePitchTmp;
}
return pHostMem;
}
amd::Image* image = owner()->asImage();
size_t elementSize = image->getImageFormat().getElementSize();
size_t offset = origin[0] * elementSize;
// Adjust offset with Y dimension
offset += image->getRowPitch() * origin[1];
@@ -1182,8 +1182,7 @@ void VirtualGPU::submitMapMemory(amd::MapMemoryCommand &cmd)
devMemory->mapMemory()->getDeviceMemory(dev(), false));
result = blitMgr().copyImageToBuffer(
*hsaMemory, *mapMemory, cmd.origin(),
cmd.origin(), cmd.size(), cmd.isEntireMemory(),
image->getRowPitch(), image->getSlicePitch());
amd::Coord3D(0,0,0), cmd.size(), cmd.isEntireMemory());
}
else {
result = blitMgr().readImage(
@@ -1239,9 +1238,8 @@ void VirtualGPU::submitUnmapMemory(amd::UnmapMemoryCommand &cmd)
roc::Memory *mapMemory = static_cast<roc::Memory *>(
devMemory->mapMemory()->getDeviceMemory(dev(), false));
result = blitMgr().copyBufferToImage(
*mapMemory, *devMemory, mapInfo->origin_,
mapInfo->origin_, mapInfo->region_, mapInfo->isEntire(),
image->getRowPitch(), image->getSlicePitch());
*mapMemory, *devMemory, amd::Coord3D(0,0,0),
mapInfo->origin_, mapInfo->region_, mapInfo->isEntire());
}
else {
result = blitMgr().writeImage(