mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Move wddm_fixture.h and releted files from opencl to shared
Related-To: NEO-5894 Signed-off-by: Piotr Obst <piotr.obst@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
0f072a93e0
commit
acf3e58a64
@ -14,10 +14,10 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "test.h"
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "shared/source/os_interface/debug_env_reader.h"
|
||||
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_io_functions.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_io_functions.h"
|
||||
#include "test.h"
|
||||
|
||||
#include <memory>
|
||||
|
@ -5,18 +5,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/aub_command_stream_receiver.h"
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/command_stream/device_command_stream.h"
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
||||
|
||||
#include "opencl/source/command_stream/aub_command_stream_receiver.h"
|
||||
#include "opencl/source/os_interface/linux/device_command_stream.inl"
|
||||
#include "opencl/source/os_interface/linux/drm_command_stream.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h"
|
||||
#include "test.h"
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock.h"
|
||||
#include "test.h"
|
||||
|
||||
|
@ -11,11 +11,11 @@
|
||||
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/source/os_interface/linux/drm_command_stream.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/linux/mock_drm_command_stream_receiver.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/source/os_interface/linux/drm_command_stream.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
|
@ -13,10 +13,10 @@
|
||||
#include "shared/source/os_interface/linux/drm_memory_manager.h"
|
||||
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/source/os_interface/linux/drm_command_stream.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_command_stream_fixture.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.h"
|
||||
#include "test.h"
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests_dg1.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock_dg1.h"
|
||||
|
@ -13,12 +13,12 @@
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/memory_management_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/linux/mock_drm_command_stream_receiver.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_builtins.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h"
|
||||
|
||||
#include <memory>
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/linux/drm_mock.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -9,8 +9,7 @@
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
using namespace MetricsLibraryApi;
|
||||
|
||||
namespace NEO {
|
||||
|
@ -11,10 +11,10 @@
|
||||
#include "shared/source/utilities/tag_allocator.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/device_instrumentation_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_os_context.h"
|
||||
#include "opencl/test/unit_test/os_interface/mock_performance_counters.h"
|
||||
|
||||
|
@ -11,7 +11,6 @@ set(IGDRCL_SRCS_tests_os_interface_windows
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_os_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_info_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/file_logger_win_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gdi_dll_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_win_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_win_tests.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_environment_variables.h
|
||||
@ -30,7 +29,6 @@ set(IGDRCL_SRCS_tests_os_interface_windows
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/registry_reader_tests.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/self_lib_win.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_address_space_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_fixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_kmdaf_listener_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_memory_manager_tests.h
|
||||
@ -42,6 +40,7 @@ set(IGDRCL_SRCS_tests_os_interface_windows
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_registry_reader.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_sys_calls.h
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
file(GLOB IGDRCL_SRC_tests_wddm_interface "${CMAKE_CURRENT_SOURCE_DIR}/wddm2[0-9]_tests\.cpp")
|
||||
target_sources(igdrcl_tests PRIVATE
|
||||
@ -49,4 +48,5 @@ if(WIN32)
|
||||
${IGDRCL_SRC_tests_wddm_interface}
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectories()
|
||||
|
@ -7,9 +7,8 @@
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/os_interface/windows/deferrable_deletion_win.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/aub_command_stream_receiver.h"
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/command_stream/device_command_stream.h"
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
@ -20,32 +21,32 @@
|
||||
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "shared/source/os_interface/windows/wddm_residency_controller.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/dispatch_flags_helper.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_io_functions.h"
|
||||
#include "shared/test/common/mocks/windows/mock_wddm_direct_submission.h"
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
||||
#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h"
|
||||
|
||||
#include "opencl/source/command_stream/aub_command_stream_receiver.h"
|
||||
#include "opencl/source/command_stream/command_stream_receiver_with_aub_dump.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
#include "opencl/source/os_interface/windows/wddm_device_command_stream.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/memory_management_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_builtins.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm_page_table_mngr.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_io_functions.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_program.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_submissions_aggregator.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm_interface23.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_memory_manager.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/wddm_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
@ -176,10 +177,20 @@ class WddmCommandStreamWithMockGdiFixture {
|
||||
using WddmCommandStreamTest = ::Test<WddmCommandStreamFixture>;
|
||||
using WddmCommandStreamMockGdiTest = ::Test<WddmCommandStreamWithMockGdiFixture>;
|
||||
using WddmDefaultTest = ::Test<ClDeviceFixture>;
|
||||
using DeviceCommandStreamTest = ::Test<MockAubCenterFixture>;
|
||||
struct DeviceCommandStreamTest : ::Test<MockAubCenterFixture>, DeviceFixture {
|
||||
void SetUp() override {
|
||||
DeviceFixture::SetUp();
|
||||
MockAubCenterFixture::SetUp();
|
||||
setMockAubCenter(pDevice->getRootDeviceEnvironmentRef());
|
||||
}
|
||||
void TearDown() override {
|
||||
MockAubCenterFixture::TearDown();
|
||||
DeviceFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(DeviceCommandStreamTest, WhenCreatingWddmCsrThenWddmPointerIsSetCorrectly) {
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
ExecutionEnvironment *executionEnvironment = pDevice->getExecutionEnvironment();
|
||||
auto wddm = Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
@ -191,7 +202,7 @@ TEST_F(DeviceCommandStreamTest, WhenCreatingWddmCsrThenWddmPointerIsSetCorrectly
|
||||
}
|
||||
|
||||
TEST_F(DeviceCommandStreamTest, WhenCreatingWddmCsrWithAubDumpThenAubCsrIsCreated) {
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
ExecutionEnvironment *executionEnvironment = pDevice->getExecutionEnvironment();
|
||||
auto wddm = Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
|
@ -15,11 +15,11 @@
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_csr.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/registry_reader_tests.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/test/common/fixtures/mock_execution_environment_gmm_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/mock_execution_environment_gmm_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h"
|
||||
#include "opencl/test/unit_test/utilities/file_logger_tests.h"
|
||||
#include "test.h"
|
||||
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/os_interface/os_library.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/mock_gdi/mock_gdi.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSystemInfo, uint64_t gpuAddressSpace);
|
||||
|
||||
struct GdiDllFixture {
|
||||
virtual void SetUp() {
|
||||
const HardwareInfo *hwInfo = defaultHwInfo.get();
|
||||
mockGdiDll.reset(setAdapterInfo(&hwInfo->platform, &hwInfo->gtSystemInfo, hwInfo->capabilityTable.gpuAddressSpace));
|
||||
|
||||
setSizesFcn = reinterpret_cast<decltype(&MockSetSizes)>(mockGdiDll->getProcAddress("MockSetSizes"));
|
||||
getSizesFcn = reinterpret_cast<decltype(&GetMockSizes)>(mockGdiDll->getProcAddress("GetMockSizes"));
|
||||
getMockLastDestroyedResHandleFcn =
|
||||
reinterpret_cast<decltype(&GetMockLastDestroyedResHandle)>(mockGdiDll->getProcAddress("GetMockLastDestroyedResHandle"));
|
||||
setMockLastDestroyedResHandleFcn =
|
||||
reinterpret_cast<decltype(&SetMockLastDestroyedResHandle)>(mockGdiDll->getProcAddress("SetMockLastDestroyedResHandle"));
|
||||
getMockCreateDeviceParamsFcn =
|
||||
reinterpret_cast<decltype(&GetMockCreateDeviceParams)>(mockGdiDll->getProcAddress("GetMockCreateDeviceParams"));
|
||||
setMockCreateDeviceParamsFcn =
|
||||
reinterpret_cast<decltype(&SetMockCreateDeviceParams)>(mockGdiDll->getProcAddress("SetMockCreateDeviceParams"));
|
||||
getMockAllocationFcn = reinterpret_cast<decltype(&getMockAllocation)>(mockGdiDll->getProcAddress("getMockAllocation"));
|
||||
getAdapterInfoAddressFcn = reinterpret_cast<decltype(&getAdapterInfoAddress)>(mockGdiDll->getProcAddress("getAdapterInfoAddress"));
|
||||
getLastCallMapGpuVaArgFcn = reinterpret_cast<decltype(&getLastCallMapGpuVaArg)>(mockGdiDll->getProcAddress("getLastCallMapGpuVaArg"));
|
||||
getLastCallReserveGpuVaArgFcn = reinterpret_cast<decltype(&getLastCallReserveGpuVaArg)>(mockGdiDll->getProcAddress("getLastCallReserveGpuVaArg"));
|
||||
setMapGpuVaFailConfigFcn = reinterpret_cast<decltype(&setMapGpuVaFailConfig)>(mockGdiDll->getProcAddress("setMapGpuVaFailConfig"));
|
||||
setMapGpuVaFailConfigFcn(0, 0);
|
||||
getCreateContextDataFcn = reinterpret_cast<decltype(&getCreateContextData)>(mockGdiDll->getProcAddress("getCreateContextData"));
|
||||
getCreateHwQueueDataFcn = reinterpret_cast<decltype(&getCreateHwQueueData)>(mockGdiDll->getProcAddress("getCreateHwQueueData"));
|
||||
getDestroyHwQueueDataFcn = reinterpret_cast<decltype(&getDestroyHwQueueData)>(mockGdiDll->getProcAddress("getDestroyHwQueueData"));
|
||||
getSubmitCommandToHwQueueDataFcn =
|
||||
reinterpret_cast<decltype(&getSubmitCommandToHwQueueData)>(mockGdiDll->getProcAddress("getSubmitCommandToHwQueueData"));
|
||||
getDestroySynchronizationObjectDataFcn =
|
||||
reinterpret_cast<decltype(&getDestroySynchronizationObjectData)>(mockGdiDll->getProcAddress("getDestroySynchronizationObjectData"));
|
||||
getMonitorFenceCpuFenceAddressFcn =
|
||||
reinterpret_cast<decltype(&getMonitorFenceCpuFenceAddress)>(mockGdiDll->getProcAddress("getMonitorFenceCpuFenceAddress"));
|
||||
getCreateSynchronizationObject2FailCallFcn =
|
||||
reinterpret_cast<decltype(&getCreateSynchronizationObject2FailCall)>(mockGdiDll->getProcAddress("getCreateSynchronizationObject2FailCall"));
|
||||
getRegisterTrimNotificationFailCallFcn =
|
||||
reinterpret_cast<decltype(&getRegisterTrimNotificationFailCall)>(mockGdiDll->getProcAddress("getRegisterTrimNotificationFailCall"));
|
||||
getLastPriorityFcn =
|
||||
reinterpret_cast<decltype(&getLastPriority)>(mockGdiDll->getProcAddress("getLastPriority"));
|
||||
setAdapterBDFFcn =
|
||||
reinterpret_cast<decltype(&setAdapterBDF)>(mockGdiDll->getProcAddress("setAdapterBDF"));
|
||||
setMockLastDestroyedResHandleFcn((D3DKMT_HANDLE)0);
|
||||
*getDestroySynchronizationObjectDataFcn() = {};
|
||||
*getCreateSynchronizationObject2FailCallFcn() = false;
|
||||
*getRegisterTrimNotificationFailCallFcn() = false;
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
*getCreateHwQueueDataFcn() = {};
|
||||
*getDestroyHwQueueDataFcn() = {};
|
||||
*getSubmitCommandToHwQueueDataFcn() = {};
|
||||
*getDestroySynchronizationObjectDataFcn() = {};
|
||||
setMapGpuVaFailConfigFcn(0, 0);
|
||||
*getCreateSynchronizationObject2FailCallFcn() = false;
|
||||
*getRegisterTrimNotificationFailCallFcn() = false;
|
||||
}
|
||||
|
||||
std::unique_ptr<OsLibrary> mockGdiDll;
|
||||
|
||||
decltype(&MockSetSizes) setSizesFcn = nullptr;
|
||||
decltype(&GetMockSizes) getSizesFcn = nullptr;
|
||||
decltype(&GetMockLastDestroyedResHandle) getMockLastDestroyedResHandleFcn = nullptr;
|
||||
decltype(&SetMockLastDestroyedResHandle) setMockLastDestroyedResHandleFcn = nullptr;
|
||||
decltype(&GetMockCreateDeviceParams) getMockCreateDeviceParamsFcn = nullptr;
|
||||
decltype(&SetMockCreateDeviceParams) setMockCreateDeviceParamsFcn = nullptr;
|
||||
decltype(&getMockAllocation) getMockAllocationFcn = nullptr;
|
||||
decltype(&getAdapterInfoAddress) getAdapterInfoAddressFcn = nullptr;
|
||||
decltype(&getLastCallMapGpuVaArg) getLastCallMapGpuVaArgFcn = nullptr;
|
||||
decltype(&getLastCallReserveGpuVaArg) getLastCallReserveGpuVaArgFcn = nullptr;
|
||||
decltype(&setMapGpuVaFailConfig) setMapGpuVaFailConfigFcn = nullptr;
|
||||
decltype(&getCreateContextData) getCreateContextDataFcn = nullptr;
|
||||
decltype(&getCreateHwQueueData) getCreateHwQueueDataFcn = nullptr;
|
||||
decltype(&getDestroyHwQueueData) getDestroyHwQueueDataFcn = nullptr;
|
||||
decltype(&getSubmitCommandToHwQueueData) getSubmitCommandToHwQueueDataFcn = nullptr;
|
||||
decltype(&getDestroySynchronizationObjectData) getDestroySynchronizationObjectDataFcn = nullptr;
|
||||
decltype(&getMonitorFenceCpuFenceAddress) getMonitorFenceCpuFenceAddressFcn = nullptr;
|
||||
decltype(&getCreateSynchronizationObject2FailCall) getCreateSynchronizationObject2FailCallFcn = nullptr;
|
||||
decltype(&getRegisterTrimNotificationFailCall) getRegisterTrimNotificationFailCallFcn = nullptr;
|
||||
decltype(&getLastPriority) getLastPriorityFcn = nullptr;
|
||||
decltype(&setAdapterBDF) setAdapterBDFFcn = nullptr;
|
||||
};
|
@ -9,11 +9,11 @@
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/test/unit_test/api/cl_api_tests.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/sharings/gl/gl_dll_helper.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "test.h"
|
||||
|
||||
namespace NEO {
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/windows_wrapper.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_os_time_win.h"
|
||||
|
||||
namespace NEO {
|
||||
|
@ -6,9 +6,8 @@
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/wddm_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
|
@ -10,9 +10,8 @@
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/os_interface/windows/os_context_win.h"
|
||||
#include "shared/source/os_interface/windows/sys_calls.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/wddm_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
TEST_F(OsInterfaceTest, GivenWindowsWhenOsSupportFor64KBpagesIsBeingQueriedThenTrueIsReturned) {
|
||||
EXPECT_TRUE(OSInterface::are64kbPagesEnabled());
|
||||
|
@ -7,9 +7,8 @@
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/wddm_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "mock_os_time_win.h"
|
||||
|
@ -24,16 +24,16 @@
|
||||
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_gfx_partition.h"
|
||||
#include "shared/test/common/mocks/mock_io_functions.h"
|
||||
#include "shared/test/common/mocks/mock_wddm_residency_logger.h"
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm_resource_info.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_io_functions.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_memory_manager.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm_residency_logger.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/ult_dxcore_factory.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -14,12 +14,12 @@
|
||||
#include "shared/source/os_interface/windows/gdi_interface.h"
|
||||
#include "shared/source/os_interface/windows/os_context_win.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
#include "shared/test/common/os_interface/windows/gdi_dll_fixture.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm_interface23.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/gdi_dll_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -7,9 +7,9 @@
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/memory_manager/host_ptr_defines.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/ult_dxcore_factory.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/ult_dxgi_factory.h"
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
|
||||
namespace NEO {
|
||||
Wddm *Wddm::createWddm(std::unique_ptr<HwDeviceIdWddm> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
|
@ -1,125 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/gdi_interface.h"
|
||||
#include "shared/source/os_interface/windows/os_context_win.h"
|
||||
#include "shared/source/os_interface/windows/os_environment_win.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/mock_execution_environment_gmm_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm_interface20.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm_residency_allocations_container.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/gdi_dll_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "mock_gmm_memory.h"
|
||||
|
||||
namespace NEO {
|
||||
struct WddmFixture : public Test<MockExecutionEnvironmentGmmFixture> {
|
||||
void SetUp() override {
|
||||
MockExecutionEnvironmentGmmFixture::SetUp();
|
||||
rootDeviceEnvironemnt = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
auto osEnvironment = new OsEnvironmentWin();
|
||||
gdi = new MockGdi();
|
||||
osEnvironment->gdi.reset(gdi);
|
||||
executionEnvironment->osEnvironment.reset(osEnvironment);
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironemnt));
|
||||
rootDeviceEnvironemnt->osInterface = std::make_unique<OSInterface>();
|
||||
rootDeviceEnvironemnt->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
rootDeviceEnvironemnt->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = rootDeviceEnvironemnt->osInterface.get();
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo);
|
||||
wddm->init();
|
||||
auto hwInfo = rootDeviceEnvironemnt->getHardwareInfo();
|
||||
auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
|
||||
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0u, 1u, engine, preemptionMode,
|
||||
false);
|
||||
osContext->ensureContextInitialized();
|
||||
mockTemporaryResources = static_cast<MockWddmResidentAllocationsContainer *>(wddm->temporaryResources.get());
|
||||
}
|
||||
|
||||
WddmMock *wddm = nullptr;
|
||||
OSInterface *osInterface;
|
||||
RootDeviceEnvironment *rootDeviceEnvironemnt = nullptr;
|
||||
std::unique_ptr<OsContextWin> osContext;
|
||||
|
||||
MockGdi *gdi = nullptr;
|
||||
MockWddmResidentAllocationsContainer *mockTemporaryResources;
|
||||
};
|
||||
|
||||
struct WddmFixtureWithMockGdiDll : public GdiDllFixture, public MockExecutionEnvironmentGmmFixture {
|
||||
void SetUp() override {
|
||||
MockExecutionEnvironmentGmmFixture::SetUp();
|
||||
GdiDllFixture::SetUp();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment));
|
||||
wddmMockInterface = new WddmMockInterface20(*wddm);
|
||||
wddm->wddmInterface.reset(wddmMockInterface);
|
||||
rootDeviceEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
rootDeviceEnvironment->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
rootDeviceEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = rootDeviceEnvironment->osInterface.get();
|
||||
}
|
||||
|
||||
void init() {
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo);
|
||||
wddmMockInterface = static_cast<WddmMockInterface20 *>(wddm->wddmInterface.release());
|
||||
wddm->init();
|
||||
wddm->wddmInterface.reset(wddmMockInterface);
|
||||
|
||||
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
|
||||
auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
|
||||
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0u, 1, engine, preemptionMode,
|
||||
false);
|
||||
osContext->ensureContextInitialized();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
GdiDllFixture::TearDown();
|
||||
}
|
||||
|
||||
WddmMock *wddm = nullptr;
|
||||
OSInterface *osInterface;
|
||||
std::unique_ptr<OsContextWin> osContext;
|
||||
WddmMockInterface20 *wddmMockInterface = nullptr;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
};
|
||||
|
||||
struct WddmInstrumentationGmmFixture {
|
||||
void SetUp() {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment));
|
||||
gmmMem = new ::testing::NiceMock<GmockGmmMemory>(rootDeviceEnvironment->getGmmClientContext());
|
||||
wddm->gmmMemory.reset(gmmMem);
|
||||
rootDeviceEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
rootDeviceEnvironment->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
}
|
||||
void TearDown() {
|
||||
}
|
||||
|
||||
WddmMock *wddm;
|
||||
GmockGmmMemory *gmmMem = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
};
|
||||
|
||||
using WddmTest = WddmFixture;
|
||||
using WddmTestWithMockGdiDll = Test<WddmFixtureWithMockGdiDll>;
|
||||
using WddmInstrumentationTest = Test<WddmInstrumentationGmmFixture>;
|
||||
using WddmTestSingle = ::testing::Test;
|
||||
} // namespace NEO
|
@ -10,6 +10,8 @@
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/os_environment_win.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "shared/test/common/mocks/mock_wddm_residency_allocations_container.h"
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h"
|
||||
|
||||
#include "opencl/test/unit_test/helpers/execution_environment_helper.h"
|
||||
@ -17,9 +19,7 @@
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_gmm_page_table_mngr.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm_residency_allocations_container.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_memory_manager.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/wddm_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
|
@ -17,14 +17,14 @@
|
||||
#include "shared/source/os_interface/windows/wddm/wddm_interface.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_operations_handler.h"
|
||||
#include "shared/source/os_interface/windows/wddm_residency_controller.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
#include "shared/test/unit_test/os_interface/windows/mock_gdi_interface.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "opencl/test/unit_test/libult/create_command_stream.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_memory_manager.h"
|
||||
#include "test.h"
|
||||
|
@ -11,14 +11,14 @@
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_wddm.h"
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_allocation_properties.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/mock_wddm_allocation.h"
|
||||
#include "opencl/test/unit_test/os_interface/windows/wddm_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
Reference in New Issue
Block a user