/* * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "shared/source/helpers/hw_info.h" #include "shared/source/memory_manager/unified_memory_manager.h" #include "shared/test/common/fixtures/cpu_page_fault_manager_tests_fixture.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/mocks/mock_graphics_allocation.h" namespace NEO { struct MockSVMAllocsManager : public SVMAllocsManager { public: using SVMAllocsManager::memoryManager; using SVMAllocsManager::mtxForIndirectAccess; using SVMAllocsManager::multiOsContextSupport; using SVMAllocsManager::svmAllocs; using SVMAllocsManager::SVMAllocsManager; using SVMAllocsManager::svmMapOperations; using SVMAllocsManager::usmDeviceAllocationsCache; using SVMAllocsManager::usmDeviceAllocationsCacheEnabled; void prefetchMemory(Device &device, CommandStreamReceiver &commandStreamReceiver, SvmAllocationData &svmData) override { SVMAllocsManager::prefetchMemory(device, commandStreamReceiver, svmData); prefetchMemoryCalled = true; } bool prefetchMemoryCalled = false; }; template struct SVMMemoryAllocatorFixture { SVMMemoryAllocatorFixture() : executionEnvironment(defaultHwInfo.get()) {} void setUp() { bool svmSupported = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.ftrSvm; if (!svmSupported) { GTEST_SKIP(); } executionEnvironment.initGmm(); memoryManager = std::make_unique(false, enableLocalMemory, executionEnvironment); svmManager = std::make_unique(memoryManager.get(), false); if (enableLocalMemory) { memoryManager->pageFaultManager.reset(new MockPageFaultManager); } } void tearDown() { } MockExecutionEnvironment executionEnvironment; std::unique_ptr memoryManager; std::unique_ptr svmManager; RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex}; std::map deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}}; }; } // namespace NEO