2021-04-24 00:43:48 +08:00
|
|
|
/*
|
2023-01-09 23:02:00 +08:00
|
|
|
* Copyright (C) 2021-2023 Intel Corporation
|
2021-04-24 00:43:48 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "shared/source/command_stream/csr_definitions.h"
|
|
|
|
#include "shared/source/command_stream/stream_properties.h"
|
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
2023-02-02 00:23:01 +08:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2023-01-09 23:02:00 +08:00
|
|
|
#include "shared/source/helpers/pipe_control_args.h"
|
2021-04-24 00:43:48 +08:00
|
|
|
#include "shared/source/helpers/pipeline_select_helper.h"
|
|
|
|
#include "shared/source/helpers/preamble_base.inl"
|
|
|
|
|
|
|
|
#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 {
|
|
|
|
|
2021-12-30 01:35:55 +08:00
|
|
|
template <typename Family>
|
2021-04-24 00:43:48 +08:00
|
|
|
void PreambleHelper<Family>::programPipelineSelect(LinearStream *pCommandStream,
|
|
|
|
const PipelineSelectArgs &pipelineSelectArgs,
|
2023-01-26 11:58:18 +08:00
|
|
|
const RootDeviceEnvironment &rootDeviceEnvironment) {
|
2021-04-24 00:43:48 +08:00
|
|
|
|
|
|
|
using PIPELINE_SELECT = typename Family::PIPELINE_SELECT;
|
|
|
|
|
|
|
|
PIPELINE_SELECT cmd = Family::cmdInitPipelineSelect;
|
|
|
|
|
|
|
|
if (DebugManager.flags.CleanStateInPreamble.get()) {
|
2022-08-31 21:26:29 +08:00
|
|
|
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
|
2021-04-24 00:43:48 +08:00
|
|
|
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_3D);
|
2022-08-31 21:26:29 +08:00
|
|
|
*cmdBuffer = cmd;
|
2021-04-24 00:43:48 +08:00
|
|
|
|
2022-05-13 08:29:53 +08:00
|
|
|
PipeControlArgs args = {};
|
|
|
|
args.stateCacheInvalidationEnable = true;
|
2022-07-21 22:28:10 +08:00
|
|
|
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
|
2021-04-24 00:43:48 +08:00
|
|
|
}
|
|
|
|
|
2022-08-31 21:26:29 +08:00
|
|
|
auto cmdBuffer = pCommandStream->getSpaceForCmd<PIPELINE_SELECT>();
|
2021-04-24 00:43:48 +08:00
|
|
|
|
2021-12-21 22:52:58 +08:00
|
|
|
auto mask = pipelineSelectEnablePipelineSelectMaskBits;
|
2021-04-24 00:43:48 +08:00
|
|
|
|
|
|
|
cmd.setPipelineSelection(PIPELINE_SELECT::PIPELINE_SELECTION_GPGPU);
|
2021-12-30 01:35:55 +08:00
|
|
|
if constexpr (Family::isUsingMediaSamplerDopClockGate) {
|
|
|
|
mask |= pipelineSelectMediaSamplerDopClockGateMaskBits;
|
|
|
|
cmd.setMediaSamplerDopClockGateEnable(!pipelineSelectArgs.mediaSamplerRequired);
|
|
|
|
}
|
2021-04-24 00:43:48 +08:00
|
|
|
|
2022-09-15 08:28:41 +08:00
|
|
|
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);
|
2021-04-24 00:43:48 +08:00
|
|
|
|
2022-08-31 21:26:29 +08:00
|
|
|
*cmdBuffer = cmd;
|
2021-04-24 00:43:48 +08:00
|
|
|
|
|
|
|
if (DebugManager.flags.CleanStateInPreamble.get()) {
|
2022-05-13 08:29:53 +08:00
|
|
|
PipeControlArgs args = {};
|
|
|
|
args.stateCacheInvalidationEnable = true;
|
2022-07-21 22:28:10 +08:00
|
|
|
MemorySynchronizationCommands<Family>::addSingleBarrier(*pCommandStream, args);
|
2021-04-24 00:43:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void PreambleHelper<Family>::addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType) {
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void PreambleHelper<Family>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
uint32_t PreambleHelper<Family>::getUrbEntryAllocationSize() {
|
|
|
|
return 0u;
|
|
|
|
}
|
|
|
|
template <>
|
2022-12-20 23:56:50 +08:00
|
|
|
void PreambleHelper<Family>::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd);
|
2021-04-24 00:43:48 +08:00
|
|
|
|
2022-06-25 00:50:31 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
void *PreambleHelper<GfxFamily>::getSpaceForVfeState(LinearStream *pCommandStream,
|
|
|
|
const HardwareInfo &hwInfo,
|
|
|
|
EngineGroupType engineGroupType) {
|
2021-04-24 00:43:48 +08:00
|
|
|
using CFE_STATE = typename Family::CFE_STATE;
|
|
|
|
return pCommandStream->getSpace(sizeof(CFE_STATE));
|
|
|
|
}
|
|
|
|
|
2021-11-23 20:22:28 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
void PreambleHelper<GfxFamily>::programVfeState(void *pVfeState,
|
2022-12-20 23:56:50 +08:00
|
|
|
const RootDeviceEnvironment &rootDeviceEnvironment,
|
2021-11-23 20:22:28 +08:00
|
|
|
uint32_t scratchSize,
|
|
|
|
uint64_t scratchAddress,
|
|
|
|
uint32_t maxFrontEndThreads,
|
2022-06-25 00:50:31 +08:00
|
|
|
const StreamProperties &streamProperties,
|
|
|
|
LogicalStateHelper *logicalStateHelper) {
|
2021-04-24 00:43:48 +08:00
|
|
|
using CFE_STATE = typename Family::CFE_STATE;
|
|
|
|
|
|
|
|
auto cfeState = reinterpret_cast<CFE_STATE *>(pVfeState);
|
|
|
|
CFE_STATE cmd = Family::cmdInitCfeState;
|
|
|
|
|
|
|
|
uint32_t lowAddress = uint32_t(0xFFFFFFFF & scratchAddress);
|
|
|
|
cmd.setScratchSpaceBuffer(lowAddress);
|
|
|
|
cmd.setMaximumNumberOfThreads(maxFrontEndThreads);
|
2022-12-20 23:56:50 +08:00
|
|
|
appendProgramVFEState(rootDeviceEnvironment, streamProperties, &cmd);
|
2021-04-24 00:43:48 +08:00
|
|
|
|
|
|
|
if (DebugManager.flags.CFEMaximumNumberOfThreads.get() != -1) {
|
|
|
|
cmd.setMaximumNumberOfThreads(DebugManager.flags.CFEMaximumNumberOfThreads.get());
|
|
|
|
}
|
|
|
|
if (DebugManager.flags.CFEOverDispatchControl.get() != -1) {
|
|
|
|
cmd.setOverDispatchControl(static_cast<typename CFE_STATE::OVER_DISPATCH_CONTROL>(DebugManager.flags.CFEOverDispatchControl.get()));
|
|
|
|
}
|
|
|
|
if (DebugManager.flags.CFELargeGRFThreadAdjustDisable.get() != -1) {
|
|
|
|
cmd.setLargeGRFThreadAdjustDisable(DebugManager.flags.CFELargeGRFThreadAdjustDisable.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
*cfeState = cmd;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
uint64_t PreambleHelper<Family>::getScratchSpaceAddressOffsetForVfeState(LinearStream *pCommandStream, void *pVfeState) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-06-25 00:50:31 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
size_t PreambleHelper<GfxFamily>::getVFECommandsSize() {
|
2021-04-24 00:43:48 +08:00
|
|
|
using CFE_STATE = typename Family::CFE_STATE;
|
|
|
|
return sizeof(CFE_STATE);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
uint32_t PreambleHelper<Family>::getL3Config(const HardwareInfo &hwInfo, bool useSLM) {
|
|
|
|
return 0u;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
const uint32_t L3CNTLRegisterOffset<Family>::registerOffset = std::numeric_limits<uint32_t>::max();
|
|
|
|
|
2021-09-24 00:46:42 +08:00
|
|
|
template <>
|
|
|
|
struct DebugModeRegisterOffset<Family> {
|
|
|
|
enum {
|
|
|
|
registerOffset = 0x20d8,
|
|
|
|
debugEnabledValue = (1 << 5) | (1 << 21)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct TdDebugControlRegisterOffset<Family> {
|
|
|
|
enum {
|
|
|
|
registerOffset = 0xe400,
|
|
|
|
debugEnabledValue = (1 << 7) | (1 << 4) | (1 << 2) | (1 << 0)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-04-24 00:43:48 +08:00
|
|
|
} // namespace NEO
|