fix: Use Gmm to map virtual gpu addresses

Related-To: NEO-5842, NEO-7946

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2023-05-18 16:27:44 +00:00
committed by Compute-Runtime-Automation
parent ab1b4681cc
commit 4b6194cf0c
17 changed files with 209 additions and 8 deletions

View File

@@ -6,11 +6,13 @@
*/
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/string.h"
#include "shared/source/os_interface/driver_info.h"
#include "shared/source/os_interface/windows/wddm/um_km_data_translator.h"
#include "shared/source/os_interface/windows/wddm_allocation.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_gmm_client_context_base.h"
#include "shared/test/common/mocks/mock_io_functions.h"
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -395,6 +397,18 @@ TEST_F(WddmTests, GivenPlatformNotSupportEvictIfNecessaryWhenAdjustingEvictNeede
EXPECT_TRUE(value);
}
TEST_F(WddmTests, GivenWddmWhenMapGpuVaCalledThenGmmClientCallsMapGpuVa) {
NEO::AllocationData allocData = {};
allocData.type = NEO::AllocationType::BUFFER;
wddm->callBaseDestroyAllocations = false;
wddm->pagingQueue = PAGINGQUEUE_HANDLE;
auto memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{0, MemoryConstants::pageSize}));
wddm->mapGpuVirtualAddress(allocation);
EXPECT_GT(reinterpret_cast<MockGmmClientContextBase *>(allocation->getDefaultGmm()->getGmmHelper()->getClientContext())->mapGpuVirtualAddressCalled, 0u);
memoryManager->freeGraphicsMemory(allocation);
}
uint64_t waitForSynchronizationObjectFromCpuCounter = 0u;
NTSTATUS __stdcall waitForSynchronizationObjectFromCpuNoOpMock(const D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMCPU *waitStruct) {