2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2019-03-26 11:59:46 +01:00
|
|
|
* Copyright (C) 2018-2019 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
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "runtime/command_stream/preemption.h"
|
2018-01-02 12:10:34 +01:00
|
|
|
#include "runtime/command_stream/preemption.inl"
|
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
|
|
|
|
|
|
|
|
typedef BDWFamily GfxFamily;
|
|
|
|
|
|
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,
|
2018-03-27 09:58:00 +02:00
|
|
|
GraphicsAllocation *preemptionCsr, Device &device) {
|
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
|
|
|
}
|
|
|
|
|
|
2018-02-12 13:41:08 +01:00
|
|
|
LriHelper<GfxFamily>::program(&cmdStream, PreemptionConfig<GfxFamily>::mmioAddress, regVal);
|
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 <>
|
2018-11-05 11:52:19 +01:00
|
|
|
size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(const Device &device) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device) {
|
2018-01-08 15:58:02 +01:00
|
|
|
}
|
|
|
|
|
|
2018-02-12 13:41:08 +01:00
|
|
|
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
|
2018-01-02 12:10:34 +01:00
|
|
|
template size_t PreemptionHelper::getPreemptionWaCsSize<GfxFamily>(const Device &device);
|
|
|
|
|
template void PreemptionHelper::applyPreemptionWaCmdsBegin<GfxFamily>(LinearStream *pCommandStream, const Device &device);
|
|
|
|
|
template void PreemptionHelper::applyPreemptionWaCmdsEnd<GfxFamily>(LinearStream *pCommandStream, const Device &device);
|
2018-03-01 22:43:04 +01:00
|
|
|
template void PreemptionHelper::programInterfaceDescriptorDataPreemption<GfxFamily>(INTERFACE_DESCRIPTOR_DATA<GfxFamily> *idd, PreemptionMode preemptionMode);
|
2018-01-08 15:58:02 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|