2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2022-03-25 21:04:08 +00:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/preemption.h"
|
|
|
|
|
#include "shared/source/command_stream/preemption.inl"
|
2022-05-25 14:39:35 +00:00
|
|
|
#include "shared/source/gen8/hw_cmds_base.h"
|
2022-03-25 21:04:08 +00:00
|
|
|
#include "shared/source/helpers/register_offsets.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2022-07-25 15:30:11 +00:00
|
|
|
using GfxFamily = Gen8Family;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-02-12 13:41:08 +01:00
|
|
|
template <>
|
|
|
|
|
struct PreemptionConfig<GfxFamily> {
|
|
|
|
|
static constexpr uint32_t mmioAddress = 0x2248;
|
|
|
|
|
static constexpr uint32_t maskVal = 0;
|
|
|
|
|
static constexpr uint32_t maskShift = 0;
|
|
|
|
|
static constexpr uint32_t mask = 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-02-12 13:41:08 +01:00
|
|
|
static constexpr uint32_t threadGroupVal = 0;
|
|
|
|
|
static constexpr uint32_t cmdLevelVal = (1 << 2);
|
|
|
|
|
static constexpr uint32_t midThreadVal = 0;
|
|
|
|
|
};
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
template <>
|
2018-01-08 15:58:02 +01:00
|
|
|
void PreemptionHelper::programCmdStream<GfxFamily>(LinearStream &cmdStream, PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode,
|
2019-07-31 08:57:00 +02:00
|
|
|
GraphicsAllocation *preemptionCsr) {
|
2018-01-08 15:58:02 +01:00
|
|
|
if (newPreemptionMode == oldPreemptionMode) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
uint32_t regVal = 0;
|
2018-01-08 15:58:02 +01:00
|
|
|
if (newPreemptionMode == PreemptionMode::ThreadGroup) {
|
2018-02-12 13:41:08 +01:00
|
|
|
regVal = PreemptionConfig<GfxFamily>::threadGroupVal;
|
2017-12-21 00:45:38 +01:00
|
|
|
} else {
|
2018-02-12 13:41:08 +01:00
|
|
|
regVal = PreemptionConfig<GfxFamily>::cmdLevelVal;
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-28 16:48:23 +02:00
|
|
|
LriHelper<GfxFamily>::program(&cmdStream, PreemptionConfig<GfxFamily>::mmioAddress, regVal, false);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-08 15:58:02 +01:00
|
|
|
template <>
|
|
|
|
|
size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Device &device) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
2021-10-17 12:21:29 +00:00
|
|
|
size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(Device &device, bool isRcs) {
|
2018-11-05 11:52:19 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
2022-06-22 12:10:21 +00:00
|
|
|
void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr, LogicalStateHelper *logicalStateHelper) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void PreemptionHelper::programCsrBaseAddressCmd<GfxFamily>(LinearStream &preambleCmdStream, const GraphicsAllocation *preemptionCsr, LogicalStateHelper *logicalStateHelper) {
|
2018-11-05 11:52:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
2022-06-21 10:28:33 +00:00
|
|
|
void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device, LogicalStateHelper *logicalStateHelper) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, LogicalStateHelper *logicalStateHelper) {
|
2018-01-08 15:58:02 +01:00
|
|
|
}
|
|
|
|
|
|
2020-02-07 14:46:11 +01:00
|
|
|
template <>
|
|
|
|
|
size_t PreemptionHelper::getPreemptionWaCsSize<GfxFamily>(const Device &device) {
|
|
|
|
|
typedef typename GfxFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
|
|
|
|
size_t size = 0;
|
|
|
|
|
PreemptionMode preemptionMode = device.getPreemptionMode();
|
|
|
|
|
if (preemptionMode == PreemptionMode::ThreadGroup ||
|
|
|
|
|
preemptionMode == PreemptionMode::MidThread) {
|
2021-11-25 09:31:14 +00:00
|
|
|
if (device.getHardwareInfo().workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption) {
|
2020-02-07 14:46:11 +01:00
|
|
|
size += 2 * sizeof(MI_LOAD_REGISTER_IMM);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void PreemptionHelper::applyPreemptionWaCmdsBegin<GfxFamily>(LinearStream *pCommandStream, const Device &device) {
|
|
|
|
|
typedef typename GfxFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
|
|
|
|
PreemptionMode preemptionMode = device.getPreemptionMode();
|
|
|
|
|
if (preemptionMode == PreemptionMode::ThreadGroup ||
|
|
|
|
|
preemptionMode == PreemptionMode::MidThread) {
|
2021-11-25 09:31:14 +00:00
|
|
|
if (device.getHardwareInfo().workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption) {
|
2020-10-06 10:58:18 +02:00
|
|
|
LriHelper<GfxFamily>::program(pCommandStream,
|
|
|
|
|
CS_GPR_R0,
|
|
|
|
|
GPGPU_WALKER_COOKIE_VALUE_BEFORE_WALKER,
|
|
|
|
|
false);
|
2020-02-07 14:46:11 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-08 15:58:02 +01:00
|
|
|
|
2020-02-07 14:46:11 +01:00
|
|
|
template <>
|
|
|
|
|
void PreemptionHelper::applyPreemptionWaCmdsEnd<GfxFamily>(LinearStream *pCommandStream, const Device &device) {
|
|
|
|
|
typedef typename GfxFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
|
|
|
|
PreemptionMode preemptionMode = device.getPreemptionMode();
|
|
|
|
|
if (preemptionMode == PreemptionMode::ThreadGroup ||
|
|
|
|
|
preemptionMode == PreemptionMode::MidThread) {
|
2021-11-25 09:31:14 +00:00
|
|
|
if (device.getHardwareInfo().workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption) {
|
2020-10-06 10:58:18 +02:00
|
|
|
LriHelper<GfxFamily>::program(pCommandStream,
|
|
|
|
|
CS_GPR_R0,
|
|
|
|
|
GPGPU_WALKER_COOKIE_VALUE_AFTER_WALKER,
|
|
|
|
|
false);
|
2020-02-07 14:46:11 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void PreemptionHelper::programInterfaceDescriptorDataPreemption<GfxFamily>(INTERFACE_DESCRIPTOR_DATA<GfxFamily> *idd, PreemptionMode preemptionMode) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
|
2022-12-15 14:57:31 +00:00
|
|
|
template void PreemptionHelper::programStateSipEndWa<GfxFamily>(LinearStream &cmdStream, const RootDeviceEnvironment &rootDeviceEnvironment);
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|