diff --git a/runtime/aub/aub_center.cpp b/runtime/aub/aub_center.cpp index 667eb5a9f8..7ce9e8798a 100644 --- a/runtime/aub/aub_center.cpp +++ b/runtime/aub/aub_center.cpp @@ -8,6 +8,7 @@ #include "runtime/aub/aub_center.h" #include "runtime/aub/aub_helper.h" +#include "runtime/helpers/device_helpers.h" #include "runtime/helpers/hw_info.h" #include "runtime/helpers/options.h" #include "runtime/os_interface/debug_settings_manager.h" @@ -21,7 +22,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 = AubHelper::getDevicesCount(pHwInfo); + auto devicesCount = DeviceHelper::getDevicesCount(pHwInfo); auto memoryBankSize = AubHelper::getMemBankSize(pHwInfo); CommandStreamReceiverType type = csrType; if (DebugManager.flags.SetCommandStreamReceiver.get() >= CommandStreamReceiverType::CSR_HW) { diff --git a/runtime/aub/aub_helper.cpp b/runtime/aub/aub_helper.cpp index 08763eccbb..06c28caab5 100644 --- a/runtime/aub/aub_helper.cpp +++ b/runtime/aub/aub_helper.cpp @@ -33,8 +33,4 @@ uint64_t AubHelper::getMemBankSize(const HardwareInfo *pHwInfo) { return getTotalMemBankSize(); } -uint32_t AubHelper::getDevicesCount(const HardwareInfo *pHwInfo) { - return DebugManager.flags.CreateMultipleDevices.get() > 0 ? DebugManager.flags.CreateMultipleDevices.get() : 1u; -} - } // namespace OCLRT diff --git a/runtime/aub/aub_helper.h b/runtime/aub/aub_helper.h index 44af008e9d..d42f15cb23 100644 --- a/runtime/aub/aub_helper.h +++ b/runtime/aub/aub_helper.h @@ -33,7 +33,6 @@ class AubHelper : public NonCopyableOrMovableClass { static uint64_t getPTEntryBits(uint64_t pdEntryBits); static uint32_t getMemType(uint32_t addressSpace); static uint64_t getMemBankSize(const HardwareInfo *pHwInfo); - static uint32_t getDevicesCount(const HardwareInfo *pHwInfo); static MMIOList getAdditionalMmioList(); virtual int getDataHintForPml4Entry() const = 0; diff --git a/runtime/device/device_info.cpp b/runtime/device/device_info.cpp index 238dc2e310..2a07a7ccb5 100644 --- a/runtime/device/device_info.cpp +++ b/runtime/device/device_info.cpp @@ -206,7 +206,7 @@ cl_int Device::getDeviceInfo(cl_device_info paramName, getCap(src, srcSize, retSize); break; default: - getExtraDeviceInfo(paramName, param, src, srcSize, retSize); + DeviceHelper::getExtraDeviceInfo(paramName, param, src, srcSize, retSize); } retVal = ::getInfo(paramValue, paramValueSize, src, srcSize); diff --git a/runtime/helpers/device_helpers.cpp b/runtime/helpers/device_helpers.cpp index 94eb7cc2a2..aee6b9644f 100644 --- a/runtime/helpers/device_helpers.cpp +++ b/runtime/helpers/device_helpers.cpp @@ -1,11 +1,19 @@ /* - * Copyright (C) 2018 Intel Corporation + * Copyright (C) 2018-2019 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "runtime/helpers/device_helpers.h" + +#include "runtime/helpers/hw_info.h" +#include "runtime/os_interface/debug_settings_manager.h" + namespace OCLRT { -void getExtraDeviceInfo(cl_device_info paramName, cl_uint ¶m, const void *&src, size_t &size, size_t &retSize) {} +void DeviceHelper::getExtraDeviceInfo(cl_device_info paramName, cl_uint ¶m, const void *&src, size_t &size, size_t &retSize) {} + +uint32_t DeviceHelper::getDevicesCount(const HardwareInfo *pHwInfo) { + return DebugManager.flags.CreateMultipleDevices.get() > 0 ? DebugManager.flags.CreateMultipleDevices.get() : 1u; +} } // namespace OCLRT diff --git a/runtime/helpers/device_helpers.h b/runtime/helpers/device_helpers.h index bfa8ebe6e7..52cd46dd71 100644 --- a/runtime/helpers/device_helpers.h +++ b/runtime/helpers/device_helpers.h @@ -10,5 +10,10 @@ #include namespace OCLRT { +struct HardwareInfo; + +namespace DeviceHelper { void getExtraDeviceInfo(cl_device_info paramName, cl_uint ¶m, const void *&src, size_t &size, size_t &retSize); -} +uint32_t getDevicesCount(const HardwareInfo *pHwInfo); +}; // namespace DeviceHelper +} // namespace OCLRT diff --git a/unit_tests/aub/aub_helper_tests.inl b/unit_tests/aub/aub_helper_tests.inl index 77fe39c176..96814077a8 100644 --- a/unit_tests/aub/aub_helper_tests.inl +++ b/unit_tests/aub/aub_helper_tests.inl @@ -10,6 +10,7 @@ #include "runtime/aub_mem_dump/page_table_entry_bits.h" #include "runtime/command_stream/aub_command_stream_receiver_hw.h" #include "runtime/helpers/basic_math.h" +#include "runtime/helpers/device_helpers.h" #include "test.h" #include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/helpers/debug_manager_state_restore.h" @@ -42,11 +43,11 @@ TEST(AubHelper, WhenCreateMultipleDevicesIsSetThenGetDevicesCountReturnedCorrect HardwareInfo hwInfo{&platform, &skuTable, &waTable, &sysInfo, capTable}; DebugManager.flags.CreateMultipleDevices.set(2); - uint32_t devicesCount = AubHelper::getDevicesCount(&hwInfo); + uint32_t devicesCount = DeviceHelper::getDevicesCount(&hwInfo); EXPECT_EQ(devicesCount, 2u); DebugManager.flags.CreateMultipleDevices.set(0); - devicesCount = AubHelper::getDevicesCount(&hwInfo); + devicesCount = DeviceHelper::getDevicesCount(&hwInfo); EXPECT_EQ(devicesCount, 1u); }