fix: opencl support for bindless kernels

Related-To: NEO-11156
Signed-off-by: Fabian Zwoliński <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwoliński
2024-04-29 15:53:09 +00:00
committed by Compute-Runtime-Automation
parent 5e57bb2a32
commit ee71157f7f
10 changed files with 872 additions and 11 deletions

View File

@@ -265,16 +265,35 @@ cl_int Program::processProgramInfo(ProgramInfo &src, const ClDevice &clDevice) {
}
kernelInfoArray = std::move(src.kernelInfos);
bool isBindlessKernelPresent = false;
for (auto &kernelInfo : kernelInfoArray) {
if (NEO::KernelDescriptor::isBindlessAddressingKernel(kernelInfo->kernelDescriptor)) {
isBindlessKernelPresent = true;
break;
}
}
auto svmAllocsManager = context ? context->getSVMAllocsManager() : nullptr;
auto globalConstDataSize = src.globalConstants.size + src.globalConstants.zeroInitSize;
if (globalConstDataSize != 0) {
buildInfos[rootDeviceIndex].constantSurface = allocateGlobalsSurface(svmAllocsManager, clDevice.getDevice(), globalConstDataSize, src.globalConstants.zeroInitSize, true, linkerInput, src.globalConstants.initData);
if (isBindlessKernelPresent) {
if (!clDevice.getMemoryManager()->allocateBindlessSlot(buildInfos[rootDeviceIndex].constantSurface)) {
return CL_OUT_OF_HOST_MEMORY;
}
}
}
auto globalVariablesDataSize = src.globalVariables.size + src.globalVariables.zeroInitSize;
buildInfos[rootDeviceIndex].globalVarTotalSize = globalVariablesDataSize;
if (globalVariablesDataSize != 0) {
buildInfos[rootDeviceIndex].globalSurface = allocateGlobalsSurface(svmAllocsManager, clDevice.getDevice(), globalVariablesDataSize, src.globalVariables.zeroInitSize, false, linkerInput, src.globalVariables.initData);
if (isBindlessKernelPresent) {
if (!clDevice.getMemoryManager()->allocateBindlessSlot(buildInfos[rootDeviceIndex].globalSurface)) {
return CL_OUT_OF_HOST_MEMORY;
}
}
if (clDevice.areOcl21FeaturesEnabled() == false) {
buildInfos[rootDeviceIndex].globalVarTotalSize = 0u;
}