mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-18 22:08:53 +08:00
Do not register allocation on fail
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
83db85cf86
commit
449c0dc856
@@ -3461,6 +3461,16 @@ TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryFor
|
||||
EXPECT_FALSE(memoryManager->allocateGraphicsMemoryForNonSvmHostPtr(allocationData));
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerBasic, givenDrmMemoryManagerWhenAllocateGraphicsMemoryForNonSvmHostPtrFailsThenNullPtrReturnedAndAllocationIsNotRegistered) {
|
||||
std::unique_ptr<TestedDrmMemoryManager> memoryManager(new (std::nothrow) TestedDrmMemoryManager(false, false, false, executionEnvironment));
|
||||
memoryManager->forceLimitedRangeAllocator(0xFFFFFFFFF);
|
||||
MockAllocationProperties properties(0u, 64 * GB);
|
||||
|
||||
auto ptr = reinterpret_cast<const void *>(0x100000000000);
|
||||
EXPECT_FALSE(memoryManager->allocateGraphicsMemoryInPreferredPool(properties, ptr));
|
||||
EXPECT_EQ(memoryManager->getSysMemAllocs().size(), 0u);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenAllocateGraphicsMemoryForNonSvmHostPtrIsCalledWithHostPtrIsPassedAndWhenAllocUserptrFailsThenFails) {
|
||||
memoryManager->forceLimitedRangeAllocator(0xFFFFFFFFF);
|
||||
|
||||
|
||||
@@ -463,7 +463,9 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemoryInPreferredPool(const A
|
||||
}
|
||||
if (!allocation && status == AllocationStatus::RetryInNonDevicePool) {
|
||||
allocation = allocateGraphicsMemory(allocationData);
|
||||
this->registerSysMemAlloc(allocation);
|
||||
if (allocation) {
|
||||
this->registerSysMemAlloc(allocation);
|
||||
}
|
||||
}
|
||||
FileLoggerInstance().logAllocation(allocation);
|
||||
registerAllocationInOs(allocation);
|
||||
|
||||
Reference in New Issue
Block a user