Debugger: simplify captureStateBaseAddress()

So far captureStateBaseAddress() was a wrapper around
programSbaTrackingCommands(), doing an additional checking before
calling the latter. The checking is apparently no longer relevant, so
unify the distinction and remove part of the code which is no longer
needed.

In practice, keep the captureStateBaseAddress() while moving the body of
programSbaTrackingCommands() into it. This imposes lower diff-impact
onto the class hierarchy. Remove the second function. Simplify the
caller which had to distinct these two functions previously.

Related-To: NEO-6774
Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
This commit is contained in:
Maciej Bielski
2022-09-13 12:40:56 +00:00
committed by Compute-Runtime-Automation
parent 9204cf5487
commit 0d0d6a300e
12 changed files with 12 additions and 42 deletions

View File

@ -2435,8 +2435,7 @@ void CommandListCoreFamily<gfxCoreFamily>::programStateBaseAddress(NEO::CommandC
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaTrackingForL0DebuggerIfEnabled(sbaTrackingEnabled,
*this->device->getNEODevice(),
*container.getCommandStream(),
sba,
false);
sba);
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@ -81,7 +81,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
*sbaCmdBuf = sbaCmd;
bool sbaTrackingEnabled = (NEO::Debugger::isDebugEnabled(this->internalUsage) && device->getL0Debugger());
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaTrackingForL0DebuggerIfEnabled(sbaTrackingEnabled, *neoDevice, commandStream, sbaCmd, true);
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaTrackingForL0DebuggerIfEnabled(sbaTrackingEnabled, *neoDevice, commandStream, sbaCmd);
NEO::EncodeWA<GfxFamily>::encodeAdditionalPipelineSelect(commandStream, {}, false, hwInfo, isRcs);

View File

@ -81,8 +81,7 @@ void CommandQueueHw<gfxCoreFamily>::programStateBaseAddress(uint64_t gsba, bool
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaTrackingForL0DebuggerIfEnabled(sbaTrackingEnabled,
*neoDevice,
commandStream,
sbaCmd,
true);
sbaCmd);
auto heap = neoDevice->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::GLOBAL_SSH);
NEO::StateBaseAddressHelper<GfxFamily>::programBindingTableBaseAddress(

View File

@ -420,7 +420,6 @@ HWTEST2_P(L0DebuggerWithBlitterTest, givenDebuggingEnabledWhenInternalCmdQIsUsed
EXPECT_FALSE(debugSurfaceFound);
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->captureStateBaseAddressCount);
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->programSbaTrackingCommandsCount);
EXPECT_EQ(0u, getMockDebuggerL0Hw<FamilyType>()->getSbaTrackingCommandsSizeCount);
auto commandList = CommandList::fromHandle(commandLists[0]);

View File

@ -266,8 +266,7 @@ struct EncodeStateBaseAddress {
static void setSbaTrackingForL0DebuggerIfEnabled(bool trackingEnabled,
Device &device,
LinearStream &commandStream,
STATE_BASE_ADDRESS &sbaCmd,
const bool skipCheck);
STATE_BASE_ADDRESS &sbaCmd);
protected:
static void setSbaAddressesForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd);

View File

@ -327,19 +327,14 @@ template <typename Family>
inline void EncodeStateBaseAddress<Family>::setSbaTrackingForL0DebuggerIfEnabled(bool trackingEnabled,
Device &device,
LinearStream &commandStream,
STATE_BASE_ADDRESS &sbaCmd,
const bool skipCheck) {
STATE_BASE_ADDRESS &sbaCmd) {
if (!trackingEnabled) {
return;
}
NEO::Debugger::SbaAddresses sbaAddresses = {};
NEO::EncodeStateBaseAddress<Family>::setSbaAddressesForDebugger(sbaAddresses, sbaCmd);
if (skipCheck) {
device.getL0Debugger()->programSbaTrackingCommands(commandStream, sbaAddresses);
} else {
device.getL0Debugger()->captureStateBaseAddress(commandStream, sbaAddresses);
}
device.getL0Debugger()->captureStateBaseAddress(commandStream, sbaAddresses);
}
template <typename Family>

View File

