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

@@ -22,6 +22,7 @@
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/logical_state_helper.h"
#include "shared/source/helpers/pause_on_gpu_properties.h"
#include "shared/source/helpers/ray_tracing_helper.h"
#include "shared/source/helpers/string.h"
@@ -893,4 +894,8 @@ void CommandStreamReceiver::printTagAddressContent(uint32_t taskCountToWait, int
PRINT_DEBUG_STRING(true, stdout, "%s", "\n");
}
LogicalStateHelper *CommandStreamReceiver::getLogicalStateHelper() const {
return logicalStateHelper.get();
}
} // namespace NEO

View File

@@ -51,6 +51,7 @@ class ScratchSpaceController;
class HwPerfCounter;
class HwTimeStamps;
class TagAllocatorBase;
class LogicalStateHelper;
template <typename TSize>
class TimestampPackets;
@@ -337,6 +338,8 @@ class CommandStreamReceiver {
return this->dispatchMode;
}
LogicalStateHelper *getLogicalStateHelper() const;
protected:
void cleanupResources();
void printDeviceIndex();
@@ -357,6 +360,7 @@ class CommandStreamReceiver {
std::unique_ptr<TagAllocatorBase> perfCounterAllocator;
std::unique_ptr<TagAllocatorBase> timestampPacketAllocator;
std::unique_ptr<Thread> userPauseConfirmation;
std::unique_ptr<LogicalStateHelper> logicalStateHelper;
ResidencyContainer residencyAllocations;
ResidencyContainer evictionAllocations;

View File

@@ -24,7 +24,6 @@ namespace NEO {
template <typename GfxFamily>
class DeviceCommandStreamReceiver;
struct PipeControlArgs;
class LogicalStateHelper;
template <typename GfxFamily>
class CommandStreamReceiverHw : public CommandStreamReceiver {
@@ -190,7 +189,6 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
std::unique_ptr<DirectSubmissionHw<GfxFamily, RenderDispatcher<GfxFamily>>> directSubmission;
std::unique_ptr<DirectSubmissionHw<GfxFamily, BlitterDispatcher<GfxFamily>>> blitterDirectSubmission;
std::unique_ptr<LogicalStateHelper> logicalStateHelper;
size_t cmdStreamStart = 0;
};

View File

@@ -917,7 +917,7 @@ template <typename GfxFamily>
inline void CommandStreamReceiverHw<GfxFamily>::programStateSip(LinearStream &cmdStream, Device &device) {
bool debuggingEnabled = device.getDebugger() != nullptr;
if (!this->isStateSipSent || debuggingEnabled) {
PreemptionHelper::programStateSip<GfxFamily>(cmdStream, device);
PreemptionHelper::programStateSip<GfxFamily>(cmdStream, device, logicalStateHelper.get());
this->isStateSipSent = true;
}
}

View File

@@ -18,6 +18,7 @@ namespace NEO {
class Device;
class GraphicsAllocation;
struct KernelDescriptor;
class LogicalStateHelper;
struct PreemptionFlags {
PreemptionFlags() {
@@ -57,7 +58,7 @@ class PreemptionHelper {
static void programCsrBaseAddress(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr);
template <typename GfxFamily>
static void programStateSip(LinearStream &preambleCmdStream, Device &device);
static void programStateSip(LinearStream &preambleCmdStream, Device &device, LogicalStateHelper *logicalStateHelper);
template <typename GfxFamily>
static void programStateSipEndWa(LinearStream &cmdStream, Device &device);
@@ -82,6 +83,10 @@ class PreemptionHelper {
template <typename GfxFamily>
static void programInterfaceDescriptorDataPreemption(INTERFACE_DESCRIPTOR_DATA<GfxFamily> *idd, PreemptionMode preemptionMode);
protected:
template <typename GfxFamily>
static void programStateSipCmd(LinearStream &preambleCmdStream, GraphicsAllocation *sipAllocation, LogicalStateHelper *logicalStateHelper);
};
template <typename GfxFamily>

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) {}

View File

@@ -10,7 +10,7 @@ void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCm
}
template <>
void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device) {
void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device, LogicalStateHelper *logicalStateHelper) {
using STATE_SIP = typename GfxFamily::STATE_SIP;
using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM;