fix: respect number of tiles when getting total private memory size of module

Related-To: GSD-8374
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2024-04-23 14:59:24 +00:00
committed by Compute-Runtime-Automation
parent 8bef74133f
commit 959333d9bf
4 changed files with 30 additions and 8 deletions

View File

@@ -1286,19 +1286,22 @@ void ModuleImp::verifyDebugCapabilities() {
void ModuleImp::checkIfPrivateMemoryPerDispatchIsNeeded() {
size_t modulePrivateMemorySize = 0;
auto neoDevice = this->device->getNEODevice();
for (auto &kernelImmData : this->kernelImmDatas) {
if (0 == kernelImmData->getDescriptor().kernelAttributes.perHwThreadPrivateMemorySize) {
continue;
}
auto kernelPrivateMemorySize = NEO::KernelHelper::getPrivateSurfaceSize(kernelImmData->getDescriptor().kernelAttributes.perHwThreadPrivateMemorySize,
this->device->getNEODevice()->getDeviceInfo().computeUnitsUsedForScratch);
neoDevice->getDeviceInfo().computeUnitsUsedForScratch);
modulePrivateMemorySize += kernelPrivateMemorySize;
}
this->allocatePrivateMemoryPerDispatch = false;
if (modulePrivateMemorySize > 0U) {
auto globalMemorySize = device->getNEODevice()->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(device->getNEODevice()->getDeviceBitfield().to_ulong()));
this->allocatePrivateMemoryPerDispatch = modulePrivateMemorySize > globalMemorySize;
auto deviceBitfield = neoDevice->getDeviceBitfield();
auto globalMemorySize = neoDevice->getRootDevice()->getGlobalMemorySize(static_cast<uint32_t>(deviceBitfield.to_ulong()));
auto numSubDevices = deviceBitfield.count();
this->allocatePrivateMemoryPerDispatch = modulePrivateMemorySize * numSubDevices > globalMemorySize;
}
}