diff --git a/core/helpers/CMakeLists.txt b/core/helpers/CMakeLists.txt index e044bb15ea..8307924b6f 100644 --- a/core/helpers/CMakeLists.txt +++ b/core/helpers/CMakeLists.txt @@ -30,6 +30,7 @@ set(NEO_CORE_HELPERS ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper.h ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_base.inl ${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_bdw_plus.inl + ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/hw_helper_extended.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_info.cpp ${CMAKE_CURRENT_SOURCE_DIR}/hw_info.h ${CMAKE_CURRENT_SOURCE_DIR}/interlocked_max.h diff --git a/core/helpers/hw_helper.h b/core/helpers/hw_helper.h index 91dfe81e15..074b689cd4 100644 --- a/core/helpers/hw_helper.h +++ b/core/helpers/hw_helper.h @@ -73,6 +73,9 @@ class HwHelper { virtual uint32_t alignSlmSize(uint32_t slmSize) = 0; virtual bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) = 0; + static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo); + static uint32_t getEnginesCount(const HardwareInfo &hwInfo); + static constexpr uint32_t lowPriorityGpgpuEngineIndex = 1; protected: diff --git a/core/helpers/hw_helper_extended.cpp b/core/helpers/hw_helper_extended.cpp new file mode 100644 index 0000000000..99d24791d3 --- /dev/null +++ b/core/helpers/hw_helper_extended.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "core/debug_settings/debug_settings_manager.h" +#include "core/helpers/hw_helper.h" + +namespace NEO { + +uint32_t HwHelper::getSubDevicesCount(const HardwareInfo *pHwInfo) { + return DebugManager.flags.CreateMultipleSubDevices.get() > 0 ? DebugManager.flags.CreateMultipleSubDevices.get() : 1u; +} + +uint32_t HwHelper::getEnginesCount(const HardwareInfo &hwInfo) { + return 1u; +} + +} // namespace NEO diff --git a/runtime/aub/aub_center.cpp b/runtime/aub/aub_center.cpp index c1e9c71c02..1eabedae81 100644 --- a/runtime/aub/aub_center.cpp +++ b/runtime/aub/aub_center.cpp @@ -8,10 +8,10 @@ #include "runtime/aub/aub_center.h" #include "core/debug_settings/debug_settings_manager.h" +#include "core/helpers/hw_helper.h" #include "core/helpers/hw_info.h" #include "core/helpers/options.h" #include "runtime/aub/aub_helper.h" -#include "runtime/helpers/device_helpers.h" #include "third_party/aub_stream/headers/aub_manager.h" #include "third_party/aub_stream/headers/aubstream.h" @@ -21,7 +21,7 @@ extern aub_stream::AubManager *createAubManager(uint32_t productFamily, uint32_t AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) { if (DebugManager.flags.UseAubStream.get()) { - auto devicesCount = DeviceHelper::getSubDevicesCount(pHwInfo); + auto devicesCount = HwHelper::getSubDevicesCount(pHwInfo); auto memoryBankSize = AubHelper::getMemBankSize(pHwInfo); CommandStreamReceiverType type = csrType; if (DebugManager.flags.SetCommandStreamReceiver.get() >= CommandStreamReceiverType::CSR_HW) { diff --git a/runtime/command_stream/aub_command_stream_receiver.cpp b/runtime/command_stream/aub_command_stream_receiver.cpp index 058392ee84..8865ea9aa8 100644 --- a/runtime/command_stream/aub_command_stream_receiver.cpp +++ b/runtime/command_stream/aub_command_stream_receiver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,10 +8,10 @@ #include "runtime/command_stream/aub_command_stream_receiver.h" #include "core/helpers/debug_helpers.h" +#include "core/helpers/hw_helper.h" #include "core/helpers/hw_info.h" #include "core/helpers/options.h" #include "runtime/execution_environment/execution_environment.h" -#include "runtime/helpers/device_helpers.h" #include "runtime/memory_manager/os_agnostic_memory_manager.h" #include "runtime/os_interface/os_inc_base.h" @@ -28,7 +28,7 @@ std::string AUBCommandStreamReceiver::createFullFilePath(const HardwareInfo &hwI // Generate the full filename const auto >SystemInfo = hwInfo.gtSystemInfo; std::stringstream strfilename; - auto subDevicesCount = DeviceHelper::getSubDevicesCount(&hwInfo); + auto subDevicesCount = HwHelper::getSubDevicesCount(&hwInfo); uint32_t subSlicesPerSlice = gtSystemInfo.SubSliceCount / gtSystemInfo.SliceCount; strfilename << hwPrefix << "_"; if (subDevicesCount > 1) { diff --git a/runtime/device/root_device.cpp b/runtime/device/root_device.cpp index a583e24a37..e731d62f4e 100644 --- a/runtime/device/root_device.cpp +++ b/runtime/device/root_device.cpp @@ -8,8 +8,8 @@ #include "runtime/device/root_device.h" #include "core/debug_settings/debug_settings_manager.h" +#include "core/helpers/hw_helper.h" #include "runtime/device/sub_device.h" -#include "runtime/helpers/device_helpers.h" namespace NEO { RootDevice::RootDevice(ExecutionEnvironment *executionEnvironment, uint32_t rootDeviceIndex) : Device(executionEnvironment), rootDeviceIndex(rootDeviceIndex) {} @@ -50,7 +50,7 @@ SubDevice *RootDevice::createSubDevice(uint32_t subDeviceIndex) { } bool RootDevice::createDeviceImpl() { - auto numSubDevices = DeviceHelper::getSubDevicesCount(&getHardwareInfo()); + auto numSubDevices = HwHelper::getSubDevicesCount(&getHardwareInfo()); if (numSubDevices == 1) { numSubDevices = 0; } diff --git a/runtime/execution_environment/execution_environment.cpp b/runtime/execution_environment/execution_environment.cpp index f239443ad5..48f547426d 100644 --- a/runtime/execution_environment/execution_environment.cpp +++ b/runtime/execution_environment/execution_environment.cpp @@ -80,7 +80,7 @@ void ExecutionEnvironment::initSourceLevelDebugger() { void ExecutionEnvironment::calculateMaxOsContextCount() { auto &hwHelper = HwHelper::get(this->hwInfo->platform.eRenderCoreFamily); auto osContextCount = hwHelper.getGpgpuEngineInstances().size(); - auto subDevicesCount = DeviceHelper::getSubDevicesCount(this->getHardwareInfo()); + auto subDevicesCount = HwHelper::getSubDevicesCount(this->getHardwareInfo()); bool hasRootCsr = subDevicesCount > 1; MemoryManager::maxOsContextCount = static_cast(osContextCount * subDevicesCount * this->rootDeviceEnvironments.size() + hasRootCsr); diff --git a/runtime/helpers/device_helpers.cpp b/runtime/helpers/device_helpers.cpp index dbd6edfaf3..63f5e56c51 100644 --- a/runtime/helpers/device_helpers.cpp +++ b/runtime/helpers/device_helpers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,17 +7,6 @@ #include "runtime/helpers/device_helpers.h" -#include "core/debug_settings/debug_settings_manager.h" -#include "core/helpers/hw_info.h" - namespace NEO { void DeviceHelper::getExtraDeviceInfo(const HardwareInfo &hwInfo, cl_device_info paramName, cl_uint ¶m, const void *&src, size_t &size, size_t &retSize) {} - -uint32_t DeviceHelper::getSubDevicesCount(const HardwareInfo *pHwInfo) { - return DebugManager.flags.CreateMultipleSubDevices.get() > 0 ? DebugManager.flags.CreateMultipleSubDevices.get() : 1u; -} - -uint32_t DeviceHelper::getEnginesCount(const HardwareInfo &hwInfo) { - return 1u; -} } // namespace NEO diff --git a/runtime/helpers/device_helpers.h b/runtime/helpers/device_helpers.h index fd6d0243c3..53bc2938c3 100644 --- a/runtime/helpers/device_helpers.h +++ b/runtime/helpers/device_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,7 +14,5 @@ struct HardwareInfo; namespace DeviceHelper { void getExtraDeviceInfo(const HardwareInfo &hwInfo, cl_device_info paramName, cl_uint ¶m, const void *&src, size_t &size, size_t &retSize); -uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo); -uint32_t getEnginesCount(const HardwareInfo &hwInfo); }; // namespace DeviceHelper } // namespace NEO diff --git a/unit_tests/aub/aub_helper_tests.inl b/unit_tests/aub/aub_helper_tests.inl index 69788d5b39..28dbe33094 100644 --- a/unit_tests/aub/aub_helper_tests.inl +++ b/unit_tests/aub/aub_helper_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 Intel Corporation + * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,7 +11,6 @@ #include "runtime/aub_mem_dump/aub_mem_dump.h" #include "runtime/aub_mem_dump/page_table_entry_bits.h" #include "runtime/command_stream/aub_command_stream_receiver_hw.h" -#include "runtime/helpers/device_helpers.h" #include "test.h" #include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/mocks/mock_lrca_helper.h" @@ -43,11 +42,11 @@ TEST(AubHelper, GivenMultipleSubDevicesWhenGettingDeviceCountThenCorrectValueIsR HardwareInfo hwInfo{&platform, &featureTable, &workaroundTable, &sysInfo, capTable}; DebugManager.flags.CreateMultipleSubDevices.set(2); - uint32_t devicesCount = DeviceHelper::getSubDevicesCount(&hwInfo); + uint32_t devicesCount = HwHelper::getSubDevicesCount(&hwInfo); EXPECT_EQ(devicesCount, 2u); DebugManager.flags.CreateMultipleSubDevices.set(0); - devicesCount = DeviceHelper::getSubDevicesCount(&hwInfo); + devicesCount = HwHelper::getSubDevicesCount(&hwInfo); EXPECT_EQ(devicesCount, 1u); } diff --git a/unit_tests/device/device_tests.cpp b/unit_tests/device/device_tests.cpp index 95ed912cfb..1e02d83903 100644 --- a/unit_tests/device/device_tests.cpp +++ b/unit_tests/device/device_tests.cpp @@ -11,7 +11,6 @@ #include "core/os_interface/os_context.h" #include "core/unit_tests/helpers/debug_manager_state_restore.h" #include "runtime/device/device.h" -#include "runtime/helpers/device_helpers.h" #include "runtime/platform/platform.h" #include "test.h" #include "unit_tests/fixtures/device_fixture.h" @@ -267,7 +266,7 @@ TEST(DeviceCreation, givenFtrSimulationModeFlagTrueWhenNoOtherSimulationFlagsAre TEST(DeviceCreation, givenDeviceWhenCheckingEnginesCountThenNumberGreaterThanZeroIsReturned) { auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); - EXPECT_GT(DeviceHelper::getEnginesCount(device->getHardwareInfo()), 0u); + EXPECT_GT(HwHelper::getEnginesCount(device->getHardwareInfo()), 0u); } using DeviceHwTest = ::testing::Test; diff --git a/unit_tests/execution_environment/execution_environment_tests.cpp b/unit_tests/execution_environment/execution_environment_tests.cpp index b69f1c655d..4455abe28e 100644 --- a/unit_tests/execution_environment/execution_environment_tests.cpp +++ b/unit_tests/execution_environment/execution_environment_tests.cpp @@ -16,7 +16,6 @@ #include "runtime/built_ins/built_ins.h" #include "runtime/device/device.h" #include "runtime/execution_environment/execution_environment.h" -#include "runtime/helpers/device_helpers.h" #include "runtime/memory_manager/os_agnostic_memory_manager.h" #include "runtime/os_interface/os_interface.h" #include "runtime/platform/platform.h" @@ -226,7 +225,7 @@ TEST(ExecutionEnvironment, whenCalculateMaxOsContexCountThenGlobalVariableHasPro uint32_t numRootDevices = 17u; auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->platform.eRenderCoreFamily); auto osContextCount = hwHelper.getGpgpuEngineInstances().size(); - auto subDevicesCount = DeviceHelper::getSubDevicesCount(executionEnvironment.getHardwareInfo()); + auto subDevicesCount = HwHelper::getSubDevicesCount(executionEnvironment.getHardwareInfo()); bool hasRootCsr = subDevicesCount > 1; executionEnvironment.prepareRootDeviceEnvironments(numRootDevices);