Skip to content

Commit 42858ac

Browse files
Move methods from DeviceHelper to HwHelper
- getSubDevicesCount() - getEnginesCount() Change-Id: I59e2d5e8552db5d30767edf8382b846b5ca683d8 Signed-off-by: Mateusz Hoppe <[email protected]>
1 parent 142a38e commit 42858ac

File tree

12 files changed

+40
-31
lines changed

12 files changed

+40
-31
lines changed

core/helpers/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ set(NEO_CORE_HELPERS
3030
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper.h
3131
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_base.inl
3232
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_bdw_plus.inl
33+
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/hw_helper_extended.cpp
3334
${CMAKE_CURRENT_SOURCE_DIR}/hw_info.cpp
3435
${CMAKE_CURRENT_SOURCE_DIR}/hw_info.h
3536
${CMAKE_CURRENT_SOURCE_DIR}/interlocked_max.h

core/helpers/hw_helper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ class HwHelper {
7373
virtual uint32_t alignSlmSize(uint32_t slmSize) = 0;
7474
virtual bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) = 0;
7575

76+
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
77+
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
78+
7679
static constexpr uint32_t lowPriorityGpgpuEngineIndex = 1;
7780

7881
protected:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (C) 2020 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "core/debug_settings/debug_settings_manager.h"
9+
#include "core/helpers/hw_helper.h"
10+
11+
namespace NEO {
12+
13+
uint32_t HwHelper::getSubDevicesCount(const HardwareInfo *pHwInfo) {
14+
return DebugManager.flags.CreateMultipleSubDevices.get() > 0 ? DebugManager.flags.CreateMultipleSubDevices.get() : 1u;
15+
}
16+
17+
uint32_t HwHelper::getEnginesCount(const HardwareInfo &hwInfo) {
18+
return 1u;
19+
}
20+
21+
} // namespace NEO

runtime/aub/aub_center.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
#include "runtime/aub/aub_center.h"
99

1010
#include "core/debug_settings/debug_settings_manager.h"
11+
#include "core/helpers/hw_helper.h"
1112
#include "core/helpers/hw_info.h"
1213
#include "core/helpers/options.h"
1314
#include "runtime/aub/aub_helper.h"
14-
#include "runtime/helpers/device_helpers.h"
1515

1616
#include "third_party/aub_stream/headers/aub_manager.h"
1717
#include "third_party/aub_stream/headers/aubstream.h"
@@ -21,7 +21,7 @@ extern aub_stream::AubManager *createAubManager(uint32_t productFamily, uint32_t
2121

2222
AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
2323
if (DebugManager.flags.UseAubStream.get()) {
24-
auto devicesCount = DeviceHelper::getSubDevicesCount(pHwInfo);
24+
auto devicesCount = HwHelper::getSubDevicesCount(pHwInfo);
2525
auto memoryBankSize = AubHelper::getMemBankSize(pHwInfo);
2626
CommandStreamReceiverType type = csrType;
2727
if (DebugManager.flags.SetCommandStreamReceiver.get() >= CommandStreamReceiverType::CSR_HW) {

runtime/command_stream/aub_command_stream_receiver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2019 Intel Corporation
2+
* Copyright (C) 2017-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -8,10 +8,10 @@
88
#include "runtime/command_stream/aub_command_stream_receiver.h"
99

1010
#include "core/helpers/debug_helpers.h"
11+
#include "core/helpers/hw_helper.h"
1112
#include "core/helpers/hw_info.h"
1213
#include "core/helpers/options.h"
1314
#include "runtime/execution_environment/execution_environment.h"
14-
#include "runtime/helpers/device_helpers.h"
1515
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
1616
#include "runtime/os_interface/os_inc_base.h"
1717

@@ -28,7 +28,7 @@ std::string AUBCommandStreamReceiver::createFullFilePath(const HardwareInfo &hwI
2828
// Generate the full filename
2929
const auto &gtSystemInfo = hwInfo.gtSystemInfo;
3030
std::stringstream strfilename;
31-
auto subDevicesCount = DeviceHelper::getSubDevicesCount(&hwInfo);
31+
auto subDevicesCount = HwHelper::getSubDevicesCount(&hwInfo);
3232
uint32_t subSlicesPerSlice = gtSystemInfo.SubSliceCount / gtSystemInfo.SliceCount;
3333
strfilename << hwPrefix << "_";
3434
if (subDevicesCount > 1) {

runtime/device/root_device.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
#include "runtime/device/root_device.h"
99

1010
#include "core/debug_settings/debug_settings_manager.h"
11+
#include "core/helpers/hw_helper.h"
1112
#include "runtime/device/sub_device.h"
12-
#include "runtime/helpers/device_helpers.h"
1313

1414
namespace NEO {
1515
RootDevice::RootDevice(ExecutionEnvironment *executionEnvironment, uint32_t rootDeviceIndex) : Device(executionEnvironment), rootDeviceIndex(rootDeviceIndex) {}
@@ -50,7 +50,7 @@ SubDevice *RootDevice::createSubDevice(uint32_t subDeviceIndex) {
5050
}
5151

5252
bool RootDevice::createDeviceImpl() {
53-
auto numSubDevices = DeviceHelper::getSubDevicesCount(&getHardwareInfo());
53+
auto numSubDevices = HwHelper::getSubDevicesCount(&getHardwareInfo());
5454
if (numSubDevices == 1) {
5555
numSubDevices = 0;
5656
}

runtime/execution_environment/execution_environment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void ExecutionEnvironment::initSourceLevelDebugger() {
8080
void ExecutionEnvironment::calculateMaxOsContextCount() {
8181
auto &hwHelper = HwHelper::get(this->hwInfo->platform.eRenderCoreFamily);
8282
auto osContextCount = hwHelper.getGpgpuEngineInstances().size();
83-
auto subDevicesCount = DeviceHelper::getSubDevicesCount(this->getHardwareInfo());
83+
auto subDevicesCount = HwHelper::getSubDevicesCount(this->getHardwareInfo());
8484
bool hasRootCsr = subDevicesCount > 1;
8585

8686
MemoryManager::maxOsContextCount = static_cast<uint32_t>(osContextCount * subDevicesCount * this->rootDeviceEnvironments.size() + hasRootCsr);

runtime/helpers/device_helpers.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
/*
2-
* Copyright (C) 2018-2019 Intel Corporation
2+
* Copyright (C) 2018-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#include "runtime/helpers/device_helpers.h"
99

10-
#include "core/debug_settings/debug_settings_manager.h"
11-
#include "core/helpers/hw_info.h"
12-
1310
namespace NEO {
1411
void DeviceHelper::getExtraDeviceInfo(const HardwareInfo &hwInfo, cl_device_info paramName, cl_uint &param, const void *&src, size_t &size, size_t &retSize) {}
15-
16-
uint32_t DeviceHelper::getSubDevicesCount(const HardwareInfo *pHwInfo) {
17-
return DebugManager.flags.CreateMultipleSubDevices.get() > 0 ? DebugManager.flags.CreateMultipleSubDevices.get() : 1u;
18-
}
19-
20-
uint32_t DeviceHelper::getEnginesCount(const HardwareInfo &hwInfo) {
21-
return 1u;
22-
}
2312
} // namespace NEO

runtime/helpers/device_helpers.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2019 Intel Corporation
2+
* Copyright (C) 2018-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -14,7 +14,5 @@ struct HardwareInfo;
1414

1515
namespace DeviceHelper {
1616
void getExtraDeviceInfo(const HardwareInfo &hwInfo, cl_device_info paramName, cl_uint &param, const void *&src, size_t &size, size_t &retSize);
17-
uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
18-
uint32_t getEnginesCount(const HardwareInfo &hwInfo);
1917
}; // namespace DeviceHelper
2018
} // namespace NEO

unit_tests/aub/aub_helper_tests.inl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2019 Intel Corporation
2+
* Copyright (C) 2018-2020 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -11,7 +11,6 @@
1111
#include "runtime/aub_mem_dump/aub_mem_dump.h"
1212
#include "runtime/aub_mem_dump/page_table_entry_bits.h"
1313
#include "runtime/command_stream/aub_command_stream_receiver_hw.h"
14-
#include "runtime/helpers/device_helpers.h"
1514
#include "test.h"
1615
#include "unit_tests/fixtures/device_fixture.h"
1716
#include "unit_tests/mocks/mock_lrca_helper.h"
@@ -43,11 +42,11 @@ TEST(AubHelper, GivenMultipleSubDevicesWhenGettingDeviceCountThenCorrectValueIsR
4342
HardwareInfo hwInfo{&platform, &featureTable, &workaroundTable, &sysInfo, capTable};
4443
DebugManager.flags.CreateMultipleSubDevices.set(2);
4544

46-
uint32_t devicesCount = DeviceHelper::getSubDevicesCount(&hwInfo);
45+
uint32_t devicesCount = HwHelper::getSubDevicesCount(&hwInfo);
4746
EXPECT_EQ(devicesCount, 2u);
4847

4948
DebugManager.flags.CreateMultipleSubDevices.set(0);
50-
devicesCount = DeviceHelper::getSubDevicesCount(&hwInfo);
49+
devicesCount = HwHelper::getSubDevicesCount(&hwInfo);
5150
EXPECT_EQ(devicesCount, 1u);
5251
}
5352

0 commit comments

Comments
 (0)