2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2022-05-25 14:39:35 +00:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
2022-12-06 10:19:05 +00:00
|
|
|
#include "shared/source/helpers/constants.h"
|
2022-05-25 14:39:35 +00:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2020-10-22 16:13:05 +02:00
|
|
|
#include <algorithm>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2022-12-08 12:22:35 +00:00
|
|
|
GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE] = {};
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
GfxCoreHelper &GfxCoreHelper::get(GFXCORE_FAMILY gfxCore) {
|
|
|
|
|
return *gfxCoreHelperFactory[gfxCore];
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2018-12-14 16:00:43 +01:00
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
bool GfxCoreHelper::compressedBuffersSupported(const HardwareInfo &hwInfo) {
|
2018-12-14 16:00:43 +01:00
|
|
|
if (DebugManager.flags.RenderCompressedBuffersEnabled.get() != -1) {
|
|
|
|
|
return !!DebugManager.flags.RenderCompressedBuffersEnabled.get();
|
|
|
|
|
}
|
|
|
|
|
return hwInfo.capabilityTable.ftrRenderCompressedBuffers;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
bool GfxCoreHelper::compressedImagesSupported(const HardwareInfo &hwInfo) {
|
2018-12-14 16:00:43 +01:00
|
|
|
if (DebugManager.flags.RenderCompressedImagesEnabled.get() != -1) {
|
|
|
|
|
return !!DebugManager.flags.RenderCompressedImagesEnabled.get();
|
|
|
|
|
}
|
|
|
|
|
return hwInfo.capabilityTable.ftrRenderCompressedImages;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
bool GfxCoreHelper::cacheFlushAfterWalkerSupported(const HardwareInfo &hwInfo) {
|
2019-02-05 15:11:38 +01:00
|
|
|
int32_t dbgFlag = DebugManager.flags.EnableCacheFlushAfterWalker.get();
|
|
|
|
|
if (dbgFlag == 1) {
|
|
|
|
|
return true;
|
|
|
|
|
} else if (dbgFlag == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return hwInfo.capabilityTable.supportCacheFlushAfterWalker;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
uint32_t GfxCoreHelper::getMaxThreadsForVfe(const HardwareInfo &hwInfo) {
|
2019-05-16 17:17:53 +02:00
|
|
|
uint32_t threadsPerEU = (hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount) + hwInfo.capabilityTable.extraQuantityThreadsPerEU;
|
2020-04-29 15:37:30 +02:00
|
|
|
auto maxHwThreadsCapable = hwInfo.gtSystemInfo.EUCount * threadsPerEU;
|
|
|
|
|
auto maxHwThreadsReturned = maxHwThreadsCapable;
|
|
|
|
|
if (DebugManager.flags.MaxHwThreadsPercent.get() != 0) {
|
|
|
|
|
maxHwThreadsReturned = int(maxHwThreadsCapable * (DebugManager.flags.MaxHwThreadsPercent.get() / 100.0f));
|
|
|
|
|
}
|
|
|
|
|
if (DebugManager.flags.MinHwThreadsUnoccupied.get() != 0) {
|
|
|
|
|
maxHwThreadsReturned = std::min(maxHwThreadsReturned, maxHwThreadsCapable - DebugManager.flags.MinHwThreadsUnoccupied.get());
|
|
|
|
|
}
|
|
|
|
|
return maxHwThreadsReturned;
|
2019-05-16 17:17:53 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
uint32_t GfxCoreHelper::getSubDevicesCount(const HardwareInfo *pHwInfo) {
|
2021-06-28 13:44:09 +00:00
|
|
|
if (DebugManager.flags.CreateMultipleSubDevices.get() > 0) {
|
|
|
|
|
return DebugManager.flags.CreateMultipleSubDevices.get();
|
|
|
|
|
} else if (pHwInfo->gtSystemInfo.MultiTileArchInfo.IsValid && pHwInfo->gtSystemInfo.MultiTileArchInfo.TileCount > 0u) {
|
|
|
|
|
return pHwInfo->gtSystemInfo.MultiTileArchInfo.TileCount;
|
|
|
|
|
} else {
|
|
|
|
|
return 1u;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
uint32_t GfxCoreHelper::getHighestEnabledSlice(const HardwareInfo &hwInfo) {
|
2022-09-23 00:29:32 +00:00
|
|
|
uint32_t highestEnabledSlice = 0;
|
|
|
|
|
if (!hwInfo.gtSystemInfo.IsDynamicallyPopulated) {
|
|
|
|
|
return hwInfo.gtSystemInfo.MaxSlicesSupported;
|
|
|
|
|
}
|
|
|
|
|
for (int highestSlice = GT_MAX_SLICE - 1; highestSlice >= 0; highestSlice--) {
|
|
|
|
|
if (hwInfo.gtSystemInfo.SliceInfo[highestSlice].Enabled) {
|
|
|
|
|
highestEnabledSlice = highestSlice + 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return highestEnabledSlice;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-06 10:19:05 +00:00
|
|
|
void HwHelper::getCpuCopyThresholds(size_t &h2DThreshold, size_t &d2HThreshold) {
|
|
|
|
|
h2DThreshold = NonUsmCpuCopyConstants::h2DThreshold;
|
|
|
|
|
d2HThreshold = NonUsmCpuCopyConstants::d2HThreshold;
|
|
|
|
|
|
|
|
|
|
if (NEO::DebugManager.flags.ExperimentalH2DCpuCopyThreshold.get() != -1) {
|
|
|
|
|
h2DThreshold = NEO::DebugManager.flags.ExperimentalH2DCpuCopyThreshold.get();
|
|
|
|
|
}
|
|
|
|
|
if (NEO::DebugManager.flags.ExperimentalD2HCpuCopyThreshold.get() != -1) {
|
|
|
|
|
d2HThreshold = NEO::DebugManager.flags.ExperimentalD2HCpuCopyThreshold.get();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|