P4 to Git Change 1201783 by gandryey@gera-w8 on 2015/10/20 18:03:34

SWDEV-79151 - clenqueuereadImage is slow when using a pinned buffer and a row_picth!0
	- Add a check if the provided rowPitch is equal to the actual transfer width. SDMA doesn't support row/slice pitches, thus runtime still has to fall back to compute in other cases

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_memobj.cpp#78 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpublit.cpp#120 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#122 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#92 edit


[ROCm/clr commit: 922e14c46d]
Этот коммит содержится в:
foreman
2015-10-20 18:37:35 -04:00
родитель ca83b79cff
Коммит 21014b2703
3 изменённых файлов: 24 добавлений и 11 удалений
+10 -2
Просмотреть файл
@@ -938,6 +938,8 @@ KernelBlitManager::copyBufferToImage(
static const bool CopyRect = false;
// Flush DMA for ASYNC copy
static const bool FlushDMA = true;
size_t imgRowPitch = size[0] * gpuMem(dstMemory).elementSize();
size_t imgSlicePitch = imgRowPitch * size[1];
if (setup_.disableCopyBufferToImage_) {
result = DmaBlitManager::copyBufferToImage(
@@ -948,7 +950,9 @@ KernelBlitManager::copyBufferToImage(
}
// Check if buffer is in system memory with direct access
else if (gpuMem(srcMemory).isHostMemDirectAccess() &&
(rowPitch == 0) && (slicePitch == 0)) {
(((rowPitch == 0) && (slicePitch == 0)) ||
((rowPitch == imgRowPitch) &&
((slicePitch == 0) || (slicePitch == imgSlicePitch))))) {
// First attempt to do this all with DMA,
// but there are restriciton with older hardware
if (dev().settings().imageDMA_) {
@@ -1330,6 +1334,8 @@ KernelBlitManager::copyImageToBuffer(
static const bool CopyRect = false;
// Flush DMA for ASYNC copy
static const bool FlushDMA = true;
size_t imgRowPitch = size[0] * gpuMem(srcMemory).elementSize();
size_t imgSlicePitch = imgRowPitch * size[1];
if (setup_.disableCopyImageToBuffer_) {
result = HostBlitManager::copyImageToBuffer(
@@ -1340,7 +1346,9 @@ KernelBlitManager::copyImageToBuffer(
}
// Check if buffer is in system memory with direct access
else if (gpuMem(dstMemory).isHostMemDirectAccess() &&
(rowPitch == 0) && (slicePitch == 0)) {
(((rowPitch == 0) && (slicePitch == 0)) ||
((rowPitch == imgRowPitch) &&
((slicePitch == 0) || (slicePitch == imgSlicePitch))))) {
// First attempt to do this all with DMA,
// but there are restriciton with older hardware
if (dev().settings().imageDMA_) {
+9 -5
Просмотреть файл
@@ -1226,17 +1226,21 @@ Image::validateRegion(const Coord3D& origin, const Coord3D& region) const
}
bool
Image::isSliceValid(
const size_t& rowPitch,
const size_t& slice,
const size_t& height) const
Image::isRowSliceValid(
size_t rowPitch,
size_t slice,
size_t width,
size_t height) const
{
size_t tmpHeight =
(getType() == CL_MEM_OBJECT_IMAGE1D_ARRAY) ? 1 : height;
bool valid = (rowPitch == 0) || ((rowPitch != 0) &&
(rowPitch >= width * getImageFormat().getElementSize()));
return ((slice == 0) ||
((slice != 0) &&
(slice >= rowPitch * tmpHeight))) ? true : false;
(slice >= rowPitch * tmpHeight))) ? valid : false;
}
void
+5 -4
Просмотреть файл
@@ -577,10 +577,11 @@ public:
) const;
//! Returns true if the slice value for the image is valid
bool isSliceValid(
const size_t& rowPitch, //!< The row pitch value
const size_t& slicePitch, //!< The slice pitch value
const size_t& height //!< The height of the copy region
bool isRowSliceValid(
size_t rowPitch, //!< The row pitch value
size_t slicePitch, //!< The slice pitch value
size_t width, //!< The width of the copy region
size_t height //!< The height of the copy region
) const;
//! Creates a view memory object