Use LogicalStateHelper to program CSR allocation

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-06-22 12:10:21 +00:00
committed by Compute-Runtime-Automation
parent 1bfe42350a
commit 0b5269d4ae
17 changed files with 46 additions and 30 deletions

View File

@@ -16,19 +16,24 @@
namespace NEO {
template <typename GfxFamily>
void PreemptionHelper::programCsrBaseAddress(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr) {
using GPGPU_CSR_BASE_ADDRESS = typename GfxFamily::GPGPU_CSR_BASE_ADDRESS;
bool isMidThreadPreemption = device.getPreemptionMode() == PreemptionMode::MidThread;
if (isMidThreadPreemption) {
void PreemptionHelper::programCsrBaseAddress(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr, LogicalStateHelper *logicalStateHelper) {
if (device.getPreemptionMode() == PreemptionMode::MidThread) {
UNRECOVERABLE_IF(nullptr == preemptionCsr);
auto csr = reinterpret_cast<GPGPU_CSR_BASE_ADDRESS *>(preambleCmdStream.getSpace(sizeof(GPGPU_CSR_BASE_ADDRESS)));
GPGPU_CSR_BASE_ADDRESS cmd = GfxFamily::cmdInitGpgpuCsrBaseAddress;
cmd.setGpgpuCsrBaseAddress(preemptionCsr->getGpuAddressToPatch());
*csr = cmd;
programCsrBaseAddressCmd<GfxFamily>(preambleCmdStream, preemptionCsr, logicalStateHelper);
}
}
template <typename GfxFamily>
void PreemptionHelper::programCsrBaseAddressCmd(LinearStream &preambleCmdStream, const GraphicsAllocation *preemptionCsr, LogicalStateHelper *logicalStateHelper) {
using GPGPU_CSR_BASE_ADDRESS = typename GfxFamily::GPGPU_CSR_BASE_ADDRESS;
auto csr = reinterpret_cast<GPGPU_CSR_BASE_ADDRESS *>(preambleCmdStream.getSpace(sizeof(GPGPU_CSR_BASE_ADDRESS)));
GPGPU_CSR_BASE_ADDRESS cmd = GfxFamily::cmdInitGpgpuCsrBaseAddress;
cmd.setGpgpuCsrBaseAddress(preemptionCsr->getGpuAddressToPatch());
*csr = cmd;
}
template <typename GfxFamily>
void PreemptionHelper::programStateSip(LinearStream &preambleCmdStream, Device &device, LogicalStateHelper *logicalStateHelper) {
using STATE_SIP = typename GfxFamily::STATE_SIP;