2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-01-19 19:22:14 +08:00
|
|
|
* Copyright (C) 2018-2024 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-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/preemption.h"
|
|
|
|
#include "shared/source/command_stream/preemption.inl"
|
2022-05-25 22:39:35 +08:00
|
|
|
#include "shared/source/gen8/hw_cmds_base.h"
|
2023-02-07 20:53:53 +08:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2022-03-26 05:04:08 +08:00
|
|
|
#include "shared/source/helpers/register_offsets.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2022-07-25 23:30:11 +08:00
|
|
|
using GfxFamily = Gen8Family;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-02-12 20:41:08 +08: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 07:45:38 +08:00
|
|
|
|
2018-02-12 20:41:08 +08:00
|
|
|
static constexpr uint32_t threadGroupVal = 0;
|
|
|
|
static constexpr uint32_t cmdLevelVal = (1 << 2);
|
|
|
|
static constexpr uint32_t midThreadVal = 0;
|
|
|
|
};
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
template <>
|
2018-01-08 22:58:02 +08:00
|
|
|
void PreemptionHelper::programCmdStream<GfxFamily>(LinearStream &cmdStream, PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode,
|
2019-07-31 14:57:00 +08:00
|
|
|
GraphicsAllocation *preemptionCsr) {
|
2018-01-08 22:58:02 +08:00
|
|
|
if (newPreemptionMode == oldPreemptionMode) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
uint32_t regVal = 0;
|
2018-01-08 22:58:02 +08:00
|
|
|
if (newPreemptionMode == PreemptionMode::ThreadGroup) {
|
2018-02-12 20:41:08 +08:00
|
|
|
regVal = PreemptionConfig<GfxFamily>::threadGroupVal;
|
2017-12-21 07:45:38 +08:00
|
|
|
} else {
|
2018-02-12 20:41:08 +08:00
|
|
|
regVal = PreemptionConfig<GfxFamily>::cmdLevelVal;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2024-04-19 22:20:27 +08:00
|
|
|
LriHelper<GfxFamily>::program(&cmdStream, PreemptionConfig<GfxFamily>::mmioAddress, regVal, false, false);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2018-01-08 22:58:02 +08:00
|
|
|
template <>
|
|
|
|
size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Device &device) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2021-10-17 20:21:29 +08:00
|
|
|
size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(Device &device, bool isRcs) {
|
2018-11-05 18:52:19 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2023-09-13 01:51:43 +08:00
|
|
|
void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr) {
|
2022-06-22 20:10:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2023-09-13 01:51:43 +08:00
|
|
|
void PreemptionHelper::programCsrBaseAddressCmd<GfxFamily>(LinearStream &preambleCmdStream, const GraphicsAllocation *preemptionCsr) {
|
2018-11-05 18:52:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2023-09-13 01:51:43 +08:00
|
|
|
void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device, OsContext *context) {
|
2022-06-21 18:28:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
2024-01-19 19:22:14 +08:00
|
|
|
void PreemptionHelper::programStateSipCmd<GfxFamily>(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, bool useFullAddress) {
|
2018-01-08 22:58:02 +08:00
|
|
|
}
|
|
|
|
|
2020-02-07 21:46:11 +08: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 17:31:14 +08:00
|
|
|
if (device.getHardwareInfo().workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption) {
|
2020-02-07 21:46:11 +08: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 17:31:14 +08:00
|
|
|
if (device.getHardwareInfo().workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption) {
|
2020-10-06 16:58:18 +08:00
|
|
|
LriHelper<GfxFamily>::program(pCommandStream,
|
2023-12-04 21:53:09 +08:00
|
|
|
RegisterOffsets::csGprR0,
|
|
|
|
RegisterConstants::gpgpuWalkerCookieValueBeforeWalker,
|
2024-04-19 22:20:27 +08:00
|
|
|
false,
|
2020-10-06 16:58:18 +08:00
|
|
|
false);
|
2020-02-07 21:46:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-01-08 22:58:02 +08:00
|
|
|
|
2020-02-07 21:46:11 +08: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 17:31:14 +08:00
|
|
|
if (device.getHardwareInfo().workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption) {
|
2020-10-06 16:58:18 +08:00
|
|
|
LriHelper<GfxFamily>::program(pCommandStream,
|
2023-12-04 21:53:09 +08:00
|
|
|
RegisterOffsets::csGprR0,
|
|
|
|
RegisterConstants::gpgpuWalkerCookieValueAfterWalker,
|
2024-04-19 22:20:27 +08:00
|
|
|
false,
|
2020-10-06 16:58:18 +08:00
|
|
|
false);
|
2020-02-07 21:46:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void PreemptionHelper::programInterfaceDescriptorDataPreemption<GfxFamily>(INTERFACE_DESCRIPTOR_DATA<GfxFamily> *idd, PreemptionMode preemptionMode) {
|
|
|
|
}
|
|
|
|
|
|
|
|
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|