2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-01-09 23:10:48 +08:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-25 20:32:27 +08:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/gmm_helper/gmm.h"
|
|
|
|
#include "shared/source/gmm_helper/gmm_helper.h"
|
|
|
|
#include "shared/source/helpers/aligned_memory.h"
|
2020-06-09 03:49:11 +08:00
|
|
|
#include "shared/source/helpers/basic_math.h"
|
2020-04-02 17:28:38 +08:00
|
|
|
#include "shared/source/helpers/constants.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
|
|
|
#include "shared/source/helpers/hw_info.h"
|
|
|
|
#include "shared/source/helpers/preamble.h"
|
2020-06-02 19:38:02 +08:00
|
|
|
#include "shared/source/memory_manager/allocation_properties.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
|
|
|
#include "shared/source/os_interface/os_interface.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/aub_mem_dump/aub_mem_dump.h"
|
|
|
|
#include "opencl/source/helpers/dispatch_info.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-04-27 03:48:59 +08:00
|
|
|
#include "pipe_control_args.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-11-22 22:16:20 +08:00
|
|
|
|
2019-11-22 04:32:16 +08:00
|
|
|
template <typename Family>
|
|
|
|
const AuxTranslationMode HwHelperHw<Family>::defaultAuxTranslationMode = AuxTranslationMode::Builtin;
|
|
|
|
|
2019-03-19 19:57:47 +08:00
|
|
|
template <typename Family>
|
2019-10-09 23:32:35 +08:00
|
|
|
bool HwHelperHw<Family>::obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const {
|
2019-04-17 18:56:54 +08:00
|
|
|
return size > KB;
|
2019-03-19 19:57:47 +08:00
|
|
|
}
|
|
|
|
|
2018-02-19 16:50:17 +08:00
|
|
|
template <typename Family>
|
2018-08-23 23:42:35 +08:00
|
|
|
void HwHelperHw<Family>::setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) {
|
2018-02-19 16:50:17 +08:00
|
|
|
caps->image3DMaxHeight = 16384;
|
|
|
|
caps->image3DMaxWidth = 16384;
|
2018-06-08 22:42:29 +08:00
|
|
|
//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);
|
2018-07-10 19:22:11 +08:00
|
|
|
caps->isStatelesToStatefullWithOffsetSupported = true;
|
2018-02-19 16:50:17 +08:00
|
|
|
}
|
|
|
|
|
2019-08-29 11:46:37 +08:00
|
|
|
template <typename Family>
|
|
|
|
bool HwHelperHw<Family>::isL3Configurable(const HardwareInfo &hwInfo) {
|
|
|
|
return PreambleHelper<Family>::isL3Configurable(hwInfo);
|
|
|
|
}
|
|
|
|
|
2018-04-06 20:25:22 +08:00
|
|
|
template <typename Family>
|
|
|
|
SipKernelType HwHelperHw<Family>::getSipKernelType(bool debuggingActive) {
|
|
|
|
if (!debuggingActive) {
|
|
|
|
return SipKernelType::Csr;
|
|
|
|
}
|
|
|
|
return SipKernelType::DbgCsr;
|
|
|
|
}
|
2018-07-10 19:22:11 +08:00
|
|
|
|
2018-09-06 22:41:50 +08:00
|
|
|
template <typename Family>
|
|
|
|
size_t HwHelperHw<Family>::getMaxBarrierRegisterPerSlice() const {
|
|
|
|
return 32;
|
|
|
|
}
|
2018-09-26 03:44:36 +08:00
|
|
|
|
2019-08-23 06:23:10 +08:00
|
|
|
template <typename Family>
|
|
|
|
uint32_t HwHelperHw<Family>::getPitchAlignmentForImage(const HardwareInfo *hwInfo) {
|
|
|
|
return 4u;
|
|
|
|
}
|
|
|
|
|
2020-04-21 01:33:19 +08:00
|
|
|
template <typename Family>
|
|
|
|
uint32_t HwHelperHw<Family>::getMaxNumSamplers() const {
|
|
|
|
return 16;
|
|
|
|
}
|
|
|
|
|
2018-09-26 03:44:36 +08:00
|
|
|
template <typename Family>
|
2019-03-27 17:06:29 +08:00
|
|
|
const AubMemDump::LrcaHelper &HwHelperHw<Family>::getCsTraits(aub_stream::EngineType engineType) const {
|
2019-03-20 17:56:22 +08:00
|
|
|
return *AUBFamilyMapper<Family>::csTraits[engineType];
|
2018-09-26 03:44:36 +08:00
|
|
|
}
|
2018-10-03 01:10:29 +08:00
|
|
|
|
|
|
|
template <typename Family>
|
|
|
|
bool HwHelperHw<Family>::isPageTableManagerSupported(const HardwareInfo &hwInfo) const {
|
|
|
|
return false;
|
|
|
|
}
|
2018-09-24 16:36:29 +08:00
|
|
|
|
2020-02-13 20:28:21 +08:00
|
|
|
template <typename Family>
|
|
|
|
bool HwHelperHw<Family>::isFenceAllocationRequired(const HardwareInfo &hwInfo) const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-03-29 18:48:32 +08:00
|
|
|
template <typename GfxFamily>
|
2019-11-14 21:34:34 +08:00
|
|
|
inline bool HwHelperHw<GfxFamily>::checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) {
|
|
|
|
return true;
|
2019-03-29 18:48:32 +08:00
|
|
|
}
|
|
|
|
|
2018-11-22 22:16:20 +08:00
|
|
|
template <typename Family>
|
2020-02-25 20:32:27 +08:00
|
|
|
void HwHelperHw<Family>::setRenderSurfaceStateForBuffer(const RootDeviceEnvironment &rootDeviceEnvironment,
|
2018-11-22 22:16:20 +08:00
|
|
|
void *surfaceStateBuffer,
|
|
|
|
size_t bufferSize,
|
|
|
|
uint64_t gpuVa,
|
|
|
|
size_t offset,
|
|
|
|
uint32_t pitch,
|
|
|
|
GraphicsAllocation *gfxAlloc,
|
2019-11-14 21:34:34 +08:00
|
|
|
bool isReadOnly,
|
2018-11-22 22:16:20 +08:00
|
|
|
uint32_t surfaceType,
|
2020-05-07 17:52:25 +08:00
|
|
|
bool forceNonAuxMode,
|
|
|
|
bool useL1Cache) {
|
2018-11-22 22:16:20 +08:00
|
|
|
using RENDER_SURFACE_STATE = typename Family::RENDER_SURFACE_STATE;
|
|
|
|
using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT;
|
|
|
|
using AUXILIARY_SURFACE_MODE = typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE;
|
|
|
|
|
2020-02-25 20:32:27 +08:00
|
|
|
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
|
2018-11-22 22:16:20 +08:00
|
|
|
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(surfaceStateBuffer);
|
2020-04-28 00:55:26 +08:00
|
|
|
RENDER_SURFACE_STATE state = Family::cmdInitRenderSurfaceState;
|
2018-11-22 22:16:20 +08:00
|
|
|
auto surfaceSize = alignUp(bufferSize, 4);
|
|
|
|
|
|
|
|
SURFACE_STATE_BUFFER_LENGTH Length = {0};
|
|
|
|
Length.Length = static_cast<uint32_t>(surfaceSize - 1);
|
|
|
|
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setWidth(Length.SurfaceState.Width + 1);
|
|
|
|
state.setHeight(Length.SurfaceState.Height + 1);
|
|
|
|
state.setDepth(Length.SurfaceState.Depth + 1);
|
2018-11-22 22:16:20 +08:00
|
|
|
if (pitch) {
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setSurfacePitch(pitch);
|
2018-11-22 22:16:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// The graphics allocation for Host Ptr surface will be created in makeResident call and GPU address is expected to be the same as CPU address
|
|
|
|
auto bufferStateAddress = (gfxAlloc != nullptr) ? gfxAlloc->getGpuAddress() : gpuVa;
|
|
|
|
bufferStateAddress += offset;
|
|
|
|
|
|
|
|
auto bufferStateSize = (gfxAlloc != nullptr) ? gfxAlloc->getUnderlyingBufferSize() : bufferSize;
|
|
|
|
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setSurfaceType(static_cast<typename RENDER_SURFACE_STATE::SURFACE_TYPE>(surfaceType));
|
2018-11-22 22:16:20 +08:00
|
|
|
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setSurfaceFormat(SURFACE_FORMAT::SURFACE_FORMAT_RAW);
|
|
|
|
state.setSurfaceVerticalAlignment(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4);
|
|
|
|
state.setSurfaceHorizontalAlignment(RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT_HALIGN_4);
|
2018-11-22 22:16:20 +08:00
|
|
|
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setTileMode(RENDER_SURFACE_STATE::TILE_MODE_LINEAR);
|
|
|
|
state.setVerticalLineStride(0);
|
|
|
|
state.setVerticalLineStrideOffset(0);
|
2018-11-22 22:16:20 +08:00
|
|
|
if ((isAligned<MemoryConstants::cacheLineSize>(bufferStateAddress) && isAligned<MemoryConstants::cacheLineSize>(bufferStateSize)) ||
|
2019-11-14 21:34:34 +08:00
|
|
|
isReadOnly) {
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
|
2018-11-22 22:16:20 +08:00
|
|
|
} else {
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
|
2018-11-22 22:16:20 +08:00
|
|
|
}
|
|
|
|
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setSurfaceBaseAddress(bufferStateAddress);
|
2018-11-22 22:16:20 +08:00
|
|
|
|
2019-03-12 20:24:58 +08:00
|
|
|
Gmm *gmm = gfxAlloc ? gfxAlloc->getDefaultGmm() : nullptr;
|
2020-09-11 21:44:09 +08:00
|
|
|
if (gmm && gmm->isRenderCompressed && !forceNonAuxMode) {
|
2018-11-22 22:16:20 +08:00
|
|
|
// Its expected to not program pitch/qpitch/baseAddress for Aux surface in CCS scenarios
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setCoherencyType(RENDER_SURFACE_STATE::COHERENCY_TYPE_GPU_COHERENT);
|
|
|
|
state.setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
2018-11-22 22:16:20 +08:00
|
|
|
} else {
|
2020-04-28 00:55:26 +08:00
|
|
|
state.setCoherencyType(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT);
|
|
|
|
state.setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
|
2018-11-22 22:16:20 +08:00
|
|
|
}
|
2020-04-28 00:55:26 +08:00
|
|
|
*surfaceState = state;
|
2020-05-07 17:52:25 +08:00
|
|
|
|
|
|
|
setL1CachePolicy(useL1Cache, surfaceState, rootDeviceEnvironment.getHardwareInfo());
|
2018-11-22 22:16:20 +08:00
|
|
|
}
|
|
|
|
|
2020-05-07 17:52:25 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
void NEO::HwHelperHw<GfxFamily>::setL1CachePolicy(bool useL1Cache, typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) {}
|
|
|
|
|
2019-02-12 17:56:27 +08:00
|
|
|
template <typename Family>
|
|
|
|
bool HwHelperHw<Family>::getEnableLocalMemory(const HardwareInfo &hwInfo) const {
|
|
|
|
if (DebugManager.flags.EnableLocalMemory.get() != -1) {
|
|
|
|
return DebugManager.flags.EnableLocalMemory.get();
|
|
|
|
} else if (DebugManager.flags.AUBDumpForceAllToLocalMemory.get()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OSInterface::osEnableLocalMemory && isLocalMemoryEnabled(hwInfo);
|
|
|
|
}
|
2019-01-10 20:57:40 +08:00
|
|
|
|
2019-10-31 17:19:52 +08:00
|
|
|
template <typename Family>
|
|
|
|
AuxTranslationMode HwHelperHw<Family>::getAuxTranslationMode() {
|
|
|
|
if (DebugManager.flags.ForceAuxTranslationMode.get() != -1) {
|
|
|
|
return static_cast<AuxTranslationMode>(DebugManager.flags.ForceAuxTranslationMode.get());
|
|
|
|
}
|
|
|
|
|
2019-11-22 04:32:16 +08:00
|
|
|
return HwHelperHw<Family>::defaultAuxTranslationMode;
|
2019-10-31 17:19:52 +08:00
|
|
|
}
|
|
|
|
|
2019-11-10 02:02:25 +08:00
|
|
|
template <typename Family>
|
2019-11-25 16:18:26 +08:00
|
|
|
bool HwHelperHw<Family>::isBlitAuxTranslationRequired(const HardwareInfo &hwInfo, const MultiDispatchInfo &multiDispatchInfo) {
|
2019-11-10 02:02:25 +08:00
|
|
|
return (HwHelperHw<Family>::getAuxTranslationMode() == AuxTranslationMode::Blit) &&
|
2019-11-25 16:18:26 +08:00
|
|
|
hwInfo.capabilityTable.blitterOperationsSupported &&
|
2019-11-10 02:02:25 +08:00
|
|
|
multiDispatchInfo.getMemObjsForAuxTranslation() &&
|
|
|
|
(multiDispatchInfo.getMemObjsForAuxTranslation()->size() > 0);
|
|
|
|
}
|
|
|
|
|
2020-04-27 03:48:59 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
void MemorySynchronizationCommands<GfxFamily>::addPipeControlAndProgramPostSyncOperation(
|
|
|
|
LinearStream &commandStream,
|
|
|
|
POST_SYNC_OPERATION operation,
|
|
|
|
uint64_t gpuAddress,
|
|
|
|
uint64_t immediateData,
|
|
|
|
const HardwareInfo &hwInfo,
|
|
|
|
PipeControlArgs &args) {
|
|
|
|
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
2020-02-08 05:48:09 +08:00
|
|
|
addPipeControlWA(commandStream, gpuAddress, hwInfo);
|
2019-07-11 20:35:40 +08:00
|
|
|
|
2020-09-07 22:30:58 +08:00
|
|
|
setPostSyncExtraProperties(args, hwInfo);
|
|
|
|
addPipeControlWithPostSync(commandStream, operation, gpuAddress, immediateData, args);
|
|
|
|
|
|
|
|
MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(commandStream, gpuAddress, hwInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
void MemorySynchronizationCommands<GfxFamily>::addPipeControlWithPostSync(
|
|
|
|
LinearStream &commandStream,
|
|
|
|
POST_SYNC_OPERATION operation,
|
|
|
|
uint64_t gpuAddress,
|
|
|
|
uint64_t immediateData,
|
|
|
|
PipeControlArgs &args) {
|
|
|
|
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
|
|
|
|
2020-04-27 03:48:59 +08:00
|
|
|
PIPE_CONTROL cmd = GfxFamily::cmdInitPipeControl;
|
|
|
|
setPipeControl(cmd, args);
|
2020-04-09 00:33:03 +08:00
|
|
|
cmd.setPostSyncOperation(operation);
|
|
|
|
cmd.setAddress(static_cast<uint32_t>(gpuAddress & 0x0000FFFFFFFFULL));
|
|
|
|
cmd.setAddressHigh(static_cast<uint32_t>(gpuAddress >> 32));
|
2019-03-21 00:08:05 +08:00
|
|
|
if (operation == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) {
|
2020-04-09 00:33:03 +08:00
|
|
|
cmd.setImmediateData(immediateData);
|
2019-03-21 00:08:05 +08:00
|
|
|
}
|
|
|
|
|
2020-09-07 22:30:58 +08:00
|
|
|
PIPE_CONTROL *pipeControl = commandStream.getSpaceForCmd<PIPE_CONTROL>();
|
2020-04-09 00:33:03 +08:00
|
|
|
*pipeControl = cmd;
|
2020-01-31 15:16:58 +08:00
|
|
|
}
|
|
|
|
|
2019-03-28 21:15:51 +08:00
|
|
|
template <typename GfxFamily>
|
2020-04-27 03:48:59 +08:00
|
|
|
void MemorySynchronizationCommands<GfxFamily>::setPipeControl(typename GfxFamily::PIPE_CONTROL &pipeControl, PipeControlArgs &args) {
|
2020-04-09 00:33:03 +08:00
|
|
|
pipeControl.setCommandStreamerStallEnable(true);
|
2020-04-27 03:48:59 +08:00
|
|
|
pipeControl.setDcFlushEnable(args.dcFlushEnable);
|
|
|
|
pipeControl.setConstantCacheInvalidationEnable(args.constantCacheInvalidationEnable);
|
|
|
|
pipeControl.setInstructionCacheInvalidateEnable(args.instructionCacheInvalidateEnable);
|
|
|
|
pipeControl.setPipeControlFlushEnable(args.pipeControlFlushEnable);
|
|
|
|
pipeControl.setRenderTargetCacheFlushEnable(args.renderTargetCacheFlushEnable);
|
|
|
|
pipeControl.setStateCacheInvalidationEnable(args.stateCacheInvalidationEnable);
|
|
|
|
pipeControl.setTextureCacheInvalidationEnable(args.textureCacheInvalidationEnable);
|
|
|
|
pipeControl.setVfCacheInvalidationEnable(args.vfCacheInvalidationEnable);
|
|
|
|
pipeControl.setGenericMediaStateClear(args.genericMediaStateClear);
|
|
|
|
|
|
|
|
setPipeControlExtraProperties(pipeControl, args);
|
2019-03-28 21:15:51 +08:00
|
|
|
|
|
|
|
if (DebugManager.flags.FlushAllCaches.get()) {
|
2020-04-09 00:33:03 +08:00
|
|
|
pipeControl.setDcFlushEnable(true);
|
|
|
|
pipeControl.setRenderTargetCacheFlushEnable(true);
|
|
|
|
pipeControl.setInstructionCacheInvalidateEnable(true);
|
|
|
|
pipeControl.setTextureCacheInvalidationEnable(true);
|
|
|
|
pipeControl.setPipeControlFlushEnable(true);
|
|
|
|
pipeControl.setVfCacheInvalidationEnable(true);
|
|
|
|
pipeControl.setConstantCacheInvalidationEnable(true);
|
|
|
|
pipeControl.setStateCacheInvalidationEnable(true);
|
2019-03-28 21:15:51 +08:00
|
|
|
}
|
2020-09-30 21:06:42 +08:00
|
|
|
if (DebugManager.flags.DoNotFlushCaches.get()) {
|
|
|
|
pipeControl.setDcFlushEnable(false);
|
|
|
|
pipeControl.setRenderTargetCacheFlushEnable(false);
|
|
|
|
pipeControl.setInstructionCacheInvalidateEnable(false);
|
|
|
|
pipeControl.setTextureCacheInvalidationEnable(false);
|
|
|
|
pipeControl.setPipeControlFlushEnable(false);
|
|
|
|
pipeControl.setVfCacheInvalidationEnable(false);
|
|
|
|
pipeControl.setConstantCacheInvalidationEnable(false);
|
|
|
|
pipeControl.setStateCacheInvalidationEnable(false);
|
|
|
|
}
|
2019-03-28 21:15:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2020-04-27 03:48:59 +08:00
|
|
|
void MemorySynchronizationCommands<GfxFamily>::addPipeControl(LinearStream &commandStream, PipeControlArgs &args) {
|
2020-04-09 00:33:03 +08:00
|
|
|
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
|
|
|
PIPE_CONTROL cmd = GfxFamily::cmdInitPipeControl;
|
2020-04-27 03:48:59 +08:00
|
|
|
MemorySynchronizationCommands<GfxFamily>::setPipeControl(cmd, args);
|
2020-04-09 00:33:03 +08:00
|
|
|
auto pipeControl = commandStream.getSpaceForCmd<PIPE_CONTROL>();
|
|
|
|
*pipeControl = cmd;
|
2019-07-11 20:35:40 +08:00
|
|
|
}
|
|
|
|
|
2020-07-06 15:34:15 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
void MemorySynchronizationCommands<GfxFamily>::addPipeControlWithCSStallOnly(LinearStream &commandStream, PipeControlArgs &args) {
|
|
|
|
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
|
|
|
PIPE_CONTROL cmd = GfxFamily::cmdInitPipeControl;
|
|
|
|
cmd.setCommandStreamerStallEnable(true);
|
|
|
|
auto pipeControl = commandStream.getSpaceForCmd<PIPE_CONTROL>();
|
|
|
|
*pipeControl = cmd;
|
|
|
|
}
|
|
|
|
|
2019-07-11 20:35:40 +08:00
|
|
|
template <typename GfxFamily>
|
2020-02-17 19:45:24 +08:00
|
|
|
size_t MemorySynchronizationCommands<GfxFamily>::getSizeForSinglePipeControl() {
|
2019-07-11 20:35:40 +08:00
|
|
|
return sizeof(typename GfxFamily::PIPE_CONTROL);
|
2019-03-28 21:15:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2020-02-17 19:45:24 +08:00
|
|
|
size_t MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(const HardwareInfo &hwInfo) {
|
2020-10-06 00:32:55 +08:00
|
|
|
const auto pipeControlCount = MemorySynchronizationCommands<GfxFamily>::isPipeControlWArequired(hwInfo) ? 2u : 1u;
|
2020-02-08 05:48:09 +08:00
|
|
|
return pipeControlCount * getSizeForSinglePipeControl() + getSizeForAdditonalSynchronization(hwInfo);
|
2019-03-28 21:15:51 +08:00
|
|
|
}
|
|
|
|
|
2020-03-11 18:27:19 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
void MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
inline size_t MemorySynchronizationCommands<GfxFamily>::getSizeForSingleSynchronization(const HardwareInfo &hwInfo) {
|
|
|
|
return 0u;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
inline size_t MemorySynchronizationCommands<GfxFamily>::getSizeForAdditonalSynchronization(const HardwareInfo &hwInfo) {
|
|
|
|
return 0u;
|
|
|
|
}
|
|
|
|
|
2019-05-20 17:19:27 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t HwHelperHw<GfxFamily>::getMetricsLibraryGenId() const {
|
|
|
|
return static_cast<uint32_t>(MetricsLibraryApi::ClientGen::Gen9);
|
|
|
|
}
|
2019-09-05 14:24:22 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2020-10-04 05:11:39 +08:00
|
|
|
inline bool HwHelperHw<GfxFamily>::requiresAuxResolves(const KernelInfo &kernelInfo) const {
|
|
|
|
return hasStatelessAccessToBuffer(kernelInfo);
|
2019-09-05 14:24:22 +08:00
|
|
|
}
|
2019-09-06 16:25:14 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2019-11-14 21:34:34 +08:00
|
|
|
bool HwHelperHw<GfxFamily>::tilingAllowed(bool isSharedContext, bool isImage1d, bool forceLinearStorage) {
|
2019-09-06 16:25:14 +08:00
|
|
|
if (DebugManager.flags.ForceLinearImages.get() || forceLinearStorage || isSharedContext) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-11-14 21:34:34 +08:00
|
|
|
return !isImage1d;
|
2019-09-06 16:25:14 +08:00
|
|
|
}
|
2019-11-08 01:49:46 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t HwHelperHw<GfxFamily>::alignSlmSize(uint32_t slmSize) {
|
2020-06-09 03:49:11 +08:00
|
|
|
if (slmSize == 0u) {
|
|
|
|
return 0u;
|
|
|
|
}
|
|
|
|
slmSize = std::max(slmSize, 1024u);
|
|
|
|
slmSize = Math::nextPowerOfTwo(slmSize);
|
|
|
|
UNRECOVERABLE_IF(slmSize > 64u * KB);
|
|
|
|
return slmSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t HwHelperHw<GfxFamily>::computeSlmValues(uint32_t slmSize) {
|
|
|
|
auto value = std::max(slmSize, 1024u);
|
|
|
|
value = Math::nextPowerOfTwo(value);
|
|
|
|
value = Math::getMinLsbSet(value);
|
|
|
|
value = value - 9;
|
|
|
|
DEBUG_BREAK_IF(value > 7);
|
|
|
|
return value * !!slmSize;
|
2019-11-08 01:49:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t HwHelperHw<GfxFamily>::getBarriersCountFromHasBarriers(uint32_t hasBarriers) {
|
|
|
|
return hasBarriers;
|
|
|
|
}
|
|
|
|
|
2019-12-13 23:31:09 +08:00
|
|
|
template <typename GfxFamily>
|
2020-03-19 22:15:51 +08:00
|
|
|
inline bool HwHelperHw<GfxFamily>::isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-07-17 23:04:52 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t HwHelperHw<GfxFamily>::getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const {
|
|
|
|
return CommonConstants::invalidStepping;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t HwHelperHw<GfxFamily>::getSteppingFromHwRevId(uint32_t hwRevId, const HardwareInfo &hwInfo) const {
|
|
|
|
return CommonConstants::invalidStepping;
|
|
|
|
}
|
|
|
|
|
2020-06-29 19:07:41 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
bool HwHelperHw<GfxFamily>::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo) const {
|
2020-07-17 23:04:52 +08:00
|
|
|
auto lowestHwRevIdWithBug = getHwRevIdFromStepping(lowestSteppingWithBug, hwInfo);
|
|
|
|
auto hwRevIdWithFix = getHwRevIdFromStepping(steppingWithFix, hwInfo);
|
|
|
|
if ((lowestHwRevIdWithBug == CommonConstants::invalidStepping) || (hwRevIdWithFix == CommonConstants::invalidStepping)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return (lowestHwRevIdWithBug <= hwInfo.platform.usRevId && hwInfo.platform.usRevId < hwRevIdWithFix);
|
2020-06-29 19:07:41 +08:00
|
|
|
}
|
|
|
|
|
2020-03-19 22:15:51 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
bool HwHelperHw<GfxFamily>::is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const {
|
2019-12-13 23:31:09 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
bool HwHelperHw<GfxFamily>::isForceDefaultRCSEngineWARequired(const HardwareInfo &hwInfo) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-12-19 21:26:29 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
bool HwHelperHw<GfxFamily>::isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-01-28 01:02:27 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
inline uint32_t HwHelperHw<GfxFamily>::getMinimalSIMDSize() {
|
|
|
|
return 8u;
|
|
|
|
}
|
|
|
|
|
2020-01-18 03:45:48 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t HwHelperHw<GfxFamily>::getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const {
|
|
|
|
return HwHelper::getMaxThreadsForWorkgroup(hwInfo, maxNumEUsPerSubSlice);
|
|
|
|
}
|
2020-02-10 18:02:21 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2020-03-13 20:14:28 +08:00
|
|
|
inline bool HwHelperHw<GfxFamily>::isFusedEuDispatchEnabled(const HardwareInfo &hwInfo) const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-05-07 19:51:31 +08:00
|
|
|
template <typename GfxFamily>
|
2020-05-12 21:14:10 +08:00
|
|
|
inline bool HwHelperHw<GfxFamily>::isSpecialWorkgroupSizeRequired(const HardwareInfo &hwInfo, bool isSimulation) const {
|
2020-05-07 19:51:31 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-22 23:07:34 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
inline bool HwHelperHw<GfxFamily>::allowRenderCompression(const HardwareInfo &hwInfo) const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-07-10 23:04:42 +08:00
|
|
|
template <typename GfxFamily>
|
2020-10-09 17:52:00 +08:00
|
|
|
inline bool HwHelperHw<GfxFamily>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const {
|
|
|
|
return allocation.isAllocatedInLocalMemoryPool() &&
|
|
|
|
(getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) &&
|
2020-10-07 18:37:13 +08:00
|
|
|
hwInfo.capabilityTable.blitterOperationsSupported;
|
2020-07-10 23:04:42 +08:00
|
|
|
}
|
|
|
|
|
2020-08-10 16:25:07 +08:00
|
|
|
template <typename GfxFamily>
|
2020-08-31 21:34:23 +08:00
|
|
|
inline bool HwHelperHw<GfxFamily>::forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo, GraphicsAllocation *allocation) const {
|
2020-08-10 16:25:07 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-07-17 21:43:35 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
LocalMemoryAccessMode HwHelperHw<GfxFamily>::getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
|
|
|
switch (static_cast<LocalMemoryAccessMode>(DebugManager.flags.ForceLocalMemoryAccessMode.get())) {
|
|
|
|
case LocalMemoryAccessMode::Default:
|
|
|
|
case LocalMemoryAccessMode::CpuAccessAllowed:
|
|
|
|
case LocalMemoryAccessMode::CpuAccessDisallowed:
|
|
|
|
return static_cast<LocalMemoryAccessMode>(DebugManager.flags.ForceLocalMemoryAccessMode.get());
|
|
|
|
}
|
|
|
|
return getDefaultLocalMemoryAccessMode(hwInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
inline LocalMemoryAccessMode HwHelperHw<GfxFamily>::getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
|
|
|
return LocalMemoryAccessMode::Default;
|
|
|
|
}
|
|
|
|
|
2020-10-04 05:11:39 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
inline bool HwHelperHw<GfxFamily>::hasStatelessAccessToBuffer(const KernelInfo &kernelInfo) const {
|
|
|
|
bool hasStatelessAccessToBuffer = false;
|
|
|
|
for (uint32_t i = 0; i < kernelInfo.kernelArgInfo.size(); ++i) {
|
|
|
|
if (kernelInfo.kernelArgInfo[i].isBuffer) {
|
|
|
|
hasStatelessAccessToBuffer |= !kernelInfo.kernelArgInfo[i].pureStatefulBufferAccess;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return hasStatelessAccessToBuffer;
|
|
|
|
}
|
|
|
|
|
2020-03-13 20:14:28 +08:00
|
|
|
template <typename GfxFamily>
|
2020-02-17 19:45:24 +08:00
|
|
|
size_t MemorySynchronizationCommands<GfxFamily>::getSizeForFullCacheFlush() {
|
2020-02-10 18:02:21 +08:00
|
|
|
return sizeof(typename GfxFamily::PIPE_CONTROL);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2020-04-27 03:48:59 +08:00
|
|
|
void MemorySynchronizationCommands<GfxFamily>::addFullCacheFlush(LinearStream &commandStream) {
|
2020-04-09 00:33:03 +08:00
|
|
|
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
|
|
|
|
|
|
|
PIPE_CONTROL *pipeControl = commandStream.getSpaceForCmd<PIPE_CONTROL>();
|
|
|
|
PIPE_CONTROL cmd = GfxFamily::cmdInitPipeControl;
|
2020-02-10 18:02:21 +08:00
|
|
|
|
2020-04-27 03:48:59 +08:00
|
|
|
PipeControlArgs args(true);
|
|
|
|
args.renderTargetCacheFlushEnable = true;
|
|
|
|
args.instructionCacheInvalidateEnable = true;
|
|
|
|
args.textureCacheInvalidationEnable = true;
|
|
|
|
args.pipeControlFlushEnable = true;
|
|
|
|
args.constantCacheInvalidationEnable = true;
|
|
|
|
args.stateCacheInvalidationEnable = true;
|
2020-09-30 21:06:42 +08:00
|
|
|
MemorySynchronizationCommands<GfxFamily>::setCacheFlushExtraProperties(args);
|
2020-04-27 03:48:59 +08:00
|
|
|
MemorySynchronizationCommands<GfxFamily>::setPipeControl(cmd, args);
|
2020-04-09 00:33:03 +08:00
|
|
|
*pipeControl = cmd;
|
2020-02-10 18:02:21 +08:00
|
|
|
}
|
|
|
|
|
2020-02-20 16:20:33 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
const StackVec<size_t, 3> HwHelperHw<GfxFamily>::getDeviceSubGroupSizes() const {
|
|
|
|
return {8, 16, 32};
|
|
|
|
}
|
|
|
|
|
2020-06-19 21:50:16 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
const StackVec<uint32_t, 6> HwHelperHw<GfxFamily>::getThreadsPerEUConfigs() const {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2020-06-02 19:38:02 +08:00
|
|
|
template <typename GfxFamily>
|
2020-07-01 17:12:48 +08:00
|
|
|
void HwHelperHw<GfxFamily>::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const {}
|
2020-06-02 19:38:02 +08:00
|
|
|
|
2020-07-21 23:24:26 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
bool HwHelperHw<GfxFamily>::isBankOverrideRequired(const HardwareInfo &hwInfo) const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-08-04 02:39:06 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t HwHelperHw<GfxFamily>::getDefaultThreadArbitrationPolicy() const {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-09-03 15:06:11 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
bool HwHelperHw<GfxFamily>::useOnlyGlobalTimestamps() const {
|
|
|
|
return false;
|
|
|
|
}
|
2020-09-22 00:08:07 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
bool HwHelperHw<GfxFamily>::useSystemMemoryPlacementForISA(const HardwareInfo &hwInfo) const {
|
2020-09-22 21:48:24 +08:00
|
|
|
return !hwInfo.featureTable.ftrLocalMemory;
|
2020-09-22 00:08:07 +08:00
|
|
|
}
|
2020-09-23 23:01:19 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
bool HwHelperHw<GfxFamily>::packedFormatsSupported() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-10-06 00:32:55 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
bool MemorySynchronizationCommands<GfxFamily>::isPipeControlPriorToPipelineSelectWArequired(const HardwareInfo &hwInfo) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|