P4 to Git Change 1517501 by asalmanp@asalmanp-ocl-stg on 2018/02/20 13:54:28

SWDEV-132899 - [OCL][GFX10] OCLCreateImage[3] fails for the image type 1Darray
	Issue: FillImage blit kernel is not working properly on gfx10 if the image type is 1Darray (i.e., it only fills the first slice/layer and ignores the rest of the layers when number of layers >1)
	Root cause: gfx10 HW expects the number of layers in Z component
	Fix: To fix this issue we swap the Y and Z components if the image type is 1Darray for gfx10+ in image blit kernels.

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

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palblit.cpp#17 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#42 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.hpp#14 edit
Este commit está contenido en:
foreman
2018-02-20 14:15:36 -05:00
padre 66208072a3
commit e0f4740fc4
Se han modificado 3 ficheros con 55 adiciones y 1 borrados
+49
Ver fichero
@@ -1017,6 +1017,8 @@ bool KernelBlitManager::copyBufferToImageKernel(device::Memory& srcMemory,
bool releaseView = false;
bool result = false;
amd::Image::Format newFormat(gpuMem(dstMemory).desc().format_);
bool swapLayer = (dstView->desc().topology_ == CL_MEM_OBJECT_IMAGE1D_ARRAY) &&
dev().settings().gfx10Plus_;
// Find unsupported formats
for (uint i = 0; i < RejectedFormatDataTotal; ++i) {
@@ -1072,6 +1074,14 @@ bool KernelBlitManager::copyBufferToImageKernel(device::Memory& srcMemory,
globalWorkSize[2] = amd::alignUp(size[2], 1);
localWorkSize[0] = localWorkSize[1] = 16;
localWorkSize[2] = 1;
// Swap the Y and Z components, apparently gfx10 HW expects
// layer in Z
if (swapLayer) {
globalWorkSize[2] = globalWorkSize[1];
globalWorkSize[1] = 1;
localWorkSize[2] = localWorkSize[1];
localWorkSize[1] = 1;
}
} else {
globalWorkSize[0] = amd::alignUp(size[0], 8);
globalWorkSize[1] = amd::alignUp(size[1], 8);
@@ -1102,6 +1112,13 @@ bool KernelBlitManager::copyBufferToImageKernel(device::Memory& srcMemory,
cl_int dstOrg[4] = {(cl_int)dstOrigin[0], (cl_int)dstOrigin[1], (cl_int)dstOrigin[2], 0};
cl_int copySize[4] = {(cl_int)size[0], (cl_int)size[1], (cl_int)size[2], 0};
if (swapLayer) {
dstOrg[2] = dstOrg[1];
dstOrg[1] = 0;
copySize[2] = copySize[1];
copySize[1] = 1;
}
setArgument(kernels_[blitType], 3, sizeof(dstOrg), dstOrg);
setArgument(kernels_[blitType], 4, sizeof(copySize), copySize);
@@ -1320,6 +1337,8 @@ bool KernelBlitManager::copyImageToBufferKernel(device::Memory& srcMemory,
bool releaseView = false;
bool result = false;
amd::Image::Format newFormat(gpuMem(srcMemory).desc().format_);
bool swapLayer = (srcView->desc().topology_ == CL_MEM_OBJECT_IMAGE1D_ARRAY) &&
dev().settings().gfx10Plus_;
// Find unsupported formats
for (uint i = 0; i < RejectedFormatDataTotal; ++i) {
@@ -1375,6 +1394,14 @@ bool KernelBlitManager::copyImageToBufferKernel(device::Memory& srcMemory,
globalWorkSize[2] = amd::alignUp(size[2], 1);
localWorkSize[0] = localWorkSize[1] = 16;
localWorkSize[2] = 1;
// Swap the Y and Z components, apparently gfx10 HW expects
// layer in Z
if (swapLayer) {
globalWorkSize[2] = globalWorkSize[1];
globalWorkSize[1] = 1;
localWorkSize[2] = localWorkSize[1];
localWorkSize[1] = 1;
}
} else {
globalWorkSize[0] = amd::alignUp(size[0], 8);
globalWorkSize[1] = amd::alignUp(size[1], 8);
@@ -1397,6 +1424,12 @@ bool KernelBlitManager::copyImageToBufferKernel(device::Memory& srcMemory,
cl_int srcOrg[4] = {(cl_int)srcOrigin[0], (cl_int)srcOrigin[1], (cl_int)srcOrigin[2], 0};
cl_int copySize[4] = {(cl_int)size[0], (cl_int)size[1], (cl_int)size[2], 0};
if (swapLayer) {
srcOrg[2] = srcOrg[1];
srcOrg[1] = 0;
copySize[2] = copySize[1];
copySize[1] = 1;
}
setArgument(kernels_[blitType], 4, sizeof(srcOrg), srcOrg);
uint32_t memFmtSize = gpuMem(srcMemory).elementSize();
uint32_t components = gpuMem(srcMemory).numComponents();
@@ -2150,6 +2183,8 @@ bool KernelBlitManager::fillImage(device::Memory& memory, const void* pattern,
size_t localWorkSize[3];
Memory* memView = &gpuMem(memory);
amd::Image::Format newFormat(gpuMem(memory).owner()->asImage()->getImageFormat());
bool swapLayer = (memView->desc().topology_ == CL_MEM_OBJECT_IMAGE1D_ARRAY) &&
dev().settings().gfx10Plus_;
// Program the kernels workload depending on the fill dimensions
fillType = FillImage;
@@ -2213,6 +2248,14 @@ bool KernelBlitManager::fillImage(device::Memory& memory, const void* pattern,
globalWorkSize[2] = amd::alignUp(size[2], 1);
localWorkSize[0] = localWorkSize[1] = 16;
localWorkSize[2] = 1;
// Swap the Y and Z components, apparently gfx10 HW expects
// layer in Z
if (swapLayer) {
globalWorkSize[2] = globalWorkSize[1];
globalWorkSize[1] = 1;
localWorkSize[2] = localWorkSize[1];
localWorkSize[1] = 1;
}
} else {
globalWorkSize[0] = amd::alignUp(globalWorkSize[0], 8);
globalWorkSize[1] = amd::alignUp(size[1], 8);
@@ -2230,6 +2273,12 @@ bool KernelBlitManager::fillImage(device::Memory& memory, const void* pattern,
cl_int fillOrigin[4] = {(cl_int)origin[0], (cl_int)origin[1], (cl_int)origin[2], 0};
cl_int fillSize[4] = {(cl_int)size[0], (cl_int)size[1], (cl_int)size[2], 0};
if (swapLayer) {
fillOrigin[2] = fillOrigin[1];
fillOrigin[1] = 0;
fillSize[2] = fillSize[1];
fillSize[1] = 1;
}
setArgument(kernels_[fillType], 4, sizeof(fillOrigin), fillOrigin);
setArgument(kernels_[fillType], 5, sizeof(fillSize), fillSize);
+4
Ver fichero
@@ -102,6 +102,7 @@ Settings::Settings() {
// Disable ASIC specific features by default
viPlus_ = false;
aiPlus_ = false;
gfx10Plus_ = false;
// Number of compute rings.
numComputeRings_ = 0;
@@ -165,6 +166,7 @@ bool Settings::create(const Pal::DeviceProperties& palProp,
case Pal::AsicRevision::Unknown:
switch (palProp.gfxLevel) {
case Pal::GfxIpLevel::GfxIp10:
gfx10Plus_ = true;
case Pal::GfxIpLevel::GfxIp9:
aiPlus_ = true;
break;
@@ -173,6 +175,8 @@ bool Settings::create(const Pal::DeviceProperties& palProp,
return false;
}
case Pal::AsicRevision::Navi10:
gfx10Plus_ = true;
// Fall through to AI (gfx9) ...
case Pal::AsicRevision::Vega20:
case Pal::AsicRevision::Vega12:
case Pal::AsicRevision::Vega10:
+2 -1
Ver fichero
@@ -53,6 +53,7 @@ class Settings : public device::Settings {
uint syncObject_ : 1; //!< Enable syncobject
uint viPlus_ : 1; //!< VI and post VI features
uint aiPlus_ : 1; //!< AI and post AI features
uint gfx10Plus_ : 1; //!< gfx10 and post gfx10 features
uint threadTraceEnable_ : 1; //!< Thread trace enable
uint linearPersistentImage_ : 1; //!< Allocates linear images in persistent
uint useSingleScratch_ : 1; //!< Allocates single scratch per device
@@ -63,7 +64,7 @@ class Settings : public device::Settings {
uint useDeviceQueue_ : 1; //!< Submit to separate device queue
uint singleFpDenorm_ : 1; //!< Support Single FP Denorm
uint sdamPageFaultWar_ : 1; //!< SDMA page fault workaround
uint reserved_ : 9;
uint reserved_ : 8;
};
uint value_;
};