diff --git a/level_zero/core/test/unit_tests/sources/image/test_image.cpp b/level_zero/core/test/unit_tests/sources/image/test_image.cpp index 9abe0edb60..93fa0c370d 100644 --- a/level_zero/core/test/unit_tests/sources/image/test_image.cpp +++ b/level_zero/core/test/unit_tests/sources/image/test_image.cpp @@ -20,6 +20,8 @@ #include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" #include "level_zero/core/test/unit_tests/mocks/mock_device.h" +#include "third_party/opencl_headers/CL/cl_ext_intel.h" + namespace L0 { namespace ult { diff --git a/opencl/source/platform/platform.h b/opencl/source/platform/platform.h index 4e743b8fc0..da1e4672d0 100644 --- a/opencl/source/platform/platform.h +++ b/opencl/source/platform/platform.h @@ -6,6 +6,8 @@ */ #pragma once +#include "shared/source/helpers/common_types.h" + #include "opencl/source/api/cl_types.h" #include "opencl/source/cl_device/cl_device_vector.h" #include "opencl/source/helpers/base_object.h" @@ -30,7 +32,6 @@ struct OpenCLObjectMapper<_cl_platform_id> { typedef class Platform DerivedType; }; -using DeviceVector = std::vector>; class Platform : public BaseObject<_cl_platform_id> { public: static const cl_ulong objectMagic = 0x8873ACDEF2342133LL; diff --git a/opencl/test/unit_test/api/cl_create_context_from_type_tests.inl b/opencl/test/unit_test/api/cl_create_context_from_type_tests.inl index 91611c76bd..16aece191d 100644 --- a/opencl/test/unit_test/api/cl_create_context_from_type_tests.inl +++ b/opencl/test/unit_test/api/cl_create_context_from_type_tests.inl @@ -6,6 +6,7 @@ */ #include "opencl/test/unit_test/fixtures/platform_fixture.h" +#include "opencl/test/unit_test/mocks/mock_platform.h" #include "test.h" using namespace NEO; diff --git a/opencl/test/unit_test/execution_environment/execution_environment_tests.cpp b/opencl/test/unit_test/execution_environment/execution_environment_tests.cpp index e282e7296c..b3cc894dc4 100644 --- a/opencl/test/unit_test/execution_environment/execution_environment_tests.cpp +++ b/opencl/test/unit_test/execution_environment/execution_environment_tests.cpp @@ -27,6 +27,7 @@ #include "opencl/test/unit_test/mocks/mock_async_event_handler.h" #include "opencl/test/unit_test/mocks/mock_cl_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" using namespace NEO; diff --git a/opencl/test/unit_test/fixtures/memory_allocator_fixture.h b/opencl/test/unit_test/fixtures/memory_allocator_fixture.h index 29a190a95e..418b071f1c 100644 --- a/opencl/test/unit_test/fixtures/memory_allocator_fixture.h +++ b/opencl/test/unit_test/fixtures/memory_allocator_fixture.h @@ -15,6 +15,7 @@ #include "opencl/test/unit_test/fixtures/memory_management_fixture.h" #include "opencl/test/unit_test/mocks/mock_memory_manager.h" +#include "opencl/test/unit_test/mocks/mock_platform.h" using namespace NEO; diff --git a/opencl/test/unit_test/helpers/timestamp_packet_tests.h b/opencl/test/unit_test/helpers/timestamp_packet_tests.h index 8095cba948..83e674beb6 100644 --- a/opencl/test/unit_test/helpers/timestamp_packet_tests.h +++ b/opencl/test/unit_test/helpers/timestamp_packet_tests.h @@ -14,6 +14,7 @@ #include "opencl/test/unit_test/mocks/mock_command_queue.h" #include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_kernel.h" +#include "opencl/test/unit_test/mocks/mock_platform.h" #include "test.h" using namespace NEO; diff --git a/opencl/test/unit_test/mocks/mock_cl_device.cpp b/opencl/test/unit_test/mocks/mock_cl_device.cpp index 6794cc33d1..7b037c2491 100644 --- a/opencl/test/unit_test/mocks/mock_cl_device.cpp +++ b/opencl/test/unit_test/mocks/mock_cl_device.cpp @@ -9,6 +9,8 @@ #include "shared/test/common/mocks/mock_device.h" +#include "opencl/test/unit_test/mocks/mock_platform.h" + using namespace NEO; bool &MockClDevice::createSingleDevice = MockDevice::createSingleDevice; diff --git a/opencl/test/unit_test/os_interface/linux/device_os_tests.cpp b/opencl/test/unit_test/os_interface/linux/device_os_tests.cpp index 0ba41db035..e788b91e54 100644 --- a/opencl/test/unit_test/os_interface/linux/device_os_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/device_os_tests.cpp @@ -16,6 +16,7 @@ #include "opencl/test/unit_test/mocks/mock_cl_device.h" #include "opencl/test/unit_test/mocks/mock_command_queue.h" #include "opencl/test/unit_test/mocks/mock_context.h" +#include "opencl/test/unit_test/mocks/mock_platform.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/shared/source/helpers/common_types.h b/shared/source/helpers/common_types.h index eee4d5b664..cb8e941c04 100644 --- a/shared/source/helpers/common_types.h +++ b/shared/source/helpers/common_types.h @@ -13,6 +13,8 @@ namespace NEO { struct EngineControl; using EngineControlContainer = std::vector; using DeviceBitfield = std::bitset<32>; +class Device; +using DeviceVector = std::vector>; enum class DebugPauseState : uint32_t { disabled, diff --git a/shared/test/common/os_interface/windows/wddm_fixture.h b/shared/test/common/os_interface/windows/wddm_fixture.h index 5a56b7d0c5..e4743aee99 100644 --- a/shared/test/common/os_interface/windows/wddm_fixture.h +++ b/shared/test/common/os_interface/windows/wddm_fixture.h @@ -16,6 +16,7 @@ #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/fixtures/device_fixture.h" #include "shared/test/common/fixtures/mock_execution_environment_gmm_fixture.h" #include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/mocks/mock_execution_environment.h" @@ -100,9 +101,10 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture, public MockExecutionEnv RootDeviceEnvironment *rootDeviceEnvironment = nullptr; }; -struct WddmInstrumentationGmmFixture { +struct WddmInstrumentationGmmFixture : DeviceFixture { void SetUp() { - executionEnvironment = platform()->peekExecutionEnvironment(); + DeviceFixture::SetUp(); + executionEnvironment = pDevice->getExecutionEnvironment(); auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get(); wddm = static_cast(Wddm::createWddm(nullptr, *rootDeviceEnvironment)); gmmMem = new ::testing::NiceMock(rootDeviceEnvironment->getGmmClientContext()); @@ -111,6 +113,7 @@ struct WddmInstrumentationGmmFixture { rootDeviceEnvironment->osInterface->setDriverModel(std::unique_ptr(wddm)); } void TearDown() { + DeviceFixture::TearDown(); } WddmMock *wddm; diff --git a/shared/test/unit_test/fixtures/mock_aub_center_fixture.h b/shared/test/unit_test/fixtures/mock_aub_center_fixture.h index d56a4d3330..c852548d9c 100644 --- a/shared/test/unit_test/fixtures/mock_aub_center_fixture.h +++ b/shared/test/unit_test/fixtures/mock_aub_center_fixture.h @@ -13,9 +13,6 @@ #include "shared/test/common/mocks/mock_aub_manager.h" #include "shared/test/unit_test/tests_configuration.h" -#include "opencl/source/platform/platform.h" -#include "opencl/test/unit_test/mocks/mock_platform.h" - namespace NEO { struct MockAubCenterFixture { diff --git a/shared/test/unit_test/memory_manager/deferrable_allocation_deletion_tests.cpp b/shared/test/unit_test/memory_manager/deferrable_allocation_deletion_tests.cpp index c842afe54d..572d6eecd6 100644 --- a/shared/test/unit_test/memory_manager/deferrable_allocation_deletion_tests.cpp +++ b/shared/test/unit_test/memory_manager/deferrable_allocation_deletion_tests.cpp @@ -37,7 +37,8 @@ struct DeferredDeleterPublic : DeferredDeleter { struct DeferrableAllocationDeletionTest : ::testing::Test { void SetUp() override { - ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment(); + executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get(), false, 1u); + executionEnvironment->incRefInternal(); memoryManager = new MockMemoryManager(*executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); device.reset(Device::create(executionEnvironment, 0u)); @@ -49,7 +50,9 @@ struct DeferrableAllocationDeletionTest : ::testing::Test { void TearDown() override { asyncDeleter->allowExit = true; asyncDeleter->removeClient(); + executionEnvironment->decRefInternal(); } + ExecutionEnvironment *executionEnvironment; std::unique_ptr asyncDeleter; MockMemoryManager *memoryManager = nullptr; std::unique_ptr device; @@ -159,7 +162,6 @@ TEST_F(DeferrableAllocationDeletionTest, givenAllocationUsedByUnregisteredEngine DeferrableAllocationDeletion deletion{*memoryManager, *allocation}; device.reset(); - ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment(); executionEnvironment->rootDeviceEnvironments.clear(); EXPECT_EQ(0u, memoryManager->registeredEngines.size()); EXPECT_TRUE(allocation->isUsed());