Checking if the PrivateSurface Size exceeds UINT32_MAX

Change-Id: I75598d7b4bdbfe1648b7f03fd0878ed51824221b
This commit is contained in:
Koska, Andrzej
2018-04-16 10:15:41 +02:00
parent fc05b80696
commit 9dda0ed149
3 changed files with 60 additions and 2 deletions

View File

@ -260,8 +260,12 @@ cl_int Kernel::initialize() {
if (privateSurfaceSize) {
privateSurfaceSize *= device.getDeviceInfo().computeUnitsUsedForScratch * getKernelInfo().getMaxSimdSize();
DEBUG_BREAK_IF(privateSurfaceSize == 0);
if ((is32Bit() || device.getMemoryManager()->peekForce32BitAllocations()) && (privateSurfaceSize > std::numeric_limits<uint32_t>::max())) {
retVal = CL_OUT_OF_RESOURCES;
break;
}
privateSurface = device.getMemoryManager()->createGraphicsAllocationWithRequiredBitness(privateSurfaceSize, nullptr);
privateSurface = device.getMemoryManager()->createGraphicsAllocationWithRequiredBitness(static_cast<size_t>(privateSurfaceSize), nullptr);
if (privateSurface == nullptr) {
retVal = CL_OUT_OF_RESOURCES;
break;

View File

@ -481,7 +481,7 @@ class Kernel : public BaseObject<_cl_kernel> {
uint32_t crossThreadDataSize;
GraphicsAllocation *privateSurface;
uint32_t privateSurfaceSize;
uint64_t privateSurfaceSize;
GraphicsAllocation *kernelReflectionSurface;