mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add residency handler for TBX
Change-Id: I6c01d065ff3372fe7583ed50ed51595ebeb53e54 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
cb4e5576cb
commit
7a5bc461eb
@ -25,6 +25,7 @@
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||
#include "unit_tests/mocks/mock_memory_operations_handler.h"
|
||||
#include "unit_tests/utilities/destructor_counted.h"
|
||||
|
||||
using namespace NEO;
|
||||
@ -193,7 +194,7 @@ static_assert(sizeof(ExecutionEnvironment) == sizeof(std::vector<std::unique_ptr
|
||||
sizeof(std::unique_ptr<CommandStreamReceiver>) +
|
||||
sizeof(std::mutex) +
|
||||
sizeof(std::unique_ptr<HardwareInfo>) +
|
||||
(is64bit ? 80 : 44),
|
||||
(is64bit ? 88 : 48),
|
||||
"New members detected in ExecutionEnvironment, please ensure that destruction sequence of objects is correct");
|
||||
|
||||
TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDestroyedThenDeleteSequenceIsSpecified) {
|
||||
@ -202,12 +203,15 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDe
|
||||
struct MockExecutionEnvironment : ExecutionEnvironment {
|
||||
using ExecutionEnvironment::gmmHelper;
|
||||
};
|
||||
struct GmmHelperMock : public DestructorCounted<GmmHelper, 8> {
|
||||
struct GmmHelperMock : public DestructorCounted<GmmHelper, 9> {
|
||||
GmmHelperMock(uint32_t &destructorId, const HardwareInfo *hwInfo) : DestructorCounted(destructorId, hwInfo) {}
|
||||
};
|
||||
struct OsInterfaceMock : public DestructorCounted<OSInterface, 7> {
|
||||
struct OsInterfaceMock : public DestructorCounted<OSInterface, 8> {
|
||||
OsInterfaceMock(uint32_t &destructorId) : DestructorCounted(destructorId) {}
|
||||
};
|
||||
struct MemoryOperationsHandlerMock : public DestructorCounted<MockMemoryOperationsHandler, 7> {
|
||||
MemoryOperationsHandlerMock(uint32_t &destructorId) : DestructorCounted(destructorId) {}
|
||||
};
|
||||
struct MemoryMangerMock : public DestructorCounted<MockMemoryManager, 6> {
|
||||
MemoryMangerMock(uint32_t &destructorId, ExecutionEnvironment &executionEnvironment) : DestructorCounted(destructorId, executionEnvironment) {}
|
||||
};
|
||||
@ -235,6 +239,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDe
|
||||
executionEnvironment->commandStreamReceivers.resize(1);
|
||||
executionEnvironment->gmmHelper = std::make_unique<GmmHelperMock>(destructorId, platformDevices[0]);
|
||||
executionEnvironment->osInterface = std::make_unique<OsInterfaceMock>(destructorId);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<MemoryOperationsHandlerMock>(destructorId);
|
||||
executionEnvironment->memoryManager = std::make_unique<MemoryMangerMock>(destructorId, *executionEnvironment);
|
||||
executionEnvironment->aubCenter = std::make_unique<AubCenterMock>(destructorId);
|
||||
executionEnvironment->commandStreamReceivers[0].push_back(std::make_unique<CommandStreamReceiverMock>(destructorId, *executionEnvironment));
|
||||
@ -244,7 +249,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDe
|
||||
executionEnvironment->sourceLevelDebugger = std::make_unique<SourceLevelDebuggerMock>(destructorId);
|
||||
|
||||
executionEnvironment.reset(nullptr);
|
||||
EXPECT_EQ(9u, destructorId);
|
||||
EXPECT_EQ(10u, destructorId);
|
||||
}
|
||||
|
||||
TEST(ExecutionEnvironment, givenMultipleDevicesWhenTheyAreCreatedTheyAllReuseTheSameMemoryManagerAndCommandStreamReceiver) {
|
||||
|
@ -56,6 +56,7 @@ set(IGDRCL_SRCS_tests_mocks
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_lrca_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_memory_manager.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_memory_manager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_memory_operations_handler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_os_context.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_ostime.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_physical_address_allocator.h
|
||||
|
23
unit_tests/mocks/mock_memory_operations_handler.h
Normal file
23
unit_tests/mocks/mock_memory_operations_handler.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/memory_manager/memory_operations_handler.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class GraphicsAllocation;
|
||||
|
||||
class MockMemoryOperationsHandler : public MemoryOperationsHandler {
|
||||
public:
|
||||
MockMemoryOperationsHandler() {}
|
||||
virtual ~MockMemoryOperationsHandler() {}
|
||||
bool makeResident(GraphicsAllocation &gfxAllocation) { return false; }
|
||||
bool evict(GraphicsAllocation &gfxAllocation) { return false; }
|
||||
bool isResident(GraphicsAllocation &gfxAllocation) { return false; }
|
||||
};
|
||||
} // namespace NEO
|
@ -19,6 +19,10 @@ set(IGDRCL_SRCS_tests_os_interface_base
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_gen_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_tests.cpp
|
||||
)
|
||||
|
||||
get_property(NEO_CORE_OS_INTERFACE_AUB_TESTS GLOBAL PROPERTY NEO_CORE_OS_INTERFACE_AUB_TESTS)
|
||||
list(APPEND IGDRCL_SRCS_tests_os_interface_base ${NEO_CORE_OS_INTERFACE_AUB_TESTS})
|
||||
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_os_interface_base})
|
||||
set_property(GLOBAL PROPERTY IGDRCL_SRCS_tests_os_interface_base ${IGDRCL_SRCS_tests_os_interface_base})
|
||||
add_subdirectories()
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/memory_manager/memory_constants.h"
|
||||
#include "runtime/os_interface/device_factory.h"
|
||||
#include "runtime/os_interface/os_interface.h"
|
||||
#include "runtime/os_interface/os_library.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
|
||||
@ -169,4 +170,4 @@ TEST_F(DeviceFactoryTest, givenGetDevicesCallWhenItIsDoneThenOsInterfaceIsAlloca
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_NE(nullptr, executionEnvironment->osInterface);
|
||||
}
|
||||
}
|
@ -29,6 +29,7 @@ HWTEST_F(DrmCommandStreamMMTest, MMwithPinBB) {
|
||||
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment.osInterface->get()->setDrm(&mock);
|
||||
executionEnvironment.memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
|
||||
|
||||
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, gemCloseWorkerMode::gemCloseWorkerInactive);
|
||||
|
||||
|
@ -43,6 +43,7 @@ class DrmCommandStreamFixture {
|
||||
executionEnvironment.setHwInfo(*platformDevices);
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment.osInterface->get()->setDrm(mock.get());
|
||||
executionEnvironment.memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
|
||||
|
||||
osContext = std::make_unique<OsContextLinux>(*mock, 0u, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
|
||||
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
|
||||
|
@ -71,6 +71,7 @@ class DrmGemCloseWorkerFixture {
|
||||
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment.osInterface->get()->setDrm(drmMock);
|
||||
executionEnvironment.memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
|
||||
|
||||
this->mm = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive,
|
||||
false,
|
||||
|
@ -25,6 +25,7 @@ class DrmMemoryManagerBasic : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment.osInterface->get()->setDrm(Drm::get(0));
|
||||
executionEnvironment.memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
|
||||
}
|
||||
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/linux/drm_residency_handler.h"
|
||||
#include "runtime/os_interface/linux/drm_memory_operations_handler.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
|
||||
@ -13,22 +13,22 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct DrmResidencyHandlerTest : public ::testing::Test {
|
||||
struct DrmMemoryOperationsHandlerTest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
drmResidencyHandler = std::make_unique<DrmResidencyHandler>();
|
||||
drmMemoryOperationsHandler = std::make_unique<DrmMemoryOperationsHandler>();
|
||||
}
|
||||
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
std::unique_ptr<DrmResidencyHandler> drmResidencyHandler;
|
||||
std::unique_ptr<DrmMemoryOperationsHandler> drmMemoryOperationsHandler;
|
||||
};
|
||||
|
||||
TEST_F(DrmResidencyHandlerTest, whenMakingResidentAllocaionExpectMakeResidentFail) {
|
||||
EXPECT_FALSE(drmResidencyHandler->makeResident(graphicsAllocation));
|
||||
EXPECT_FALSE(drmResidencyHandler->isResident(graphicsAllocation));
|
||||
TEST_F(DrmMemoryOperationsHandlerTest, whenMakingResidentAllocaionExpectMakeResidentFail) {
|
||||
EXPECT_FALSE(drmMemoryOperationsHandler->makeResident(graphicsAllocation));
|
||||
EXPECT_FALSE(drmMemoryOperationsHandler->isResident(graphicsAllocation));
|
||||
}
|
||||
|
||||
TEST_F(DrmResidencyHandlerTest, whenEvictingResidentAllocationExpectEvictFalse) {
|
||||
EXPECT_FALSE(drmResidencyHandler->makeResident(graphicsAllocation));
|
||||
EXPECT_FALSE(drmResidencyHandler->evict(graphicsAllocation));
|
||||
EXPECT_FALSE(drmResidencyHandler->isResident(graphicsAllocation));
|
||||
TEST_F(DrmMemoryOperationsHandlerTest, whenEvictingResidentAllocationExpectEvictFalse) {
|
||||
EXPECT_FALSE(drmMemoryOperationsHandler->makeResident(graphicsAllocation));
|
||||
EXPECT_FALSE(drmMemoryOperationsHandler->evict(graphicsAllocation));
|
||||
EXPECT_FALSE(drmMemoryOperationsHandler->isResident(graphicsAllocation));
|
||||
}
|
||||
|
@ -23,10 +23,4 @@ TEST(OsInterfaceTest, GivenLinuxOsInterfaceWhenDeviceHandleQueriedthenZeroIsRetu
|
||||
OSInterface osInterface;
|
||||
EXPECT_EQ(0u, osInterface.getDeviceHandle());
|
||||
}
|
||||
|
||||
TEST(OsInterfaceTest, GivenLinuxOsInterfaceWhenResidencyInterfaceRetrievedThenCreatedObjectReturned) {
|
||||
OSInterface osInterface;
|
||||
EXPECT_NE(nullptr, osInterface.getResidencyInterface());
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/os_interface/os_interface.h"
|
||||
#include "runtime/os_interface/os_time.h"
|
||||
@ -561,4 +562,4 @@ TEST_F(PerformanceCountersTest, givenRenderCoreFamilyThenMetricsLibraryGenIdenti
|
||||
const auto &hwInfo = device->getHardwareInfo();
|
||||
const auto gen = hwInfo.platform.eRenderCoreFamily;
|
||||
EXPECT_NE(ClientGen::Unknown, static_cast<ClientGen>(HwHelper::get(gen).getMetricsLibraryGenId()));
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "runtime/os_interface/windows/os_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm_device_command_stream.h"
|
||||
#include "runtime/os_interface/windows/wddm_memory_manager.h"
|
||||
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "runtime/os_interface/windows/wddm_residency_controller.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "test.h"
|
||||
@ -63,7 +64,6 @@ class WddmCommandStreamFixture {
|
||||
memoryManager = new MockWddmMemoryManager(*executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
wddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
|
||||
|
||||
csr = new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*executionEnvironment);
|
||||
device.reset(MockDevice::create<MockDevice>(executionEnvironment, 0u));
|
||||
|
||||
@ -803,6 +803,7 @@ HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedO
|
||||
auto wddm = Wddm::createWddm();
|
||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
std::unique_ptr<MockWddmCsr<FamilyType>> mockCsr(new MockWddmCsr<FamilyType>(*executionEnvironment));
|
||||
EXPECT_EQ(DispatchMode::BatchedDispatch, mockCsr->dispatchMode);
|
||||
}
|
||||
@ -811,6 +812,7 @@ HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVer
|
||||
auto wddm = Wddm::createWddm();
|
||||
pDevice->executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
pDevice->executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
pDevice->executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
WddmCommandStreamReceiver<FamilyType> wddmCsr(*pDevice->executionEnvironment);
|
||||
|
||||
auto wddmFromCsr = wddmCsr.peekWddm();
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "runtime/os_interface/windows/os_context_win.h"
|
||||
#include "runtime/os_interface/windows/os_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include "runtime/os_interface/windows/wddm_residency_handler.h"
|
||||
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "runtime/sharings/gl/gl_arb_sync_event.h"
|
||||
#include "runtime/sharings/gl/gl_sharing.h"
|
||||
#include "unit_tests/mocks/gl/mock_gl_sharing.h"
|
||||
|
@ -21,7 +21,7 @@ TEST_F(OsInterfaceTest, GivenWindowsWhenCreateEentIsCalledThenValidEventHandleIs
|
||||
EXPECT_EQ(TRUE, ret);
|
||||
}
|
||||
|
||||
TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInitializedTrimCallbackIsRegisteredResidencyHandlerCreated) {
|
||||
TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInitializedTrimCallbackIsRegisteredMemoryOperationsHandlerCreated) {
|
||||
auto wddm = new WddmMock;
|
||||
OSInterface osInterface;
|
||||
osInterface.get()->setWddm(wddm);
|
||||
@ -33,5 +33,4 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit
|
||||
EXPECT_TRUE(osContext->isInitialized());
|
||||
EXPECT_EQ(osContext->getWddm(), wddm);
|
||||
EXPECT_EQ(1u, wddm->registerTrimCallbackResult.called);
|
||||
EXPECT_NE(nullptr, osInterface.getResidencyInterface());
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||
#include "runtime/os_interface/windows/os_context_win.h"
|
||||
#include "runtime/os_interface/windows/os_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
@ -29,6 +30,7 @@ struct WddmFixture : ::testing::Test {
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = executionEnvironment->osInterface.get();
|
||||
gdi = new MockGdi();
|
||||
wddm->gdi.reset(gdi);
|
||||
@ -55,6 +57,7 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = executionEnvironment->osInterface.get();
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ void WddmMemoryManagerFixture::SetUp() {
|
||||
executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
|
||||
}
|
||||
@ -1297,6 +1298,7 @@ TEST(WddmMemoryManagerDefaults, givenDefaultWddmMemoryManagerWhenItIsQueriedForI
|
||||
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
||||
auto wddm = new WddmMock();
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
auto hwInfoMock = *platformDevices[0];
|
||||
wddm->init(hwInfoMock);
|
||||
MockWddmMemoryManager memoryManager(*executionEnvironment);
|
||||
@ -1624,6 +1626,7 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen
|
||||
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment.osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment.memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
executionEnvironment.commandStreamReceivers.resize(1);
|
||||
executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr<CommandStreamReceiver>(csr));
|
||||
executionEnvironment.memoryManager = std::make_unique<WddmMemoryManager>(executionEnvironment);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "runtime/os_interface/windows/os_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/helpers/execution_environment_helper.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
@ -56,6 +57,7 @@ class MockWddmMemoryManagerFixture {
|
||||
|
||||
executionEnvironment->osInterface.reset(new OSInterface());
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
|
||||
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
|
||||
@ -101,6 +103,7 @@ class WddmMemoryManagerFixtureWithGmockWddm : public ExecutionEnvironmentFixture
|
||||
auto hwInfo = *platformDevices[0];
|
||||
wddm->init(hwInfo);
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = executionEnvironment->osInterface.get();
|
||||
memoryManager = new (std::nothrow) MockWddmMemoryManager(*executionEnvironment);
|
||||
//assert we have memory manager
|
||||
@ -162,6 +165,7 @@ class MockWddmMemoryManagerTest : public ::testing::Test {
|
||||
executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
||||
wddm = new WddmMock();
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
}
|
||||
|
||||
HardwareInfo *hwInfo;
|
||||
|
@ -32,6 +32,7 @@ class WddmPreemptionTests : public Test<WddmFixtureWithMockGdiDll> {
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = executionEnvironment->osInterface.get();
|
||||
auto regReader = new RegistryReaderMock();
|
||||
wddm->registryReader.reset(regReader);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/memory_manager/residency_handler.h"
|
||||
#include "core/memory_manager/memory_operations_handler.h"
|
||||
#include "runtime/command_stream/preemption.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/helpers/hw_helper.h"
|
||||
@ -14,6 +14,7 @@
|
||||
#include "runtime/os_interface/windows/os_context_win.h"
|
||||
#include "runtime/os_interface/windows/os_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "runtime/os_interface/windows/wddm_residency_controller.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "test.h"
|
||||
@ -94,6 +95,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT
|
||||
|
||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
|
||||
|
||||
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false);
|
||||
@ -126,6 +128,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
executionEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
|
||||
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/windows/wddm_residency_handler.h"
|
||||
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/mocks/mock_allocation_properties.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
@ -14,24 +14,24 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct WddmResidencyHandlerTest : public WddmTest {
|
||||
struct WddmMemoryOperationsHandlerTest : public WddmTest {
|
||||
void SetUp() override {
|
||||
WddmTest::SetUp();
|
||||
wddmResidencyHandler = std::make_unique<WddmResidencyHandler>(wddm);
|
||||
wddmMemoryOperationsHandler = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
wddmAllocation.handle = 0x2;
|
||||
}
|
||||
|
||||
std::unique_ptr<WddmResidencyHandler> wddmResidencyHandler;
|
||||
std::unique_ptr<WddmMemoryOperationsHandler> wddmMemoryOperationsHandler;
|
||||
MockWddmAllocation wddmAllocation;
|
||||
};
|
||||
|
||||
TEST_F(WddmResidencyHandlerTest, whenMakingResidentAllocaionExpectMakeResidentCalled) {
|
||||
EXPECT_TRUE(wddmResidencyHandler->makeResident(wddmAllocation));
|
||||
EXPECT_TRUE(wddmResidencyHandler->isResident(wddmAllocation));
|
||||
TEST_F(WddmMemoryOperationsHandlerTest, whenMakingResidentAllocaionExpectMakeResidentCalled) {
|
||||
EXPECT_TRUE(wddmMemoryOperationsHandler->makeResident(wddmAllocation));
|
||||
EXPECT_TRUE(wddmMemoryOperationsHandler->isResident(wddmAllocation));
|
||||
}
|
||||
|
||||
TEST_F(WddmResidencyHandlerTest, whenEvictingResidentAllocationExpectEvictCalled) {
|
||||
EXPECT_TRUE(wddmResidencyHandler->makeResident(wddmAllocation));
|
||||
EXPECT_TRUE(wddmResidencyHandler->evict(wddmAllocation));
|
||||
EXPECT_FALSE(wddmResidencyHandler->isResident(wddmAllocation));
|
||||
TEST_F(WddmMemoryOperationsHandlerTest, whenEvictingResidentAllocationExpectEvictCalled) {
|
||||
EXPECT_TRUE(wddmMemoryOperationsHandler->makeResident(wddmAllocation));
|
||||
EXPECT_TRUE(wddmMemoryOperationsHandler->evict(wddmAllocation));
|
||||
EXPECT_FALSE(wddmMemoryOperationsHandler->isResident(wddmAllocation));
|
||||
}
|
||||
|
@ -7,9 +7,9 @@
|
||||
add_executable(igdrcl_tbx_tests
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main_tbx.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_tests_configuration.cpp
|
||||
${IGDRCL_SOURCE_DIR}/runtime/aub/aub_stream_interface.cpp
|
||||
${IGDRCL_SOURCE_DIR}/runtime/dll/create_command_stream.cpp
|
||||
${IGDRCL_SOURCE_DIR}/runtime/dll${BRANCH_DIR_SUFFIX}/get_devices.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/aub_stream_mocks/aub_stream_interface_mock.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/libult/os_interface.cpp
|
||||
${IGDRCL_SOURCE_DIR}/unit_tests/options.cpp
|
||||
$<TARGET_OBJECTS:igdrcl_libult>
|
||||
|
Reference in New Issue
Block a user