Refactor preemption methods

- moving primary template definitions to preemption.inl

Change-Id: Ia54c652503a6272c55800e5ba59b94ef21fa2a19
This commit is contained in:
Hoppe, Mateusz
2018-02-12 13:41:08 +01:00
committed by sys_ocldev
parent d563059c14
commit 85f890690d
4 changed files with 103 additions and 84 deletions

View File

@@ -27,12 +27,17 @@ namespace OCLRT {
typedef BDWFamily GfxFamily;
namespace PreemptionBDW {
static constexpr uint32_t mmioAddress = 0x2248;
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;
static constexpr uint32_t threadGroupVal = 0;
static constexpr uint32_t cmdLevelVal = (1 << 2);
}; // namespace PreemptionBDW
static constexpr uint32_t threadGroupVal = 0;
static constexpr uint32_t cmdLevelVal = (1 << 2);
static constexpr uint32_t midThreadVal = 0;
};
template <>
void PreemptionHelper::programCmdStream<GfxFamily>(LinearStream &cmdStream, PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode,
@@ -43,20 +48,12 @@ void PreemptionHelper::programCmdStream<GfxFamily>(LinearStream &cmdStream, Pree
uint32_t regVal = 0;
if (newPreemptionMode == PreemptionMode::ThreadGroup) {
regVal = PreemptionBDW::threadGroupVal;
regVal = PreemptionConfig<GfxFamily>::threadGroupVal;
} else {
regVal = PreemptionBDW::cmdLevelVal;
regVal = PreemptionConfig<GfxFamily>::cmdLevelVal;
}
LriHelper<GfxFamily>::program(&cmdStream, PreemptionBDW::mmioAddress, regVal);
}
template <>
size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode) {
if (newPreemptionMode == oldPreemptionMode) {
return 0;
}
return sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM);
LriHelper<GfxFamily>::program(&cmdStream, PreemptionConfig<GfxFamily>::mmioAddress, regVal);
}
template <>
@@ -69,6 +66,7 @@ void PreemptionHelper::programPreamble<GfxFamily>(LinearStream &preambleCmdStrea
const GraphicsAllocation *preemptionCsr) {
}
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
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);