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-06-02 23:04:11 +08:00
|
|
|
#include "shared/source/gen12lp/helpers_gen12lp.h"
|
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"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/hw_helper_bdw_plus.inl"
|
2020-03-13 20:14:28 +08:00
|
|
|
#include "shared/source/helpers/hw_helper_tgllp_plus.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 <>
|
|
|
|
void HwHelperHw<Family>::setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) {
|
|
|
|
caps->image3DMaxHeight = 2048;
|
|
|
|
caps->image3DMaxWidth = 2048;
|
|
|
|
//With statefull messages we have an allocation cap of 4GB
|
|
|
|
//Reason to subtract 8KB is that driver may pad the buffer with addition pages for over fetching..
|
|
|
|
caps->maxMemAllocSize = (4ULL * MemoryConstants::gigaByte) - (8ULL * MemoryConstants::kiloByte);
|
|
|
|
caps->isStatelesToStatefullWithOffsetSupported = true;
|
|
|
|
}
|
|
|
|
|
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 {
|
2020-01-27 22:42:06 +08:00
|
|
|
return Gen12LPHelpers::isOffsetToSkipSetFFIDGPWARequired(hwInfo);
|
2019-12-13 23:31:09 +08:00
|
|
|
}
|
|
|
|
|
2020-03-19 22:15:51 +08:00
|
|
|
template <>
|
|
|
|
bool HwHelperHw<Family>::is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const {
|
|
|
|
return Gen12LPHelpers::is3DPipelineSelectWARequired(hwInfo);
|
|
|
|
}
|
|
|
|
|
2019-12-19 21:26:29 +08:00
|
|
|
template <>
|
|
|
|
bool HwHelperHw<Family>::isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) {
|
2020-01-27 22:42:06 +08:00
|
|
|
return Gen12LPHelpers::isForceEmuInt32DivRemSPWARequired(hwInfo);
|
2019-12-19 21:26:29 +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 {
|
|
|
|
return featureTable->ftrGpGpuMidThreadLevelPreempt;
|
|
|
|
}
|
|
|
|
|
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 {
|
|
|
|
return Gen12LPHelpers::isLocalMemoryEnabled(hwInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
bool HwHelperHw<Family>::isPageTableManagerSupported(const HardwareInfo &hwInfo) const {
|
2020-01-10 18:22:54 +08:00
|
|
|
return hwInfo.capabilityTable.ftrRenderCompressedBuffers || hwInfo.capabilityTable.ftrRenderCompressedImages;
|
2019-09-19 01:32:33 +08:00
|
|
|
}
|
|
|
|
|
2020-06-29 19:07:41 +08:00
|
|
|
template <>
|
2020-07-17 23:04:52 +08:00
|
|
|
uint32_t HwHelperHw<Family>::getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const {
|
2020-06-29 19:07:41 +08:00
|
|
|
if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_TIGERLAKE_LP) {
|
2020-07-17 23:04:52 +08:00
|
|
|
switch (stepping) {
|
|
|
|
case REVISION_A0:
|
|
|
|
return 0x0;
|
|
|
|
case REVISION_B:
|
|
|
|
return 0x1;
|
|
|
|
case REVISION_C:
|
|
|
|
return 0x3;
|
2020-06-29 19:07:41 +08:00
|
|
|
}
|
2020-08-21 02:50:19 +08:00
|
|
|
} else if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_ROCKETLAKE) {
|
|
|
|
switch (stepping) {
|
|
|
|
case REVISION_A0:
|
|
|
|
return 0x0;
|
|
|
|
case REVISION_B:
|
|
|
|
return 0x1;
|
|
|
|
case REVISION_C:
|
|
|
|
return 0x4;
|
|
|
|
}
|
2020-10-08 21:40:40 +08:00
|
|
|
} else if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_ALDERLAKE_S) {
|
|
|
|
switch (stepping) {
|
|
|
|
case REVISION_A0:
|
|
|
|
return 0x0;
|
|
|
|
case REVISION_B:
|
|
|
|
return 0x4;
|
|
|
|
}
|
2020-06-29 19:07:41 +08:00
|
|
|
}
|
2020-07-17 23:04:52 +08:00
|
|
|
return Gen12LPHelpers::getHwRevIdFromStepping(stepping, hwInfo);
|
|
|
|
}
|
2020-06-29 19:07:41 +08:00
|
|
|
|
2020-07-17 23:04:52 +08:00
|
|
|
template <>
|
2021-02-11 22:25:48 +08:00
|
|
|
uint32_t HwHelperHw<Family>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
|
2020-07-17 23:04:52 +08:00
|
|
|
if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_TIGERLAKE_LP) {
|
2021-02-11 22:25:48 +08:00
|
|
|
switch (hwInfo.platform.usRevId) {
|
2020-07-17 23:04:52 +08:00
|
|
|
case 0x0:
|
|
|
|
return REVISION_A0;
|
|
|
|
case 0x1:
|
|
|
|
return REVISION_B;
|
|
|
|
case 0x3:
|
|
|
|
return REVISION_C;
|
|
|
|
}
|
2020-08-21 02:50:19 +08:00
|
|
|
} else if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_ROCKETLAKE) {
|
2021-02-11 22:25:48 +08:00
|
|
|
switch (hwInfo.platform.usRevId) {
|
2020-08-21 02:50:19 +08:00
|
|
|
case 0x0:
|
|
|
|
return REVISION_A0;
|
|
|
|
case 0x1:
|
|
|
|
return REVISION_B;
|
|
|
|
case 0x4:
|
|
|
|
return REVISION_C;
|
|
|
|
}
|
2020-10-08 21:40:40 +08:00
|
|
|
} else if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_ALDERLAKE_S) {
|
2021-02-11 22:25:48 +08:00
|
|
|
switch (hwInfo.platform.usRevId) {
|
2020-10-08 21:40:40 +08:00
|
|
|
case 0x0:
|
|
|
|
return REVISION_A0;
|
|
|
|
case 0x4:
|
|
|
|
return REVISION_B;
|
|
|
|
}
|
2020-07-17 23:04:52 +08:00
|
|
|
}
|
2021-02-11 22:25:48 +08:00
|
|
|
return Gen12LPHelpers::getSteppingFromHwRevId(hwInfo);
|
|
|
|
}
|
|
|
|
|
2019-09-19 01:32:33 +08:00
|
|
|
template <>
|
2020-11-10 19:53:38 +08:00
|
|
|
bool HwHelperHw<Family>::isBufferSizeSuitableForRenderCompression(const size_t size) const {
|
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) {
|
|
|
|
if (graphicsAllocation.getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
|
|
|
|
return false;
|
2019-09-19 01:32:33 +08:00
|
|
|
}
|
2019-11-14 21:34:34 +08:00
|
|
|
return true;
|
2019-09-19 01:32:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void HwHelperHw<Family>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) {
|
|
|
|
coherencyFlag = true;
|
2020-06-29 19:07:41 +08:00
|
|
|
HwHelper &hwHelper = HwHelper::get(pHwInfo->platform.eRenderCoreFamily);
|
|
|
|
if (pHwInfo->platform.eProductFamily == IGFX_TIGERLAKE_LP && hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *pHwInfo)) {
|
2020-06-19 20:19:31 +08:00
|
|
|
//stepping A devices - turn off coherency
|
2019-09-19 01:32:33 +08:00
|
|
|
coherencyFlag = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Gen12LPHelpers::adjustCoherencyFlag(pHwInfo->platform.eProductFamily, coherencyFlag);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2021-01-13 21:42:47 +08:00
|
|
|
uint32_t HwHelperHw<Family>::getPitchAlignmentForImage(const HardwareInfo *hwInfo) const {
|
2019-09-19 01:32:33 +08:00
|
|
|
if (Gen12LPHelpers::imagePitchAlignmentWaRequired(hwInfo->platform.eProductFamily)) {
|
2020-06-29 19:07:41 +08:00
|
|
|
HwHelper &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
|
|
|
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo)) {
|
2019-09-19 01:32:33 +08:00
|
|
|
return 64u;
|
|
|
|
}
|
|
|
|
return 4u;
|
|
|
|
}
|
|
|
|
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 <>
|
2020-02-21 22:25:04 +08:00
|
|
|
const HwHelper::EngineInstancesContainer HwHelperHw<Family>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
|
|
|
auto defaultEngine = getChosenEngineType(hwInfo);
|
|
|
|
|
|
|
|
EngineInstancesContainer engines = {
|
2020-09-15 23:29:02 +08:00
|
|
|
{aub_stream::ENGINE_RCS, EngineUsage::Regular},
|
|
|
|
{aub_stream::ENGINE_RCS, EngineUsage::LowPriority}, // low priority
|
|
|
|
{defaultEngine, EngineUsage::Internal}, // internal usage
|
2020-02-21 22:25:04 +08:00
|
|
|
};
|
|
|
|
|
2020-06-18 20:24:59 +08:00
|
|
|
if (defaultEngine == aub_stream::EngineType::ENGINE_CCS && hwInfo.featureTable.ftrCCSNode && !hwInfo.featureTable.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
|
|
|
}
|
|
|
|
|
2020-05-04 22:34:13 +08:00
|
|
|
if (hwInfo.featureTable.ftrBcsInfo.test(0)) {
|
2020-09-15 23:29:02 +08:00
|
|
|
engines.push_back({aub_stream::ENGINE_BCS, EngineUsage::Regular});
|
2020-05-04 22:34:13 +08:00
|
|
|
}
|
|
|
|
|
2020-06-16 22:25:46 +08:00
|
|
|
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
|
|
|
if (hwInfoConfig->isEvenContextCountRequired() && engines.size() & 1) {
|
2020-09-15 23:29:02 +08:00
|
|
|
engines.push_back({aub_stream::ENGINE_RCS, EngineUsage::Regular});
|
2020-06-16 22:25:46 +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 <>
|
2020-12-16 00:37:05 +08:00
|
|
|
EngineGroupType HwHelperHw<Family>::getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const {
|
|
|
|
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-08-10 16:25:07 +08:00
|
|
|
template <>
|
2020-08-31 21:34:23 +08:00
|
|
|
bool HwHelperHw<Family>::forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo, GraphicsAllocation *allocation) const {
|
|
|
|
return Gen12LPHelpers::forceBlitterUseForGlobalBuffers(hwInfo, allocation);
|
2020-08-10 16:25:07 +08:00
|
|
|
}
|
|
|
|
|
2019-09-19 01:32:33 +08:00
|
|
|
template <>
|
2020-02-17 19:45:24 +08:00
|
|
|
void MemorySynchronizationCommands<Family>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
2020-04-09 00:33:03 +08:00
|
|
|
using PIPE_CONTROL = typename Family::PIPE_CONTROL;
|
2019-09-19 01:32:33 +08:00
|
|
|
if (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) {
|
2020-06-29 19:07:41 +08:00
|
|
|
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
|
|
|
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo)) {
|
2020-04-09 00:33:03 +08:00
|
|
|
PIPE_CONTROL cmd = Family::cmdInitPipeControl;
|
|
|
|
cmd.setCommandStreamerStallEnable(true);
|
|
|
|
auto pipeControl = static_cast<Family::PIPE_CONTROL *>(commandStream.getSpace(sizeof(PIPE_CONTROL)));
|
|
|
|
*pipeControl = cmd;
|
2019-09-19 01:32:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-06 22:10:59 +08:00
|
|
|
template <>
|
|
|
|
std::string HwHelperHw<Family>::getExtensions() const {
|
|
|
|
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 <>
|
|
|
|
bool MemorySynchronizationCommands<TGLLPFamily>::isPipeControlWArequired(const HardwareInfo &hwInfo) {
|
|
|
|
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
|
|
|
return (Gen12LPHelpers::pipeControlWaRequired(hwInfo.platform.eProductFamily)) && hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
bool MemorySynchronizationCommands<TGLLPFamily>::isPipeControlPriorToPipelineSelectWArequired(const HardwareInfo &hwInfo) {
|
|
|
|
return MemorySynchronizationCommands<TGLLPFamily>::isPipeControlWArequired(hwInfo);
|
|
|
|
}
|
|
|
|
|
2020-10-30 16:02:18 +08:00
|
|
|
template <>
|
|
|
|
void HwHelperHw<TGLLPFamily>::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const {
|
|
|
|
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
|
|
|
if (hwHelper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) {
|
|
|
|
if (GraphicsAllocation::isCpuAccessRequired(properties.allocationType)) {
|
|
|
|
allocationData.flags.useSystemMemory = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|