fix: Add platform support for reservation on svm heap

Related-To: GSD-10816

Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
Aravind Gopalakrishnan
2025-04-01 23:47:02 +00:00
committed by Compute-Runtime-Automation
parent a48d66ad75
commit 3a7d7e022c
9 changed files with 39 additions and 7 deletions

View File

@@ -1067,6 +1067,13 @@ ze_result_t ContextImp::reserveVirtualMem(const void *pStart,
if (castToUint64(pStart) <= maxCpuVa) {
reserveOnSvmHeap = true;
}
bool platformSupportSvmHeapReservation = true;
for (auto &device : this->driverHandle->devices) {
auto &productHelper = device->getNEODevice()->getProductHelper();
platformSupportSvmHeapReservation &= productHelper.isSvmHeapReservationSupported();
}
reserveOnSvmHeap &= platformSupportSvmHeapReservation;
reserveOnSvmHeap &= NEO::debugManager.flags.EnableReservingInSvmRange.get();
NEO::AddressRange addressRange{};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -1559,7 +1559,7 @@ class ReserveMemoryManagerMock : public NEO::MemoryManager {
std::unique_ptr<NEO::GraphicsAllocation> mockAllocation;
};
TEST_F(ContextTest, whenCallingVirtualMemReserveWithPStartInSvmRangeWithSuccessfulAllocationThenSuccessReturned) {
HWTEST2_F(ContextTest, whenCallingVirtualMemReserveWithPStartInSvmRangeWithSuccessfulAllocationThenSuccessReturned, IsNotMTL) {
ze_context_handle_t hContext{};
ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0};
@@ -1763,7 +1763,7 @@ TEST_F(ContextTest, whenUsingOffsetsIntoReservedVirtualMemoryWithMultiplePhysica
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(ContextTest, whenCallingVirtualMemoryReservationWhenOutOfMemoryThenOutOfMemoryReturned) {
HWTEST2_F(ContextTest, whenCallingVirtualMemoryReservationWhenOutOfMemoryThenOutOfMemoryReturned, IsNotMTL) {
ze_context_handle_t hContext;
ze_context_desc_t desc = {ZE_STRUCTURE_TYPE_CONTEXT_DESC, nullptr, 0};
@@ -1955,7 +1955,7 @@ class MockCpuInfoOverrideVirtualAddressSize {
uint32_t virtualAddressSizeSave = 0;
};
TEST_F(ContextTest, Given32BitCpuAddressWidthWhenCallingVirtualMemoryReservationCorrectAllocationMethodIsSelected) {
HWTEST2_F(ContextTest, Given32BitCpuAddressWidthWhenCallingVirtualMemoryReservationCorrectAllocationMethodIsSelected, IsNotMTL) {
MockCpuInfoOverrideVirtualAddressSize overrideCpuInfo(32);
ze_context_handle_t hContext;
@@ -2000,7 +2000,7 @@ TEST_F(ContextTest, Given32BitCpuAddressWidthWhenCallingVirtualMemoryReservation
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(ContextTest, Given48BitCpuAddressWidthWhenCallingVirtualMemoryReservationCorrectAllocationMethodIsSelected) {
HWTEST2_F(ContextTest, Given48BitCpuAddressWidthWhenCallingVirtualMemoryReservationCorrectAllocationMethodIsSelected, IsNotMTL) {
MockCpuInfoOverrideVirtualAddressSize overrideCpuInfo(48);
ze_context_handle_t hContext;
@@ -2044,7 +2044,7 @@ TEST_F(ContextTest, Given48BitCpuAddressWidthWhenCallingVirtualMemoryReservation
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
}
TEST_F(ContextTest, Given57BitCpuAddressWidthWhenCallingVirtualMemoryReservationCorrectAllocationMethodIsSelected) {
HWTEST2_F(ContextTest, Given57BitCpuAddressWidthWhenCallingVirtualMemoryReservationCorrectAllocationMethodIsSelected, IsNotMTL) {
MockCpuInfoOverrideVirtualAddressSize overrideCpuInfo(57);
ze_context_handle_t hContext;