mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Ensure base ptr is passed to PageFaultManager::removeAllocation
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f5fb26d017
commit
e197736b6f
@@ -5,10 +5,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_svm_manager.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
@@ -31,4 +33,29 @@ TEST(SvmDeviceAllocationTest, givenGivenSvmAllocsManagerWhenObtainOwnershipCalle
|
||||
svmManager->mtxForIndirectAccess.unlock();
|
||||
});
|
||||
th2.join();
|
||||
}
|
||||
|
||||
using SVMLocalMemoryAllocatorTest = Test<SVMMemoryAllocatorFixture<true>>;
|
||||
TEST_F(SVMLocalMemoryAllocatorTest, whenFreeSharedAllocWithOffsetPointerThenResourceIsRemovedProperly) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
void *cmdQ = reinterpret_cast<void *>(0x12345);
|
||||
auto mockPageFaultManager = new MockPageFaultManager();
|
||||
memoryManager->pageFaultManager.reset(mockPageFaultManager);
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
auto allocationSize = 4096u;
|
||||
auto ptr = svmManager->createSharedUnifiedMemoryAllocation(allocationSize, unifiedMemoryProperties, &cmdQ);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
auto svmData = svmManager->getSVMAlloc(ptr);
|
||||
auto pageFaultMemoryData = mockPageFaultManager->memoryData.find(ptr);
|
||||
EXPECT_NE(svmData, nullptr);
|
||||
EXPECT_NE(pageFaultMemoryData, mockPageFaultManager->memoryData.end());
|
||||
|
||||
svmManager->freeSVMAlloc(ptrOffset(ptr, allocationSize / 4));
|
||||
|
||||
svmData = svmManager->getSVMAlloc(ptr);
|
||||
pageFaultMemoryData = mockPageFaultManager->memoryData.find(ptr);
|
||||
EXPECT_EQ(svmData, nullptr);
|
||||
EXPECT_EQ(pageFaultMemoryData, mockPageFaultManager->memoryData.end());
|
||||
}
|
||||
Reference in New Issue
Block a user