Move methods from DeviceHelper to HwHelper

- getSubDevicesCount()
- getEnginesCount()

Change-Id: I59e2d5e8552db5d30767edf8382b846b5ca683d8
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-01-20 15:46:03 +01:00
committed by sys_ocldev
parent 142a38ea9d
commit 42858acb32
12 changed files with 40 additions and 31 deletions

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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) {

View File

@ -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 &gtSystemInfo = 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) {

View File

@ -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;
}

View File

@ -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<uint32_t>(osContextCount * subDevicesCount * this->rootDeviceEnvironments.size() + hasRootCsr);

View File

@ -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 &param, 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

View File

@ -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 &param, 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

View File

@ -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);
}

View File

@ -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<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
EXPECT_GT(DeviceHelper::getEnginesCount(device->getHardwareInfo()), 0u);
EXPECT_GT(HwHelper::getEnginesCount(device->getHardwareInfo()), 0u);
}
using DeviceHwTest = ::testing::Test;

View File

@ -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);