mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Refactor debugger code
- helper sets all SbaAddresses for debugger in EncodeStateBaseAddress<GfxFamily>::setSbaAddressesForDebugger() - change DebuggerL0::captureStateBaseAddress() to take LinearStream - move getSbaTrackingCommandsSize() to Debugger class Related-To: NEO-6845 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
f3bcbfb305
commit
5911515ed0
@ -2256,14 +2256,9 @@ void CommandListCoreFamily<gfxCoreFamily>::programStateBaseAddress(NEO::CommandC
|
||||
NEO::EncodeStateBaseAddress<GfxFamily>::encode(commandContainer, sba, this->partitionCount > 1);
|
||||
if (NEO::Debugger::isDebugEnabled(this->internalUsage) && device->getL0Debugger()) {
|
||||
NEO::Debugger::SbaAddresses sbaAddresses = {};
|
||||
sbaAddresses.BindlessSurfaceStateBaseAddress = sba.getBindlessSurfaceStateBaseAddress();
|
||||
sbaAddresses.DynamicStateBaseAddress = sba.getDynamicStateBaseAddress();
|
||||
sbaAddresses.GeneralStateBaseAddress = sba.getGeneralStateBaseAddress();
|
||||
NEO::EncodeStateBaseAddress<GfxFamily>::setIohAddressForDebugger(sbaAddresses, sba);
|
||||
sbaAddresses.InstructionBaseAddress = sba.getInstructionBaseAddress();
|
||||
sbaAddresses.SurfaceStateBaseAddress = sba.getSurfaceStateBaseAddress();
|
||||
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaAddressesForDebugger(sbaAddresses, sba);
|
||||
|
||||
device->getL0Debugger()->captureStateBaseAddress(commandContainer, sbaAddresses);
|
||||
device->getL0Debugger()->captureStateBaseAddress(*commandContainer.getCommandStream(), sbaAddresses);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,12 +75,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) {
|
||||
|
||||
NEO::Debugger::SbaAddresses sbaAddresses = {};
|
||||
sbaAddresses.BindlessSurfaceStateBaseAddress = sbaCmd.getBindlessSurfaceStateBaseAddress();
|
||||
sbaAddresses.DynamicStateBaseAddress = sbaCmd.getDynamicStateBaseAddress();
|
||||
sbaAddresses.GeneralStateBaseAddress = sbaCmd.getGeneralStateBaseAddress();
|
||||
sbaAddresses.IndirectObjectBaseAddress = sbaCmd.getIndirectObjectBaseAddress();
|
||||
sbaAddresses.InstructionBaseAddress = sbaCmd.getInstructionBaseAddress();
|
||||
sbaAddresses.SurfaceStateBaseAddress = sbaCmd.getSurfaceStateBaseAddress();
|
||||
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaAddressesForDebugger(sbaAddresses, sbaCmd);
|
||||
|
||||
device->getL0Debugger()->programSbaTrackingCommands(commandStream, sbaAddresses);
|
||||
}
|
||||
|
@ -61,11 +61,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
|
||||
if (NEO::Debugger::isDebugEnabled(internalUsage) && device->getL0Debugger()) {
|
||||
|
||||
NEO::Debugger::SbaAddresses sbaAddresses = {};
|
||||
sbaAddresses.BindlessSurfaceStateBaseAddress = sbaCmd.getBindlessSurfaceStateBaseAddress();
|
||||
sbaAddresses.DynamicStateBaseAddress = sbaCmd.getDynamicStateBaseAddress();
|
||||
sbaAddresses.GeneralStateBaseAddress = sbaCmd.getGeneralStateBaseAddress();
|
||||
sbaAddresses.InstructionBaseAddress = sbaCmd.getInstructionBaseAddress();
|
||||
sbaAddresses.SurfaceStateBaseAddress = sbaCmd.getSurfaceStateBaseAddress();
|
||||
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaAddressesForDebugger(sbaAddresses, sbaCmd);
|
||||
|
||||
device->getL0Debugger()->programSbaTrackingCommands(commandStream, sbaAddresses);
|
||||
}
|
||||
|
@ -117,9 +117,9 @@ DebuggerL0 ::~DebuggerL0() {
|
||||
device->getMemoryManager()->freeGraphicsMemory(moduleDebugArea);
|
||||
}
|
||||
|
||||
void DebuggerL0::captureStateBaseAddress(NEO::CommandContainer &container, SbaAddresses sba) {
|
||||
void DebuggerL0::captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) {
|
||||
if (DebuggerL0::isAnyTrackedAddressChanged(sba)) {
|
||||
programSbaTrackingCommands(*container.getCommandStream(), sba);
|
||||
programSbaTrackingCommands(cmdStream, sba);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,14 +92,13 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass {
|
||||
return sbaTrackingGpuVa.address;
|
||||
}
|
||||
|
||||
void captureStateBaseAddress(NEO::CommandContainer &container, SbaAddresses sba) override;
|
||||
void captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) override;
|
||||
void printTrackedAddresses(uint32_t contextId);
|
||||
MOCKABLE_VIRTUAL void registerElf(NEO::DebugData *debugData, NEO::GraphicsAllocation *isaAllocation);
|
||||
MOCKABLE_VIRTUAL void notifyCommandQueueCreated();
|
||||
MOCKABLE_VIRTUAL void notifyCommandQueueDestroyed();
|
||||
MOCKABLE_VIRTUAL void notifyModuleLoadAllocations(const StackVec<NEO::GraphicsAllocation *, 32> &allocs);
|
||||
|
||||
virtual size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) = 0;
|
||||
virtual void programSbaTrackingCommands(NEO::LinearStream &cmdStream, const SbaAddresses &sba) = 0;
|
||||
virtual size_t getSbaAddressLoadCommandsSize() = 0;
|
||||
virtual void programSbaAddressLoad(NEO::LinearStream &cmdStream, uint64_t sbaGpuVa) = 0;
|
||||
|
@ -29,9 +29,9 @@ class MockDebuggerL0Hw : public L0::DebuggerL0Hw<GfxFamily> {
|
||||
return new MockDebuggerL0Hw<GfxFamily>(device);
|
||||
}
|
||||
|
||||
void captureStateBaseAddress(NEO::CommandContainer &container, NEO::Debugger::SbaAddresses sba) override {
|
||||
void captureStateBaseAddress(NEO::LinearStream &cmdStream, NEO::Debugger::SbaAddresses sba) override {
|
||||
captureStateBaseAddressCount++;
|
||||
L0::DebuggerL0Hw<GfxFamily>::captureStateBaseAddress(container, sba);
|
||||
L0::DebuggerL0Hw<GfxFamily>::captureStateBaseAddress(cmdStream, sba);
|
||||
}
|
||||
|
||||
size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) override {
|
||||
|
@ -654,7 +654,10 @@ TEST(Debugger, givenNonLegacyDebuggerWhenInitializingDeviceCapsThenUnrecoverable
|
||||
isLegacyMode = false;
|
||||
}
|
||||
|
||||
void captureStateBaseAddress(CommandContainer &container, SbaAddresses sba) override{};
|
||||
void captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) override{};
|
||||
size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) override {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
auto mockBuiltIns = new MockBuiltins();
|
||||
|
@ -581,13 +581,13 @@ HWTEST_F(L0DebuggerSimpleTest, givenNotChangedSurfaceStateWhenCapturingSBAThenNo
|
||||
NEO::Debugger::SbaAddresses sba = {};
|
||||
sba.SurfaceStateBaseAddress = 0x123456000;
|
||||
|
||||
debugger->captureStateBaseAddress(container, sba);
|
||||
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
|
||||
auto sizeUsed = container.getCommandStream()->getUsed();
|
||||
|
||||
EXPECT_NE(0u, sizeUsed);
|
||||
sba.SurfaceStateBaseAddress = 0;
|
||||
|
||||
debugger->captureStateBaseAddress(container, sba);
|
||||
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
|
||||
auto sizeUsed2 = container.getCommandStream()->getUsed();
|
||||
|
||||
EXPECT_EQ(sizeUsed, sizeUsed2);
|
||||
@ -604,7 +604,7 @@ HWTEST_F(L0DebuggerSimpleTest, givenChangedBaseAddressesWhenCapturingSBAThenNoTr
|
||||
NEO::Debugger::SbaAddresses sba = {};
|
||||
sba.SurfaceStateBaseAddress = 0x123456000;
|
||||
|
||||
debugger->captureStateBaseAddress(container, sba);
|
||||
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
|
||||
auto sizeUsed = container.getCommandStream()->getUsed();
|
||||
|
||||
EXPECT_NE(0u, sizeUsed);
|
||||
@ -617,7 +617,7 @@ HWTEST_F(L0DebuggerSimpleTest, givenChangedBaseAddressesWhenCapturingSBAThenNoTr
|
||||
NEO::Debugger::SbaAddresses sba = {};
|
||||
sba.GeneralStateBaseAddress = 0x123456000;
|
||||
|
||||
debugger->captureStateBaseAddress(container, sba);
|
||||
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
|
||||
auto sizeUsed = container.getCommandStream()->getUsed();
|
||||
|
||||
EXPECT_NE(0u, sizeUsed);
|
||||
@ -630,7 +630,7 @@ HWTEST_F(L0DebuggerSimpleTest, givenChangedBaseAddressesWhenCapturingSBAThenNoTr
|
||||
NEO::Debugger::SbaAddresses sba = {};
|
||||
sba.BindlessSurfaceStateBaseAddress = 0x123456000;
|
||||
|
||||
debugger->captureStateBaseAddress(container, sba);
|
||||
debugger->captureStateBaseAddress(*container.getCommandStream(), sba);
|
||||
auto sizeUsed = container.getCommandStream()->getUsed();
|
||||
|
||||
EXPECT_NE(0u, sizeUsed);
|
||||
|
@ -141,6 +141,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterTests, gi
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
configureCSRtoNonDirtyState<FamilyType>(false);
|
||||
commandStreamReceiver.isStateSipSent = false;
|
||||
flushTask(commandStreamReceiver);
|
||||
parseCommands<FamilyType>(commandStreamReceiver.getCS(0));
|
||||
|
||||
@ -180,6 +181,7 @@ HWTEST2_F(CommandStreamReceiverFlushTaskXeHPAndLaterTests, givenProgramPipeContr
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
configureCSRtoNonDirtyState<FamilyType>(false);
|
||||
commandStreamReceiver.isStateSipSent = false;
|
||||
flushTask(commandStreamReceiver);
|
||||
parseCommands<FamilyType>(commandStreamReceiver.getCS(0));
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_os_context.h"
|
||||
#include "shared/test/common/mocks/mock_source_level_debugger.h"
|
||||
#include "shared/test/common/mocks/mock_timestamp_container.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
@ -131,13 +132,17 @@ HWTEST_F(UltCommandStreamReceiverTest, givenSentStateSipFlagSetAndSourceLevelDeb
|
||||
commandStreamReceiver.isStateSipSent = true;
|
||||
auto sizeWithoutSourceKernelDebugging = commandStreamReceiver.getRequiredCmdStreamSize(dispatchFlags, *pDevice);
|
||||
|
||||
pDevice->setDebuggerActive(true);
|
||||
auto debugger = new MockSourceLevelDebugger();
|
||||
debugger->setActive(true);
|
||||
debugger->sbaTrackingSize = 24;
|
||||
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(debugger);
|
||||
|
||||
commandStreamReceiver.isStateSipSent = true;
|
||||
auto sizeWithSourceKernelDebugging = commandStreamReceiver.getRequiredCmdStreamSize(dispatchFlags, *pDevice);
|
||||
|
||||
auto sizeForStateSip = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*pDevice, commandStreamReceiver.isRcs());
|
||||
EXPECT_EQ(sizeForStateSip, sizeWithSourceKernelDebugging - sizeWithoutSourceKernelDebugging - PreambleHelper<FamilyType>::getKernelDebuggingCommandsSize(true));
|
||||
pDevice->setDebuggerActive(false);
|
||||
}
|
||||
|
||||
HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentAndThreadArbitrationPolicyChangedWhenEstimatingFlushTaskSizeThenResultDependsOnPolicyProgrammingCmdSize) {
|
||||
|
@ -136,6 +136,7 @@ struct UltCommandStreamReceiverTest
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<GfxFamily>();
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
commandStreamReceiver.isEnginePrologueSent = true;
|
||||
commandStreamReceiver.isStateSipSent = true;
|
||||
commandStreamReceiver.lastPreemptionMode = pDevice->getPreemptionMode();
|
||||
commandStreamReceiver.setMediaVFEStateDirty(false);
|
||||
auto gmmHelper = pDevice->getGmmHelper();
|
||||
|
@ -705,10 +705,16 @@ TEST(SourceLevelDebugger, whenCaptureSBACalledThenNoCommandsAreAddedToStream) {
|
||||
container.initialize(device.get(), nullptr, true);
|
||||
|
||||
NEO::Debugger::SbaAddresses sbaAddresses = {};
|
||||
debugger.captureStateBaseAddress(container, sbaAddresses);
|
||||
debugger.captureStateBaseAddress(*container.getCommandStream(), sbaAddresses);
|
||||
EXPECT_EQ(0u, container.getCommandStream()->getUsed());
|
||||
}
|
||||
|
||||
TEST(SourceLevelDebugger, whenGetSbaTrackingCommandsSizeQueriedThenZeroIsReturned) {
|
||||
auto debugger = std::make_unique<SourceLevelDebugger>(new DebuggerLibrary);
|
||||
auto size = debugger->getSbaTrackingCommandsSize(3);
|
||||
EXPECT_EQ(0u, size);
|
||||
}
|
||||
|
||||
TEST(SourceLevelDebugger, givenEnableMockSourceLevelDebuggerWhenInitializingExecEnvThenActiveDebuggerWithEmptyInterfaceIsCreated) {
|
||||
if (!defaultHwInfo->capabilityTable.debuggerSupported) {
|
||||
GTEST_SKIP_("Source Level Debugger not supported");
|
||||
|
@ -234,7 +234,7 @@ struct EncodeStateBaseAddress {
|
||||
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
|
||||
static void encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd, bool multiOsContextCapable);
|
||||
static void encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd, uint32_t statelessMocsIndex, bool useGlobalAtomics, bool multiOsContextCapable);
|
||||
static void setIohAddressForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd);
|
||||
static void setSbaAddressesForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd);
|
||||
static size_t getRequiredSizeForStateBaseAddress(Device &device, CommandContainer &container);
|
||||
};
|
||||
|
||||
|
@ -338,8 +338,13 @@ inline void EncodeComputeMode<Family>::adjustPipelineSelect(CommandContainer &co
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void EncodeStateBaseAddress<Family>::setIohAddressForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd) {
|
||||
void EncodeStateBaseAddress<Family>::setSbaAddressesForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd) {
|
||||
sbaAddress.IndirectObjectBaseAddress = sbaCmd.getIndirectObjectBaseAddress();
|
||||
sbaAddress.BindlessSurfaceStateBaseAddress = sbaCmd.getBindlessSurfaceStateBaseAddress();
|
||||
sbaAddress.DynamicStateBaseAddress = sbaCmd.getDynamicStateBaseAddress();
|
||||
sbaAddress.GeneralStateBaseAddress = sbaCmd.getGeneralStateBaseAddress();
|
||||
sbaAddress.InstructionBaseAddress = sbaCmd.getInstructionBaseAddress();
|
||||
sbaAddress.SurfaceStateBaseAddress = sbaCmd.getSurfaceStateBaseAddress();
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
|
@ -445,7 +445,13 @@ void EncodeDispatchKernel<Family>::encodeThreadData(WALKER_TYPE &walkerCmd,
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
void EncodeStateBaseAddress<Family>::setIohAddressForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd) {
|
||||
void EncodeStateBaseAddress<Family>::setSbaAddressesForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd) {
|
||||
sbaAddress.BindlessSurfaceStateBaseAddress = sbaCmd.getBindlessSurfaceStateBaseAddress();
|
||||
sbaAddress.DynamicStateBaseAddress = sbaCmd.getDynamicStateBaseAddress();
|
||||
sbaAddress.GeneralStateBaseAddress = sbaCmd.getGeneralStateBaseAddress();
|
||||
sbaAddress.InstructionBaseAddress = sbaCmd.getInstructionBaseAddress();
|
||||
sbaAddress.SurfaceStateBaseAddress = sbaCmd.getSurfaceStateBaseAddress();
|
||||
sbaAddress.IndirectObjectBaseAddress = 0;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
|
@ -788,7 +788,7 @@ template <typename GfxFamily>
|
||||
size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const DispatchFlags &dispatchFlags, Device &device) {
|
||||
size_t size = getRequiredCmdSizeForPreamble(device);
|
||||
size += getRequiredStateBaseAddressSize(device);
|
||||
if (!this->isStateSipSent || device.isDebuggerActive()) {
|
||||
if (!this->isStateSipSent || device.getDebugger()) {
|
||||
size += PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(device, isRcs());
|
||||
}
|
||||
size += MemorySynchronizationCommands<GfxFamily>::getSizeForSinglePipeControl();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -9,7 +9,7 @@
|
||||
#include <memory>
|
||||
namespace NEO {
|
||||
struct HardwareInfo;
|
||||
class CommandContainer;
|
||||
class LinearStream;
|
||||
class IndirectHeap;
|
||||
struct DebugData;
|
||||
class GraphicsAllocation;
|
||||
@ -17,6 +17,7 @@ class GraphicsAllocation;
|
||||
class Debugger {
|
||||
public:
|
||||
struct SbaAddresses {
|
||||
constexpr static size_t trackedAddressCount = 6;
|
||||
uint64_t GeneralStateBaseAddress = 0;
|
||||
uint64_t SurfaceStateBaseAddress = 0;
|
||||
uint64_t DynamicStateBaseAddress = 0;
|
||||
@ -29,7 +30,9 @@ class Debugger {
|
||||
static std::unique_ptr<Debugger> create(HardwareInfo *hwInfo);
|
||||
virtual ~Debugger() = default;
|
||||
bool isLegacy() const { return isLegacyMode; }
|
||||
virtual void captureStateBaseAddress(CommandContainer &container, SbaAddresses sba) = 0;
|
||||
virtual void captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) = 0;
|
||||
virtual size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) = 0;
|
||||
|
||||
void *getDebugSurfaceReservedSurfaceState(IndirectHeap &ssh);
|
||||
|
||||
inline static bool isDebugEnabled(bool internalUsage) {
|
||||
@ -39,4 +42,6 @@ class Debugger {
|
||||
protected:
|
||||
bool isLegacyMode = true;
|
||||
};
|
||||
|
||||
static_assert(std::is_standard_layout<Debugger::SbaAddresses>::value);
|
||||
} // namespace NEO
|
@ -43,6 +43,15 @@ void EncodeComputeMode<Family>::programComputeModeCommand(LinearStream &csr, Sta
|
||||
const HardwareInfo &hwInfo) {
|
||||
}
|
||||
|
||||
template <>
|
||||
void EncodeStateBaseAddress<Family>::setSbaAddressesForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd) {
|
||||
sbaAddress.IndirectObjectBaseAddress = sbaCmd.getIndirectObjectBaseAddress();
|
||||
sbaAddress.DynamicStateBaseAddress = sbaCmd.getDynamicStateBaseAddress();
|
||||
sbaAddress.GeneralStateBaseAddress = sbaCmd.getGeneralStateBaseAddress();
|
||||
sbaAddress.InstructionBaseAddress = sbaCmd.getInstructionBaseAddress();
|
||||
sbaAddress.SurfaceStateBaseAddress = sbaCmd.getSurfaceStateBaseAddress();
|
||||
}
|
||||
|
||||
template struct EncodeDispatchKernel<Family>;
|
||||
template struct EncodeStates<Family>;
|
||||
template struct EncodeMath<Family>;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -54,7 +54,8 @@ void PreambleHelper<BDWFamily>::programPipelineSelect(LinearStream *pCommandStre
|
||||
|
||||
template <>
|
||||
size_t PreambleHelper<BDWFamily>::getAdditionalCommandsSize(const Device &device) {
|
||||
return getKernelDebuggingCommandsSize(device.isDebuggerActive());
|
||||
bool debuggingEnabled = device.getDebugger() != nullptr || device.isDebuggerActive();
|
||||
return getKernelDebuggingCommandsSize(debuggingEnabled);
|
||||
}
|
||||
|
||||
template struct PreambleHelper<BDWFamily>;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -41,7 +41,10 @@ class SourceLevelDebugger : public Debugger {
|
||||
MOCKABLE_VIRTUAL bool notifyKernelDebugData(const DebugData *debugData, const std::string &name, const void *isa, size_t isaSize) const;
|
||||
MOCKABLE_VIRTUAL bool initialize(bool useLocalMemory);
|
||||
|
||||
void captureStateBaseAddress(CommandContainer &container, SbaAddresses sba) override{};
|
||||
void captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) override{};
|
||||
size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) override {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
class SourceLevelDebuggerInterface;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -15,6 +15,9 @@ class MockDebugger : public Debugger {
|
||||
public:
|
||||
MockDebugger() = default;
|
||||
~MockDebugger() = default;
|
||||
void captureStateBaseAddress(CommandContainer &container, SbaAddresses sba){};
|
||||
void captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) override{};
|
||||
size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) override {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
} // namespace NEO
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -87,6 +87,10 @@ class MockSourceLevelDebugger : public SourceLevelDebugger {
|
||||
return initializeResult;
|
||||
}
|
||||
|
||||
size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) override {
|
||||
return sbaTrackingSize;
|
||||
}
|
||||
|
||||
mutable uint32_t initializeCalled = 0u;
|
||||
bool initializeResult = false;
|
||||
|
||||
@ -98,6 +102,8 @@ class MockSourceLevelDebugger : public SourceLevelDebugger {
|
||||
bool callBaseNotifyKernelDebugData = false;
|
||||
bool callBaseNotifyNewDevice = false;
|
||||
bool callBaseInitialize = false;
|
||||
|
||||
size_t sbaTrackingSize = 0;
|
||||
};
|
||||
|
||||
class MockActiveSourceLevelDebugger : public SourceLevelDebugger {
|
||||
|
@ -64,6 +64,23 @@ HWTEST2_F(CommandEncoderTest, givenICLLPWhenGettingRequiredSizeForStateBaseAddre
|
||||
EXPECT_EQ(size, 88ul);
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandEncoderTest, givenSbaCommandWhenGettingSbaAddressesForDebuggerThenCorrectValuesAreReturned, IsAtMostXeHpgCore) {
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
|
||||
STATE_BASE_ADDRESS cmd = FamilyType::cmdInitStateBaseAddress;
|
||||
cmd.setInstructionBaseAddress(0x1234000);
|
||||
cmd.setSurfaceStateBaseAddress(0x1235000);
|
||||
cmd.setGeneralStateBaseAddress(0x1236000);
|
||||
|
||||
NEO::Debugger::SbaAddresses sbaAddress = {};
|
||||
EncodeStateBaseAddress<FamilyType>::setSbaAddressesForDebugger(sbaAddress, cmd);
|
||||
EXPECT_EQ(0x1234000u, sbaAddress.InstructionBaseAddress);
|
||||
EXPECT_EQ(0x1235000u, sbaAddress.SurfaceStateBaseAddress);
|
||||
EXPECT_EQ(0x1236000u, sbaAddress.GeneralStateBaseAddress);
|
||||
EXPECT_EQ(0x0u, sbaAddress.BindlessSurfaceStateBaseAddress);
|
||||
EXPECT_EQ(0x0u, sbaAddress.BindlessSamplerStateBaseAddress);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandEncoderTest, GivenDwordStoreWhenAddingStoreDataImmThenExpectDwordProgramming) {
|
||||
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
|
||||
size_t size = EncodeStoreMemory<FamilyType>::getStoreDataImmSize();
|
||||
|
Reference in New Issue
Block a user