Use LogicalStateHelper for SIP programming

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-06-21 10:28:33 +00:00
committed by Compute-Runtime-Automation
parent e0c87435e1
commit f4485ec541
31 changed files with 87 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -30,7 +30,7 @@ void PreemptionHelper::programCsrBaseAddress(LinearStream &preambleCmdStream, De
}
template <typename GfxFamily>
void PreemptionHelper::programStateSip(LinearStream &preambleCmdStream, Device &device) {
void PreemptionHelper::programStateSip(LinearStream &preambleCmdStream, Device &device, LogicalStateHelper *logicalStateHelper) {
using STATE_SIP = typename GfxFamily::STATE_SIP;
bool debuggingEnabled = device.getDebugger() != nullptr || device.isDebuggerActive();
bool isMidThreadPreemption = device.getPreemptionMode() == PreemptionMode::MidThread;
@@ -38,13 +38,20 @@ void PreemptionHelper::programStateSip(LinearStream &preambleCmdStream, Device &
if (isMidThreadPreemption || debuggingEnabled) {
auto sipAllocation = SipKernel::getSipKernel(device).getSipAllocation();
auto sip = reinterpret_cast<STATE_SIP *>(preambleCmdStream.getSpace(sizeof(STATE_SIP)));
STATE_SIP cmd = GfxFamily::cmdInitStateSip;
cmd.setSystemInstructionPointer(sipAllocation->getGpuAddressToPatch());
*sip = cmd;
programStateSipCmd<GfxFamily>(preambleCmdStream, sipAllocation, logicalStateHelper);
}
}
template <typename GfxFamily>
void PreemptionHelper::programStateSipCmd(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, LogicalStateHelper *logicalStateHelper) {
using STATE_SIP = typename GfxFamily::STATE_SIP;
auto sip = reinterpret_cast<STATE_SIP *>(preambleCmdStream.getSpace(sizeof(STATE_SIP)));
STATE_SIP cmd = GfxFamily::cmdInitStateSip;
cmd.setSystemInstructionPointer(sipAllocation->getGpuAddressToPatch());
*sip = cmd;
}
template <typename GfxFamily>
void PreemptionHelper::programStateSipEndWa(LinearStream &cmdStream, Device &device) {}