fix: add missing aub polls on sync points

Related-To: HSD-14023925176

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-11-20 12:36:45 +00:00
committed by Compute-Runtime-Automation
parent 0f360e96f6
commit dab4166837
20 changed files with 140 additions and 20 deletions

View File

@@ -611,6 +611,29 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
EXPECT_TRUE(aubCsr->pollForCompletionCalled);
}
HWTEST_F(AubCommandStreamReceiverTests, whenPollForAubCompletionCalledThenInsertPoll) {
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}));
std::string fileName = "file_name.aub";
MockAubManager *mockManager = new MockAubManager();
MockAubCenter *mockAubCenter = new MockAubCenter(pDevice->getRootDeviceEnvironment(), false, fileName, CommandStreamReceiverType::aub);
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(static_cast<AUBCommandStreamReceiverHw<FamilyType> *>(AUBCommandStreamReceiver::create(fileName, true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield())));
aubCsr->setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr->hardwareContextController->hardwareContexts[0].get());
aubCsr->pollForAubCompletion();
EXPECT_TRUE(mockHardwareContext->pollForCompletionCalled);
mockHardwareContext->pollForCompletionCalled = false;
aubCsr->pollForAubCompletion();
EXPECT_TRUE(mockHardwareContext->pollForCompletionCalled);
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnCommandBufferAllocation) {
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();

View File

@@ -2371,7 +2371,7 @@ template <typename FamilyType>
struct MockSimulatedCsrHw : public CommandStreamReceiverSimulatedHw<FamilyType> {
using CommandStreamReceiverSimulatedHw<FamilyType>::CommandStreamReceiverSimulatedHw;
using CommandStreamReceiverSimulatedHw<FamilyType>::getDeviceIndex;
void pollForCompletion() override {}
void pollForCompletion(bool skipTaskCountCheck) override {}
void initializeEngine() override {}
bool writeMemory(GraphicsAllocation &gfxAllocation) override { return true; }
void writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits) override {}

View File

@@ -253,6 +253,30 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenWait
csrWithAubDump.waitForTaskCountWithKmdNotifyFallback(1, 0, false, QueueThrottle::MEDIUM);
}
HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, whenPollForAubCompletionCalledThenDontInsertPoll) {
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}));
auto executionEnvironment = pDevice->getExecutionEnvironment();
executionEnvironment->initializeMemoryManager();
MockAubCenter *mockAubCenter = new MockAubCenter(pDevice->getRootDeviceEnvironment(), false, "file_name.aub", CommandStreamReceiverType::hardwareWithAub);
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(new MockAubManager());
executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
DeviceBitfield deviceBitfield(1);
CommandStreamReceiverWithAUBDump<UltCommandStreamReceiver<FamilyType>> csrWithAubDump("file_name.aub", *executionEnvironment, 0, deviceBitfield);
csrWithAubDump.initializeTagAllocation();
auto mockAubCsr = new MockAubCsr<FamilyType>("file_name.aub", false, *executionEnvironment, 0, deviceBitfield);
mockAubCsr->initializeTagAllocation();
csrWithAubDump.aubCSR.reset(mockAubCsr);
csrWithAubDump.setupContext(osContext);
csrWithAubDump.pollForAubCompletion();
EXPECT_FALSE(csrWithAubDump.pollForCompletionCalled);
EXPECT_TRUE(mockAubCsr->pollForCompletionCalled);
}
HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenPollForCompletionCalledThenAubCsrPollForCompletionCalled) {
auto executionEnvironment = pDevice->getExecutionEnvironment();
executionEnvironment->initializeMemoryManager();

View File

@@ -633,6 +633,17 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh
pDevice->executionEnvironment->memoryManager->freeGraphicsMemory(commandBuffer);
}
HWTEST_F(TbxCommandStreamTests, whenPollForAubCompletionCalledThenDontInsertPoll) {
MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment, pDevice->getDeviceBitfield());
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor(pDevice->getDeviceBitfield()));
tbxCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
tbxCsr.pollForAubCompletion();
EXPECT_FALSE(tbxCsr.pollForCompletionCalled);
EXPECT_FALSE(mockHardwareContext->pollForCompletionCalled);
}
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFlushIsCalledThenItShouldMakeCommandBufferResident) {
DebugManagerStateRestore dbgRestore;
debugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::batchedDispatch));

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,7 +21,7 @@ class MockSimulatedCsrHw : public CommandStreamReceiverSimulatedHw<GfxFamily> {
using CommandStreamReceiverSimulatedHw<GfxFamily>::writeMemory;
void writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits) override {
}
void pollForCompletion() override {
void pollForCompletion(bool skipTaskCountCheck) override {
}
void initializeEngine() override {
}