@ -444,8 +444,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
NEO::EncodeStateBaseAddress<GfxFamily>::setSbaTrackingForL0DebuggerIfEnabled(sbaTrackingEnabled,
device,
commandStreamCSR,
stateBaseAddressCmd,
false);
stateBaseAddressCmd);
if (sshDirty) {
bindingTableBaseAddressRequired = true;

View File

@ -130,12 +130,6 @@ DebuggerL0 ::~DebuggerL0() {
device->getMemoryManager()->freeGraphicsMemory(moduleDebugArea);
}
void DebuggerL0::captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) {
if (DebuggerL0::isAnyTrackedAddressChanged(sba)) {
programSbaTrackingCommands(cmdStream, sba);
}
}
void DebuggerL0::notifyModuleLoadAllocations(Device *device, const StackVec<NEO::GraphicsAllocation *, 32> &allocs) {
NEO::MemoryOperationsHandler *memoryOperationsIface = device->getRootDeviceEnvironment().memoryOperationsInterface.get();
if (memoryOperationsIface) {

View File

@ -89,7 +89,6 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass {
return sbaTrackingGpuVa.address;
}
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(NEO::Device *device);
@ -100,7 +99,6 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass {
MOCKABLE_VIRTUAL void registerAllocationType(GraphicsAllocation *allocation);
void initSbaTrackingMode();
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;
@ -118,11 +116,6 @@ class DebuggerL0 : public NEO::Debugger, NEO::NonCopyableOrMovableClass {
};
protected:
static bool isAnyTrackedAddressChanged(SbaAddresses sba) {
return sba.GeneralStateBaseAddress != 0 ||
sba.SurfaceStateBaseAddress != 0 ||
sba.BindlessSurfaceStateBaseAddress != 0;
}
static bool initDebuggingInOs(NEO::OSInterface *osInterface);
void initialize();
@ -148,8 +141,8 @@ class DebuggerL0Hw : public DebuggerL0 {
public:
static DebuggerL0 *allocate(NEO::Device *device);
void captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) override;
size_t getSbaTrackingCommandsSize(size_t trackedAddressCount) override;
void programSbaTrackingCommands(NEO::LinearStream &cmdStream, const SbaAddresses &sba) override;
size_t getSbaAddressLoadCommandsSize() override;
void programSbaAddressLoad(NEO::LinearStream &cmdStream, uint64_t sbaGpuVa) override;

View File

@ -14,7 +14,7 @@
namespace NEO {
template <typename GfxFamily>
void DebuggerL0Hw<GfxFamily>::programSbaTrackingCommands(NEO::LinearStream &cmdStream, const SbaAddresses &sba) {
void DebuggerL0Hw<GfxFamily>::captureStateBaseAddress(NEO::LinearStream &cmdStream, SbaAddresses sba) {
using MI_STORE_DATA_IMM = typename GfxFamily::MI_STORE_DATA_IMM;
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;

View File

@ -26,7 +26,6 @@ class MockDebuggerL0 : public NEO::DebuggerL0 {
return 0;
}
void programSbaTrackingCommands(NEO::LinearStream &cmdStream, const SbaAddresses &sba) override{};
size_t getSbaAddressLoadCommandsSize() override { return 0; };
void programSbaAddressLoad(NEO::LinearStream &cmdStream, uint64_t sbaGpuVa) override{};
};
@ -56,11 +55,6 @@ class MockDebuggerL0Hw : public NEO::DebuggerL0Hw<GfxFamily> {
return NEO::DebuggerL0Hw<GfxFamily>::getSbaTrackingCommandsSize(trackedAddressCount);
}
void programSbaTrackingCommands(NEO::LinearStream &cmdStream, const NEO::Debugger::SbaAddresses &sba) override {
programSbaTrackingCommandsCount++;
NEO::DebuggerL0Hw<GfxFamily>::programSbaTrackingCommands(cmdStream, sba);
}
void registerElf(NEO::DebugData *debugData, NEO::GraphicsAllocation *isaAllocation) override {
registerElfCount++;
lastReceivedElf = debugData->vIsa;
@ -112,7 +106,6 @@ class MockDebuggerL0Hw : public NEO::DebuggerL0Hw<GfxFamily> {
}
uint32_t captureStateBaseAddressCount = 0;
uint32_t programSbaTrackingCommandsCount = 0;
uint32_t getSbaTrackingCommandsSizeCount = 0;
uint32_t registerElfCount = 0;
uint32_t commandQueueCreatedCount = 0;

View File

@ -361,7 +361,7 @@ HWTEST_F(PerContextAddressSpaceL0DebuggerTest, givenCanonizedGpuVasWhenProgrammi
sbaAddresses.DynamicStateBaseAddress = dsba;
sbaAddresses.BindlessSurfaceStateBaseAddress = ssba;
debugger->programSbaTrackingCommands(cmdStream, sbaAddresses);
debugger->captureStateBaseAddress(cmdStream, sbaAddresses);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));
@ -450,7 +450,7 @@ HWTEST_F(PerContextAddressSpaceL0DebuggerTest, givenNonZeroGpuVasWhenProgramming
sbaAddresses.DynamicStateBaseAddress = dsba;
sbaAddresses.BindlessSurfaceStateBaseAddress = ssba;
debugger->programSbaTrackingCommands(cmdStream, sbaAddresses);
debugger->captureStateBaseAddress(cmdStream, sbaAddresses);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(cmdList, cmdStream.getCpuBase(), cmdStream.getUsed()));
@ -623,7 +623,7 @@ HWTEST2_P(L0DebuggerSimpleParameterizedTest, givenZeroGpuVasWhenProgrammingSbaTr
sbaAddresses.GeneralStateBaseAddress = gsba;
sbaAddresses.SurfaceStateBaseAddress = ssba;
debugger->programSbaTrackingCommands(cmdStream, sbaAddresses);
debugger->captureStateBaseAddress(cmdStream, sbaAddresses);
EXPECT_EQ(0u, cmdStream.getUsed());
}