diff --git a/opencl/source/cl_device/cl_device.h b/opencl/source/cl_device/cl_device.h index 0a5c60ead0..66218d7098 100644 --- a/opencl/source/cl_device/cl_device.h +++ b/opencl/source/cl_device/cl_device.h @@ -69,7 +69,6 @@ class ClDevice : public BaseObject<_cl_device_id> { EngineControl &getEngine(aub_stream::EngineType engineType, EngineUsage engineUsage); EngineControl &getDefaultEngine(); EngineControl &getInternalEngine(); - EngineControl *getInternalCopyEngine(); SelectorCopyEngine &getSelectorCopyEngine(); MemoryManager *getMemoryManager() const; GmmHelper *getGmmHelper() const; diff --git a/opencl/test/unit_test/device/CMakeLists.txt b/opencl/test/unit_test/device/CMakeLists.txt index fd3ec550f8..f1ea37fed2 100644 --- a/opencl/test/unit_test/device/CMakeLists.txt +++ b/opencl/test/unit_test/device/CMakeLists.txt @@ -7,7 +7,6 @@ set(IGDRCL_SRCS_tests_device ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/device_caps_tests.cpp - ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/device_get_engine_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/device_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/device_timers_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/get_device_info_size_tests.cpp diff --git a/opencl/test/unit_test/device/device_get_engine_tests.cpp b/opencl/test/unit_test/device/device_get_engine_tests.cpp deleted file mode 100644 index e5390bd825..0000000000 --- a/opencl/test/unit_test/device/device_get_engine_tests.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2020-2021 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/helpers/options.h" -#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_device.h" - -#include "gtest/gtest.h" - -using namespace NEO; - -TEST(DeviceGenEngineTest, givenNonHwCsrModeWhenGetEngineThenDefaultEngineIsReturned) { - DebugManagerStateRestore dbgRestorer; - DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_AUB); - - VariableBackup backup(&ultHwConfig); - ultHwConfig.useHwCsr = true; - - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); - - auto &internalEngine = device->getInternalEngine(); - auto &defaultEngine = device->getDefaultEngine(); - EXPECT_EQ(defaultEngine.commandStreamReceiver, internalEngine.commandStreamReceiver); -} diff --git a/opencl/test/unit_test/device/device_tests.cpp b/opencl/test/unit_test/device/device_tests.cpp index 09d721b229..7760d1d8e9 100644 --- a/opencl/test/unit_test/device/device_tests.cpp +++ b/opencl/test/unit_test/device/device_tests.cpp @@ -17,6 +17,7 @@ #include "shared/test/common/mocks/mock_driver_info.h" #include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/mocks/ult_device_factory.h" +#include "shared/test/common/test_macros/test_checks_shared.h" #include "opencl/source/platform/platform.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" @@ -552,7 +553,7 @@ HWTEST_F(DeviceHwTest, givenDeviceCreationWhenCsrFailsToCreateGlobalSyncAllocati EXPECT_EQ(nullptr, mockDevice); } -TEST(DeviceGenEngineTest, givenHwCsrModeWhenGetEngineThenDedicatedForInternalUsageEngineIsReturned) { +TEST(DeviceGetEngineTest, givenHwCsrModeWhenGetEngineThenDedicatedForInternalUsageEngineIsReturned) { auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto &internalEngine = device->getInternalEngine(); @@ -560,7 +561,7 @@ TEST(DeviceGenEngineTest, givenHwCsrModeWhenGetEngineThenDedicatedForInternalUsa EXPECT_NE(defaultEngine.commandStreamReceiver, internalEngine.commandStreamReceiver); } -TEST(DeviceGenEngineTest, whenCreateDeviceThenInternalEngineHasDefaultType) { +TEST(DeviceGetEngineTest, whenCreateDeviceThenInternalEngineHasDefaultType) { auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto internalEngineType = device->getInternalEngine().osContext->getEngineType(); @@ -568,14 +569,14 @@ TEST(DeviceGenEngineTest, whenCreateDeviceThenInternalEngineHasDefaultType) { EXPECT_EQ(defaultEngineType, internalEngineType); } -TEST(DeviceGenEngineTest, givenCreatedDeviceWhenRetrievingDefaultEngineThenOsContextHasDefaultFieldSet) { +TEST(DeviceGetEngineTest, givenCreatedDeviceWhenRetrievingDefaultEngineThenOsContextHasDefaultFieldSet) { auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); auto &defaultEngine = device->getDefaultEngine(); EXPECT_TRUE(defaultEngine.osContext->isDefaultContext()); } -TEST(DeviceGenEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCorrectResults) { +TEST(DeviceGetEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCorrectResults) { const auto nonEmptyEngineGroup = std::vector{EngineControl{nullptr, nullptr}}; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); @@ -593,7 +594,7 @@ TEST(DeviceGenEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupsThenReturnC EXPECT_EQ(nullptr, device->getNonEmptyEngineGroup(4)); } -TEST(DeviceGenEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCorrectResults) { +TEST(DeviceGetEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCorrectResults) { const auto emptyEngineGroup = std::vector{}; const auto nonEmptyEngineGroup = std::vector{EngineControl{nullptr, nullptr}}; @@ -610,7 +611,7 @@ TEST(DeviceGenEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupsThenReturnCor EXPECT_EQ(nullptr, device->getNonEmptyEngineGroup(2)); } -TEST(DeviceGenEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupIndexThenReturnCorrectResults) { +TEST(DeviceGetEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupIndexThenReturnCorrectResults) { const auto nonEmptyEngineGroup = std::vector{EngineControl{nullptr, nullptr}}; auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); @@ -629,7 +630,7 @@ TEST(DeviceGenEngineTest, givenNoEmptyGroupsWhenGettingNonEmptyGroupIndexThenRet EXPECT_ANY_THROW(device->getIndexOfNonEmptyEngineGroup(static_cast(5u))); } -TEST(DeviceGenEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupIndexThenReturnCorrectResults) { +TEST(DeviceGetEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupIndexThenReturnCorrectResults) { const auto emptyEngineGroup = std::vector{}; const auto nonEmptyEngineGroup = std::vector{EngineControl{nullptr, nullptr}}; @@ -649,7 +650,7 @@ TEST(DeviceGenEngineTest, givenEmptyGroupsWhenGettingNonEmptyGroupIndexThenRetur EXPECT_ANY_THROW(device->getIndexOfNonEmptyEngineGroup(static_cast(5u))); } -TEST(DeviceGenEngineTest, givenDeferredContextInitializationEnabledWhenCreatingEnginesThenInitializeOnlyOsContextsWhichRequireIt) { +TEST(DeviceGetEngineTest, givenDeferredContextInitializationEnabledWhenCreatingEnginesThenInitializeOnlyOsContextsWhichRequireIt) { DebugManagerStateRestore restore{}; DebugManager.flags.DeferOsContextInitialization.set(1); @@ -664,7 +665,7 @@ TEST(DeviceGenEngineTest, givenDeferredContextInitializationEnabledWhenCreatingE } } -TEST(DeviceGenEngineTest, givenDeferredContextInitializationDisabledWhenCreatingEnginesThenInitializeAllOsContexts) { +TEST(DeviceGetEngineTest, givenDeferredContextInitializationDisabledWhenCreatingEnginesThenInitializeAllOsContexts) { DebugManagerStateRestore restore{}; DebugManager.flags.DeferOsContextInitialization.set(0); @@ -675,6 +676,20 @@ TEST(DeviceGenEngineTest, givenDeferredContextInitializationDisabledWhenCreating } } +TEST(DeviceGetEngineTest, givenNonHwCsrModeWhenGetEngineThenDefaultEngineIsReturned) { + DebugManagerStateRestore dbgRestorer; + DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_AUB); + + VariableBackup backup(&ultHwConfig); + ultHwConfig.useHwCsr = true; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); + + auto &internalEngine = device->getInternalEngine(); + auto &defaultEngine = device->getDefaultEngine(); + EXPECT_EQ(defaultEngine.commandStreamReceiver, internalEngine.commandStreamReceiver); +} + using DeviceQueueFamiliesTests = ::testing::Test; HWTEST_F(DeviceQueueFamiliesTests, whenGettingQueueFamilyCapabilitiesAllThenReturnCorrectValue) { diff --git a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl index 7b4da702f2..14663298db 100644 --- a/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl +++ b/opencl/test/unit_test/gen12lp/hw_helper_tests_gen12lp.inl @@ -167,16 +167,6 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, givenFtrCcsNodeNotSetWhenGetGpgpuEnginesThenR EXPECT_EQ(aub_stream::ENGINE_RCS, engines[2].first); } -GEN12LPTEST_F(HwHelperTestGen12Lp, - whenCallingGetInternalCopyEngineThenNullptrIsReturned) { - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.featureTable.ftrBcsInfo = 1; - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); - - auto internalCopyEngine = device->getInternalCopyEngine(); - EXPECT_EQ(internalCopyEngine, nullptr); -} - GEN12LPTEST_F(HwHelperTestGen12Lp, givenFtrCcsNodeSetWhenGetGpgpuEnginesThenReturnTwoRcsAndCcsEngines) { HardwareInfo hwInfo = *defaultHwInfo; hwInfo.featureTable.ftrCCSNode = true; diff --git a/shared/source/device/CMakeLists.txt b/shared/source/device/CMakeLists.txt index 74b387e1bd..c31f591d72 100644 --- a/shared/source/device/CMakeLists.txt +++ b/shared/source/device/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2020 Intel Corporation +# Copyright (C) 2020-2021 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -9,7 +9,6 @@ set(NEO_CORE_DEVICE ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp ${CMAKE_CURRENT_SOURCE_DIR}/device.h ${CMAKE_CURRENT_SOURCE_DIR}/device_caps.cpp - ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/device_get_engine.cpp ${CMAKE_CURRENT_SOURCE_DIR}/device_info.h ${CMAKE_CURRENT_SOURCE_DIR}/root_device.cpp ${CMAKE_CURRENT_SOURCE_DIR}/root_device.h diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 8bc263f0d3..29015d04d7 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -543,6 +543,16 @@ const std::vector &Device::getEngines() const { return this->engines; } +EngineControl &Device::getInternalEngine() { + if (this->engines[0].commandStreamReceiver->getType() != CommandStreamReceiverType::CSR_HW) { + return this->getDefaultEngine(); + } + + auto engineType = getChosenEngineType(getHardwareInfo()); + + return this->getDeviceById(0)->getEngine(engineType, EngineUsage::Internal); +} + void Device::initializeRayTracing() { if (rtMemoryBackedBuffer == nullptr) { auto size = RayTracingHelper::getTotalMemoryBackedFifoSize(*this); diff --git a/shared/source/device/device.h b/shared/source/device/device.h index 2edeef0e82..657b60b4f4 100644 --- a/shared/source/device/device.h +++ b/shared/source/device/device.h @@ -64,7 +64,6 @@ class Device : public ReferenceTrackedObject { EngineControl &getEngine(uint32_t index); EngineControl &getDefaultEngine(); EngineControl &getInternalEngine(); - EngineControl *getInternalCopyEngine(); SelectorCopyEngine &getSelectorCopyEngine(); MemoryManager *getMemoryManager() const; GmmHelper *getGmmHelper() const; diff --git a/shared/source/device/device_get_engine.cpp b/shared/source/device/device_get_engine.cpp deleted file mode 100644 index 8ea345a461..0000000000 --- a/shared/source/device/device_get_engine.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2020-2021 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/command_stream/command_stream_receiver.h" -#include "shared/source/device/device.h" -#include "shared/source/helpers/hw_helper.h" - -namespace NEO { - -EngineControl &Device::getInternalEngine() { - if (this->engines[0].commandStreamReceiver->getType() != CommandStreamReceiverType::CSR_HW) { - return this->getDefaultEngine(); - } - - auto engineType = getChosenEngineType(getHardwareInfo()); - - return this->getDeviceById(0)->getEngine(engineType, EngineUsage::Internal); -} - -EngineControl *Device::getInternalCopyEngine() { - return nullptr; -} - -} // namespace NEO