mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
L0 Virtual Memory Reservation support
- Enable support for L0 Virtual Memory reservation on Linux and Windows. - Excludes support for Linux to allow pStart option Related-To: LOCI-3397, LOCI-1543 Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
467119931c
commit
d81b0b14a1
@ -1628,15 +1628,43 @@ TEST(OsAgnosticMemoryManager, givenOsAgnosticMemoryManagerAndFreeMemoryDisabledW
|
||||
TEST(OsAgnosticMemoryManager, givenOsAgnosticMemoryManagerWhenGpuAddressIsReservedAndFreedThenAddressFromGfxPartitionIsUsed) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
|
||||
auto addressRange = memoryManager.reserveGpuAddress(MemoryConstants::pageSize, 0);
|
||||
RootDeviceIndicesContainer rootDevices;
|
||||
rootDevices.push_back(0);
|
||||
uint32_t rootDeviceIndexReserved = 10;
|
||||
auto addressRange = memoryManager.reserveGpuAddress(nullptr, MemoryConstants::pageSize, rootDevices, &rootDeviceIndexReserved);
|
||||
auto gmmHelper = memoryManager.getGmmHelper(0);
|
||||
EXPECT_EQ(0u, rootDeviceIndexReserved);
|
||||
EXPECT_LE(memoryManager.getGfxPartition(0)->getHeapBase(HeapIndex::HEAP_STANDARD), gmmHelper->decanonize(addressRange.address));
|
||||
EXPECT_GT(memoryManager.getGfxPartition(0)->getHeapLimit(HeapIndex::HEAP_STANDARD), gmmHelper->decanonize(addressRange.address));
|
||||
|
||||
memoryManager.freeGpuAddress(addressRange, 0);
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenOsAgnosticMemoryManagerWhenGpuAddressReservationIsAttemptedWihtInvalidSizeThenFailureReturnsNullAddressRange) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
RootDeviceIndicesContainer rootDevices;
|
||||
rootDevices.push_back(0);
|
||||
uint32_t rootDeviceIndexReserved = 10;
|
||||
// emulate GPU address space exhaust
|
||||
memoryManager.getGfxPartition(0)->heapInit(HeapIndex::HEAP_STANDARD, 0x0, 0x10000);
|
||||
auto addressRange = memoryManager.reserveGpuAddress(nullptr, (size_t)(memoryManager.getGfxPartition(0)->getHeapLimit(HeapIndex::HEAP_STANDARD) * 2), rootDevices, &rootDeviceIndexReserved);
|
||||
EXPECT_EQ(static_cast<int>(addressRange.address), 0);
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenOsAgnosticMemoryManagerWhenGpuAddressReservationIsAttemptedWithARequiredPtrThenNullRangeReturned) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
RootDeviceIndicesContainer rootDevices;
|
||||
rootDevices.push_back(0);
|
||||
uint32_t rootDeviceIndexReserved = 10;
|
||||
void *requiredPtr = reinterpret_cast<void *>(0x1234);
|
||||
auto addressRange = memoryManager.reserveGpuAddress(requiredPtr, MemoryConstants::pageSize, rootDevices, &rootDeviceIndexReserved);
|
||||
EXPECT_EQ(0u, rootDeviceIndexReserved);
|
||||
EXPECT_EQ(static_cast<int>(addressRange.address), 0);
|
||||
EXPECT_EQ(static_cast<int>(addressRange.size), 0);
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenOsAgnosticMemoryManagerWhenCheckedForIndirectAllocationsAsPackSupportThenFalseIsReturned) {
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
|
Reference in New Issue
Block a user