P4 to Git Change 1345399 by cpaquot@hog-ocl on 2016/11/23 17:13:30
SWDEV-107558 - Wrong path for map/unmap images
If mapMemory is allocated, we shouldn't use the read/writeImage path since they lock/unlock the host pointer which in this case, is mapped to GPU memory already.
ReviewBoardURL = http://ocltc.amd.com/reviews/r/11891/diff/
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#20 edit
[ROCm/clr commit: 45bf0e3ba6]
This commit is contained in:
@@ -1169,10 +1169,19 @@ void VirtualGPU::submitMapMemory(amd::MapMemoryCommand &cmd)
|
|||||||
}
|
}
|
||||||
else if (type == CL_COMMAND_MAP_IMAGE) {
|
else if (type == CL_COMMAND_MAP_IMAGE) {
|
||||||
amd::Image* image = cmd.memory().asImage();
|
amd::Image* image = cmd.memory().asImage();
|
||||||
result = blitMgr().readImage(
|
if (mapMemory != nullptr) {
|
||||||
*hsaMemory, hostPtr, amd::Coord3D(0),
|
roc::Memory *mapMemory = static_cast<roc::Memory *>(
|
||||||
image->getRegion(), image->getRowPitch(),
|
devMemory->mapMemory()->getDeviceMemory(dev(), false));
|
||||||
image->getSlicePitch(), true);
|
result = blitMgr().copyImageToBuffer(
|
||||||
|
*hsaMemory, *mapMemory, cmd.origin(),
|
||||||
|
cmd.origin(), cmd.size(), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result = blitMgr().readImage(
|
||||||
|
*hsaMemory, hostPtr, amd::Coord3D(0),
|
||||||
|
image->getRegion(), image->getRowPitch(),
|
||||||
|
image->getSlicePitch(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ShouldNotReachHere();
|
ShouldNotReachHere();
|
||||||
@@ -1217,14 +1226,23 @@ void VirtualGPU::submitUnmapMemory(amd::UnmapMemoryCommand &cmd)
|
|||||||
if (cmd.memory().asImage() && !imageBuffer) {
|
if (cmd.memory().asImage() && !imageBuffer) {
|
||||||
amd::Image *image = cmd.memory().asImage();
|
amd::Image *image = cmd.memory().asImage();
|
||||||
amd::Memory* mapMemory = devMemory->mapMemory();
|
amd::Memory* mapMemory = devMemory->mapMemory();
|
||||||
void *hostPtr = mapMemory == NULL ?
|
if (devMemory->mapMemory() != nullptr) {
|
||||||
devMemory->owner()->getHostMem() :
|
roc::Memory *mapMemory = static_cast<roc::Memory *>(
|
||||||
mapMemory->getHostMem();
|
devMemory->mapMemory()->getDeviceMemory(dev(), false));
|
||||||
|
result = blitMgr().copyBufferToImage(
|
||||||
|
*mapMemory, *devMemory, mapInfo->origin_,
|
||||||
|
mapInfo->origin_, mapInfo->region_, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
void *hostPtr = mapMemory == NULL ?
|
||||||
|
devMemory->owner()->getHostMem() :
|
||||||
|
mapMemory->getHostMem();
|
||||||
|
|
||||||
result = blitMgr().writeImage(
|
result = blitMgr().writeImage(
|
||||||
hostPtr, *devMemory,
|
hostPtr, *devMemory,
|
||||||
amd::Coord3D(0), image->getRegion(),
|
amd::Coord3D(0), image->getRegion(),
|
||||||
image->getRowPitch(), image->getSlicePitch(), true);
|
image->getRowPitch(), image->getSlicePitch(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
amd::Coord3D origin(mapInfo->origin_[0]);
|
amd::Coord3D origin(mapInfo->origin_[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user