mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
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:
committed by
Compute-Runtime-Automation
parent
0f360e96f6
commit
dab4166837
@@ -53,9 +53,9 @@ class UltAubCommandStreamReceiver : public AUBCommandStreamReceiverHw<GfxFamily>
|
||||
return BaseClass::flushBcsTask(blitPropertiesContainer, blocking, profilingEnabled, device);
|
||||
}
|
||||
|
||||
void pollForCompletion() override {
|
||||
void pollForCompletion(bool skipTaskCountCheck) override {
|
||||
pollForCompletionCalled++;
|
||||
BaseClass::pollForCompletion();
|
||||
BaseClass::pollForCompletion(skipTaskCountCheck);
|
||||
}
|
||||
|
||||
uint32_t blitBufferCalled = 0;
|
||||
|
||||
@@ -78,6 +78,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
using BaseClass::makeResident;
|
||||
using BaseClass::pageTableManagerInitialized;
|
||||
using BaseClass::perDssBackedBuffer;
|
||||
using BaseClass::pollForCompletion;
|
||||
using BaseClass::postInitFlagsSetup;
|
||||
using BaseClass::primaryCsr;
|
||||
using BaseClass::programActivePartitionConfig;
|
||||
@@ -479,10 +480,14 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
return commandStreamReceiverType;
|
||||
}
|
||||
|
||||
void pollForCompletion() override {
|
||||
void pollForCompletion(bool skipTaskCountCheck) override {
|
||||
pollForCompletionCalled++;
|
||||
}
|
||||
|
||||
void pollForAubCompletion() override {
|
||||
pollForAubCompletionCalled++;
|
||||
}
|
||||
|
||||
bool checkGpuHangDetected(CommandStreamReceiver::TimeType currentTime, CommandStreamReceiver::TimeType &lastHangCheckTime) const override {
|
||||
checkGpuHangDetectedCalled++;
|
||||
if (forceReturnGpuHang) {
|
||||
@@ -566,6 +571,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
uint32_t initDirectSubmissionCalled = 0;
|
||||
uint32_t fillReusableAllocationsListCalled = 0;
|
||||
uint32_t pollForCompletionCalled = 0;
|
||||
uint32_t pollForAubCompletionCalled = 0;
|
||||
uint32_t initializeDeviceWithFirstSubmissionCalled = 0;
|
||||
uint32_t drainPagingFenceQueueCalled = 0;
|
||||
uint32_t flushHandlerCalled = 0;
|
||||
|
||||
@@ -60,6 +60,7 @@ struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
using AUBCommandStreamReceiverHw<GfxFamily>::pollForCompletionTaskCount;
|
||||
using AUBCommandStreamReceiverHw<GfxFamily>::getParametersForMemory;
|
||||
using AUBCommandStreamReceiverHw<GfxFamily>::writeMemory;
|
||||
using AUBCommandStreamReceiverHw<GfxFamily>::pollForCompletion;
|
||||
using AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw;
|
||||
|
||||
CompletionStamp flushTask(LinearStream &commandStream, size_t commandStreamStart,
|
||||
@@ -120,10 +121,12 @@ struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
writeMemoryWithAubManagerCalled = true;
|
||||
}
|
||||
|
||||
void pollForCompletion() override {
|
||||
AUBCommandStreamReceiverHw<GfxFamily>::pollForCompletion();
|
||||
void pollForCompletion(bool skipTaskCountCheck) override {
|
||||
AUBCommandStreamReceiverHw<GfxFamily>::pollForCompletion(skipTaskCountCheck);
|
||||
pollForCompletionCalled = true;
|
||||
skipTaskCountCheckForCompletionPoll = skipTaskCountCheck;
|
||||
}
|
||||
|
||||
bool expectMemoryEqual(void *gfxAddress, const void *srcAddress, size_t length) override {
|
||||
expectMemoryEqualCalled = true;
|
||||
return AUBCommandStreamReceiverHw<GfxFamily>::expectMemoryEqual(gfxAddress, srcAddress, length);
|
||||
@@ -168,6 +171,7 @@ struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
|
||||
bool expectMemoryCompressedCalled = false;
|
||||
bool addAubCommentCalled = false;
|
||||
bool dumpAllocationCalled = false;
|
||||
bool skipTaskCountCheckForCompletionPoll = false;
|
||||
|
||||
void initFile(const std::string &fileName) override {
|
||||
fileIsOpen = true;
|
||||
|
||||
@@ -52,8 +52,8 @@ class MockTbxCsr : public TbxCommandStreamReceiverHw<GfxFamily> {
|
||||
overrideRingHeadPassed = overrideRingHead;
|
||||
submitBatchBufferCalled = true;
|
||||
}
|
||||
void pollForCompletion() override {
|
||||
TbxCommandStreamReceiverHw<GfxFamily>::pollForCompletion();
|
||||
void pollForCompletion(bool skipTaskCountCheck) override {
|
||||
TbxCommandStreamReceiverHw<GfxFamily>::pollForCompletion(skipTaskCountCheck);
|
||||
pollForCompletionCalled = true;
|
||||
}
|
||||
void downloadAllocationTbxMock(GraphicsAllocation &gfxAllocation) {
|
||||
|
||||
@@ -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>>();
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user