2019-09-19 01:32:33 +08:00
|
|
|
/*
|
2021-01-13 21:42:47 +08:00
|
|
|
* Copyright (C) 2019-2021 Intel Corporation
|
2019-09-19 01:32:33 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-08-27 04:36:51 +08:00
|
|
|
#include "shared/source/gen12lp/aub_mapper.h"
|
2020-03-13 20:14:28 +08:00
|
|
|
#include "shared/source/gen12lp/hw_cmds.h"
|
|
|
|
|
|
|
|
using Family = NEO::TGLLPFamily;
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/flat_batch_buffer_helper_hw.inl"
|
2020-10-22 17:25:32 +08:00
|
|
|
#include "shared/source/helpers/hw_helper_base.inl"
|
2021-08-03 19:48:35 +08:00
|
|
|
#include "shared/source/helpers/hw_helper_bdw_and_later.inl"
|
|
|
|
#include "shared/source/helpers/hw_helper_tgllp_and_later.inl"
|
2020-06-16 22:25:46 +08:00
|
|
|
#include "shared/source/os_interface/hw_info_config.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2019-09-19 01:32:33 +08:00
|
|
|
#include "engine_node.h"
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
2020-03-20 18:52:03 +08:00
|
|
|
template <>
|
2021-10-08 21:01:26 +08:00
|
|
|
size_t HwHelperHw<Family>::getMax3dImageWidthOrHeight() const {
|
|
|
|
return 2048;
|
2020-03-20 18:52:03 +08:00
|
|
|
}
|
|
|
|
|
2019-12-13 23:31:09 +08:00
|
|
|
template <>
|
2020-01-23 22:52:49 +08:00
|
|
|
bool HwHelperHw<Family>::isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) const {
|
2021-09-27 22:43:52 +08:00
|
|
|
return isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo);
|
2019-12-13 23:31:09 +08:00
|
|
|
}
|
|
|
|
|
2020-10-09 18:27:32 +08:00
|
|
|
template <>
|
|
|
|
bool HwHelperHw<Family>::isWaDisableRccRhwoOptimizationRequired() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-02-05 22:16:42 +08:00
|
|
|
template <>
|
|
|
|
bool HwHelperHw<Family>::isAdditionalFeatureFlagRequired(const FeatureTable *featureTable) const {
|
2021-11-25 17:31:14 +08:00
|
|
|
return featureTable->flags.ftrGpGpuMidThreadLevelPreempt;
|
2021-02-05 22:16:42 +08:00
|
|
|
}
|
|
|
|
|
2019-09-19 01:32:33 +08:00
|
|
|
template <>
|
|
|
|
uint32_t HwHelperHw<Family>::getComputeUnitsUsedForScratch(const HardwareInfo *pHwInfo) const {
|
|
|
|
/* For ICL+ maxThreadCount equals (EUCount * 8).
|
|
|
|
ThreadCount/EUCount=7 is no longer valid, so we have to force 8 in below formula.
|
|
|
|
This is required to allocate enough scratch space. */
|
|
|
|
return pHwInfo->gtSystemInfo.MaxSubSlicesSupported * pHwInfo->gtSystemInfo.MaxEuPerSubSlice * 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
bool HwHelperHw<Family>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) const {
|
2021-11-25 17:31:14 +08:00
|
|
|
return hwInfo.featureTable.flags.ftrLocalMemory;
|
2019-09-19 01:32:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2021-12-03 21:52:16 +08:00
|
|
|
bool HwHelperHw<Family>::isBufferSizeSuitableForCompression(const size_t size, const HardwareInfo &hwInfo) const {
|
2021-08-27 02:14:02 +08:00
|
|
|
if (DebugManager.flags.OverrideBufferSuitableForRenderCompression.get() != -1) {
|
|
|
|
return !!DebugManager.flags.OverrideBufferSuitableForRenderCompression.get();
|
|
|
|
}
|
2020-01-10 18:22:54 +08:00
|
|
|
return false;
|
2019-09-19 01:32:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2019-11-14 21:34:34 +08:00
|
|
|
bool HwHelperHw<Family>::checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) {
|
2021-12-03 00:47:05 +08:00
|
|
|
return !graphicsAllocation.isCompressionEnabled();
|
2019-09-19 01:32:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2021-01-13 21:42:47 +08:00
|
|
|
uint32_t HwHelperHw<Family>::getPitchAlignmentForImage(const HardwareInfo *hwInfo) const {
|
2021-09-24 22:29:49 +08:00
|
|
|
if (HwInfoConfig::get(hwInfo->platform.eProductFamily)->imagePitchAlignmentWARequired(*hwInfo)) {
|
|
|
|
return 64u;
|
2019-09-19 01:32:33 +08:00
|
|
|
}
|
|
|
|
return 4u;
|
|
|
|
}
|
|
|
|
|
2019-11-13 21:48:44 +08:00
|
|
|
template <>
|
|
|
|
uint32_t HwHelperHw<Family>::getMetricsLibraryGenId() const {
|
|
|
|
return static_cast<uint32_t>(MetricsLibraryApi::ClientGen::Gen12);
|
|
|
|
}
|
|
|
|
|
2019-09-19 01:32:33 +08:00
|
|
|
template <>
|
2021-08-18 23:34:29 +08:00
|
|
|
const EngineInstancesContainer HwHelperHw<Family>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
2020-02-21 22:25:04 +08:00
|
|
|
auto defaultEngine = getChosenEngineType(hwInfo);
|
|
|
|
|
2021-11-27 00:58:20 +08:00
|
|
|
EngineInstancesContainer engines;
|
2020-02-21 22:25:04 +08:00
|
|
|
|
2021-11-25 17:31:14 +08:00
|
|
|
if (defaultEngine == aub_stream::EngineType::ENGINE_CCS && hwInfo.featureTable.flags.ftrCCSNode && !hwInfo.featureTable.flags.ftrGpGpuMidThreadLevelPreempt) {
|
2020-09-15 23:29:02 +08:00
|
|
|
engines.push_back({aub_stream::ENGINE_CCS, EngineUsage::Regular});
|
2020-02-21 22:25:04 +08:00
|
|
|
}
|
|
|
|
|
2021-11-27 00:58:20 +08:00
|
|
|
engines.push_back({aub_stream::ENGINE_RCS, EngineUsage::Regular});
|
|
|
|
engines.push_back({aub_stream::ENGINE_RCS, EngineUsage::LowPriority}); // low priority
|
|
|
|
engines.push_back({defaultEngine, EngineUsage::Internal}); // internal usage
|
|
|
|
|
2021-11-09 01:03:15 +08:00
|
|
|
if (hwInfo.capabilityTable.blitterOperationsSupported) {
|
|
|
|
if (hwInfo.featureTable.ftrBcsInfo.test(0)) {
|
|
|
|
engines.push_back({aub_stream::ENGINE_BCS, EngineUsage::Regular});
|
|
|
|
}
|
2020-05-04 22:34:13 +08:00
|
|
|
}
|
|
|
|
|
2020-02-21 22:25:04 +08:00
|
|
|
return engines;
|
2019-09-19 01:32:33 +08:00
|
|
|
};
|
|
|
|
|
2020-07-28 16:36:52 +08:00
|
|
|
template <>
|
2021-08-17 02:24:13 +08:00
|
|
|
EngineGroupType HwHelperHw<Family>::getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const {
|
2020-12-16 00:37:05 +08:00
|
|
|
switch (engineType) {
|
|
|
|
case aub_stream::ENGINE_RCS:
|
|
|
|
return EngineGroupType::RenderCompute;
|
|
|
|
case aub_stream::ENGINE_CCS:
|
|
|
|
return EngineGroupType::Compute;
|
|
|
|
case aub_stream::ENGINE_BCS:
|
|
|
|
return EngineGroupType::Copy;
|
|
|
|
default:
|
|
|
|
UNRECOVERABLE_IF(true);
|
2020-07-28 16:36:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-06 22:10:59 +08:00
|
|
|
template <>
|
2021-08-27 07:39:31 +08:00
|
|
|
std::string HwHelperHw<Family>::getExtensions() const {
|
2020-02-06 22:10:59 +08:00
|
|
|
return "cl_intel_subgroup_local_block_io ";
|
|
|
|
}
|
|
|
|
|
2020-02-10 18:02:21 +08:00
|
|
|
template <>
|
2020-04-27 03:48:59 +08:00
|
|
|
inline void MemorySynchronizationCommands<Family>::setPipeControlExtraProperties(PIPE_CONTROL &pipeControl, PipeControlArgs &args) {
|
|
|
|
pipeControl.setHdcPipelineFlush(args.hdcPipelineFlush);
|
2020-09-30 21:06:42 +08:00
|
|
|
|
|
|
|
if (DebugManager.flags.FlushAllCaches.get()) {
|
|
|
|
pipeControl.setHdcPipelineFlush(true);
|
|
|
|
}
|
|
|
|
if (DebugManager.flags.DoNotFlushCaches.get()) {
|
|
|
|
pipeControl.setHdcPipelineFlush(false);
|
|
|
|
}
|
2020-04-27 03:48:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2020-09-30 21:06:42 +08:00
|
|
|
void MemorySynchronizationCommands<Family>::setCacheFlushExtraProperties(PipeControlArgs &args) {
|
|
|
|
args.hdcPipelineFlush = true;
|
|
|
|
args.constantCacheInvalidationEnable = false;
|
2020-02-10 18:02:21 +08:00
|
|
|
}
|
|
|
|
|
2020-09-03 15:06:11 +08:00
|
|
|
template <>
|
|
|
|
bool HwHelperHw<Family>::useOnlyGlobalTimestamps() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-10-01 18:22:54 +08:00
|
|
|
template <>
|
|
|
|
uint32_t HwHelperHw<Family>::getMocsIndex(const GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const {
|
|
|
|
if (l3enabled) {
|
2020-10-12 16:13:29 +08:00
|
|
|
if (DebugManager.flags.ForceL1Caching.get() != 1) {
|
|
|
|
l1enabled = false;
|
2020-10-01 18:22:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (l1enabled) {
|
|
|
|
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
|
|
|
|
} else {
|
|
|
|
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
|
|
|
|
}
|
|
|
|
|
2020-10-06 00:32:55 +08:00
|
|
|
template <>
|
2021-09-28 18:54:52 +08:00
|
|
|
bool MemorySynchronizationCommands<Family>::isPipeControlWArequired(const HardwareInfo &hwInfo) {
|
2021-09-24 22:29:49 +08:00
|
|
|
return HwInfoConfig::get(hwInfo.platform.eProductFamily)->pipeControlWARequired(hwInfo);
|
2020-10-06 00:32:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2021-09-28 18:54:52 +08:00
|
|
|
bool MemorySynchronizationCommands<Family>::isPipeControlPriorToPipelineSelectWArequired(const HardwareInfo &hwInfo) {
|
|
|
|
return MemorySynchronizationCommands<Family>::isPipeControlWArequired(hwInfo);
|
2020-10-06 00:32:55 +08:00
|
|
|
}
|
|
|
|
|
2020-10-30 16:02:18 +08:00
|
|
|
template <>
|
2021-09-28 18:54:52 +08:00
|
|
|
void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const {
|
2021-09-09 20:27:41 +08:00
|
|
|
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
|
|
|
if (hwInfoConfig.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) {
|
2020-10-30 16:02:18 +08:00
|
|
|
if (GraphicsAllocation::isCpuAccessRequired(properties.allocationType)) {
|
|
|
|
allocationData.flags.useSystemMemory = true;
|
|
|
|
}
|
|
|
|
}
|
2021-09-28 18:54:52 +08:00
|
|
|
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->isStorageInfoAdjustmentRequired()) {
|
2021-12-06 23:29:31 +08:00
|
|
|
if (properties.allocationType == GraphicsAllocation::AllocationType::BUFFER && !properties.flags.preferCompressed) {
|
2021-05-14 03:42:16 +08:00
|
|
|
allocationData.storageInfo.isLockable = true;
|
|
|
|
}
|
|
|
|
}
|
2020-10-30 16:02:18 +08:00
|
|
|
}
|
|
|
|
|
2019-09-19 01:32:33 +08:00
|
|
|
template class HwHelperHw<Family>;
|
|
|
|
template class FlatBatchBufferHelperHw<Family>;
|
2020-02-17 19:45:24 +08:00
|
|
|
template struct MemorySynchronizationCommands<Family>;
|
2020-04-28 22:48:23 +08:00
|
|
|
template struct LriHelper<Family>;
|
2019-09-19 01:32:33 +08:00
|
|
|
} // namespace NEO
|