refactor: reposition preamble helper implementation methods

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-10-19 22:32:43 +00:00
committed by Compute-Runtime-Automation
parent ad3aeb6eea
commit 2e09b5ff66
16 changed files with 267 additions and 176 deletions

View File

@@ -173,6 +173,12 @@ if(SUPPORT_XEHP_AND_LATER)
)
endif()
if(SUPPORT_XE_HPG_CORE OR SUPPORT_XE_HPC_CORE)
list(APPEND NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/preamble_xe_hpg_and_xe_hpc.inl
)
endif()
if(SUPPORT_DG2_AND_LATER)
list(APPEND NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/gfx_core_helper_dg2_and_later.inl

View File

@@ -53,17 +53,6 @@ size_t PreambleHelper<GfxFamily>::getAdditionalCommandsSize(const Device &device
return totalSize;
}
template <typename GfxFamily>
size_t PreambleHelper<GfxFamily>::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) {
size_t size = 0;
using PIPELINE_SELECT = typename GfxFamily::PIPELINE_SELECT;
size += sizeof(PIPELINE_SELECT);
if (MemorySynchronizationCommands<GfxFamily>::isBarrierPriorToPipelineSelectWaRequired(rootDeviceEnvironment)) {
size += sizeof(PIPE_CONTROL);
}
return size;
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
GraphicsAllocation *preemptionCsr) {
@@ -86,9 +75,6 @@ size_t PreambleHelper<GfxFamily>::getKernelDebuggingCommandsSize(bool debuggingA
return 0;
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd) {}
template <typename GfxFamily>
uint32_t PreambleHelper<GfxFamily>::getScratchSizeValueToProgramMediaVfeState(uint32_t scratchSize) {
scratchSize >>= static_cast<uint32_t>(MemoryConstants::kiloByteShiftSize);

View File

@@ -73,4 +73,13 @@ size_t PreambleHelper<GfxFamily>::getVFECommandsSize() {
return sizeof(MEDIA_VFE_STATE) + sizeof(PIPE_CONTROL);
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd) {}
template <typename GfxFamily>
size_t PreambleHelper<GfxFamily>::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) {
using PIPELINE_SELECT = typename GfxFamily::PIPELINE_SELECT;
return sizeof(PIPELINE_SELECT);
}
} // namespace NEO

View File

@@ -0,0 +1,85 @@
/*
* Copyright (C) 2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/pipe_control_args.h"
#include "shared/source/helpers/pipeline_select_args.h"
#include "shared/source/helpers/pipeline_select_helper.h"
#include "shared/source/helpers/preamble.h"
namespace NEO {
template <typename Family>
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
const PipelineSelectArgs &pipelineSelectArgs,
const RootDeviceEnvironment &rootDeviceEnvironment) {
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;
if (DebugManager.flags.CleanStateInPreamble.get()) {
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_3D);
*cmdBuffer = cmd;
PipeControlArgs args = {};
args.stateCacheInvalidationEnable = true;
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
}
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
auto mask = pipelineSelectEnablePipelineSelectMaskBits;
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
if constexpr (Family::isUsingMediaSamplerDopClockGate) {
mask |= pipelineSelectMediaSamplerDopClockGateMaskBits;
cmd.setMediaSamplerDopClockGateEnable(!pipelineSelectArgs.mediaSamplerRequired);
}
bool systolicSupport = pipelineSelectArgs.systolicPipelineSelectSupport;
bool systolicValue = pipelineSelectArgs.systolicPipelineSelectMode;
int32_t overrideSystolic = DebugManager.flags.OverrideSystolicPipelineSelect.get();
if (overrideSystolic != -1) {
systolicSupport = true;
systolicValue = !!overrideSystolic;
}
if (systolicSupport) {
cmd.setSystolicModeEnable(systolicValue);
mask |= pipelineSelectSystolicModeEnableMaskBits;
}
cmd.setMaskBits(mask);
*cmdBuffer = cmd;
if (DebugManager.flags.CleanStateInPreamble.get()) {
PipeControlArgs args = {};
args.stateCacheInvalidationEnable = true;
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
}
}
template <typename Family>
size_t PreambleHelper<Family>::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) {
size_t size = 0;
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
size += sizeof(PIPELINE_SELECT);
if (DebugManager.flags.CleanStateInPreamble.get()) {
size += sizeof(PIPELINE_SELECT);
size += 2 * MemorySynchronizationCommands<Family>::getSizeForSingleBarrier(false);
}
return size;
}
} // namespace NEO

View File

@@ -15,82 +15,20 @@
#include "reg_configs_common.h"
// L3 programming:
// All L3 Client Pool: 320KB
// URB Pool: 64KB
// Use Full ways: true
// SLM: reserved (always enabled)
namespace NEO {
template <typename Family>
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
const PipelineSelectArgs &pipelineSelectArgs,
const RootDeviceEnvironment &rootDeviceEnvironment) {
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;
if (DebugManager.flags.CleanStateInPreamble.get()) {
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_3D);
*cmdBuffer = cmd;
PipeControlArgs args = {};
args.stateCacheInvalidationEnable = true;
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
}
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
auto mask = pipelineSelectEnablePipelineSelectMaskBits;
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
if constexpr (Family::isUsingMediaSamplerDopClockGate) {
mask |= pipelineSelectMediaSamplerDopClockGateMaskBits;
cmd.setMediaSamplerDopClockGateEnable(!pipelineSelectArgs.mediaSamplerRequired);
}
bool systolicSupport = pipelineSelectArgs.systolicPipelineSelectSupport;
bool systolicValue = pipelineSelectArgs.systolicPipelineSelectMode;
int32_t overrideSystolic = DebugManager.flags.OverrideSystolicPipelineSelect.get();
if (overrideSystolic != -1) {
systolicSupport = true;
systolicValue = !!overrideSystolic;
}
if (systolicSupport) {
cmd.setSystolicModeEnable(systolicValue);
mask |= pipelineSelectSystolicModeEnableMaskBits;
}
cmd.setMaskBits(mask);
*cmdBuffer = cmd;
if (DebugManager.flags.CleanStateInPreamble.get()) {
PipeControlArgs args = {};
args.stateCacheInvalidationEnable = true;
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
}
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
}
template <>
void PreambleHelper<Family>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
template <typename GfxFamily>
void PreambleHelper<GfxFamily>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
}
template <>
void PreambleHelper<Family>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
}
template <>
uint32_t PreambleHelper<Family>::getUrbEntryAllocationSize() {
template <typename GfxFamily>
uint32_t PreambleHelper<GfxFamily>::getUrbEntryAllocationSize() {
return 0u;
}
template <>
void PreambleHelper<Family>::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd);
template <typename GfxFamily>
void *PreambleHelper<GfxFamily>::getSpaceForVfeState(LinearStream *pCommandStream,
@@ -130,8 +68,8 @@ void PreambleHelper<GfxFamily>::programVfeState(void *pVfeState,
*cfeState = cmd;
}
template <>
uint64_t PreambleHelper<Family>::getScratchSpaceAddressOffsetForVfeState(LinearStream *pCommandStream, void *pVfeState) {
template <typename GfxFamily>
uint64_t PreambleHelper<GfxFamily>::getScratchSpaceAddressOffsetForVfeState(LinearStream *pCommandStream, void *pVfeState) {
return 0;
}
@@ -141,8 +79,8 @@ size_t PreambleHelper<GfxFamily>::getVFECommandsSize() {
return sizeof(CFE_STATE);
}
template <>
uint32_t PreambleHelper<Family>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
template <typename GfxFamily>
uint32_t PreambleHelper<GfxFamily>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
return 0u;
}