fix: return false for allocInUse when gpu hang detected

Related-To: NEO-16105

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2025-09-16 12:25:41 +00:00
committed by Compute-Runtime-Automation
parent 64c47ff467
commit 5d7250ae6f
4 changed files with 28 additions and 4 deletions

View File

@@ -154,7 +154,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
OsAgnosticMemoryManager::unlockResourceImpl(gfxAllocation);
}
bool allocInUse(GraphicsAllocation &graphicsAllocation) const override {
bool allocInUse(GraphicsAllocation &graphicsAllocation) override {
allocInUseCalled++;
if (callBaseAllocInUse) {

View File

@@ -3413,3 +3413,23 @@ TEST(MemoryManagerTest, WhenAddingCustomHeapAllocatorConfigsThenCanRetrieveAndMa
EXPECT_FALSE(memoryManager.getCustomHeapAllocatorConfig(AllocationType::linearStream, true).has_value());
EXPECT_FALSE(memoryManager.getCustomHeapAllocatorConfig(AllocationType::linearStream, false).has_value());
}
TEST(MemoryManagerTest, givenGpuHangWhenAllocInUseCalledThenReturnFalse) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get(), true, 2);
auto mockMemoryManager = new MockMemoryManager(false, false, executionEnvironment);
executionEnvironment.memoryManager.reset(mockMemoryManager);
auto csr = std::make_unique<MockCommandStreamReceiver>(executionEnvironment, 0, 1);
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor({aub_stream::EngineType::ENGINE_CCS, EngineUsage::regular}));
mockMemoryManager->callBaseAllocInUse = true;
constexpr uint8_t allocationSize = 10;
uint8_t allocationStorage[allocationSize] = {0};
MockGraphicsAllocation allocation{allocationStorage, allocationSize};
allocation.updateTaskCount(10, osContext->getContextId());
*csr->getTagAddress() = 0u;
EXPECT_TRUE(mockMemoryManager->allocInUse(allocation));
csr->isGpuHangDetectedReturnValue = true;
csr->gpuHangCheckPeriod = std::chrono::microseconds::zero();
EXPECT_FALSE(mockMemoryManager->allocInUse(allocation));
}