Add logic to detect if kernel is using only images as arguments.

Change-Id: Ia897a1838761c452c36c3f7821149b5867c3cd70
This commit is contained in:
Mrozek, Michal
2018-08-07 09:49:47 +02:00
committed by sys_ocldev
parent 8123c8b08f
commit dfd331c568
3 changed files with 58 additions and 0 deletions

View File

@@ -309,6 +309,8 @@ cl_int Kernel::initialize() {
// resolve the new kernel info to account for kernel handlers
// I think by this time we have decoded the binary and know the number of args etc.
// double check this assumption
bool usingBuffers = false;
bool usingImages = false;
auto numArgs = kernelInfo.kernelArgInfo.size();
kernelArguments.resize(numArgs);
slmSizes.resize(numArgs);
@@ -330,11 +332,13 @@ cl_int Kernel::initialize() {
} else if ((argInfo.typeStr.find("*") != std::string::npos) || argInfo.isBuffer) {
kernelArgHandlers[i] = &Kernel::setArgBuffer;
kernelArguments[i].type = BUFFER_OBJ;
usingBuffers = true;
this->auxTranslationRequired |= !kernelInfo.kernelArgInfo[i].pureStatefulBufferAccess &&
getDevice().getHardwareInfo().capabilityTable.ftrRenderCompressedBuffers;
} else if (argInfo.isImage) {
kernelArgHandlers[i] = &Kernel::setArgImage;
kernelArguments[i].type = IMAGE_OBJ;
usingImages = true;
DEBUG_BREAK_IF(argInfo.typeStr.find("image") == std::string::npos);
} else if (argInfo.isSampler) {
kernelArgHandlers[i] = &Kernel::setArgSampler;
@@ -348,6 +352,10 @@ cl_int Kernel::initialize() {
}
}
if (usingImages && !usingBuffers) {
usingImagesOnly = true;
}
if (isParentKernel) {
program->allocateBlockPrivateSurfaces();
}