2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2021-05-16 20:51:16 +02:00
|
|
|
* Copyright (C) 2018-2021 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"
|
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 {
|
2017-12-21 00:45:38 +01:00
|
|
|
HwHelper *hwHelperFactory[IGFX_MAX_CORE] = {};
|
|
|
|
|
|
|
|
|
|
HwHelper &HwHelper::get(GFXCORE_FAMILY gfxCore) {
|
|
|
|
|
return *hwHelperFactory[gfxCore];
|
|
|
|
|
}
|
2018-12-14 16:00:43 +01:00
|
|
|
|
2021-12-03 13:52:16 +00:00
|
|
|
bool HwHelper::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;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-03 13:52:16 +00:00
|
|
|
bool HwHelper::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;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-05 15:11:38 +01:00
|
|
|
bool HwHelper::cacheFlushAfterWalkerSupported(const HardwareInfo &hwInfo) {
|
|
|
|
|
int32_t dbgFlag = DebugManager.flags.EnableCacheFlushAfterWalker.get();
|
|
|
|
|
if (dbgFlag == 1) {
|
|
|
|
|
return true;
|
|
|
|
|
} else if (dbgFlag == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return hwInfo.capabilityTable.supportCacheFlushAfterWalker;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-16 17:17:53 +02:00
|
|
|
uint32_t HwHelper::getMaxThreadsForVfe(const HardwareInfo &hwInfo) {
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2021-06-28 13:44:09 +00:00
|
|
|
uint32_t HwHelper::getSubDevicesCount(const HardwareInfo *pHwInfo) {
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|