Skip to content

Commit 2d02435

Browse files
Add DeviceHelper::getEnginesCount() function
Related-To: NEO-2535 Change-Id: Ie82f5b573d934e038dc44853d0bba5bbd5db3551 Signed-off-by: Filip Hazubski <[email protected]>
1 parent 77ce18a commit 2d02435

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

runtime/helpers/device_helpers.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ void DeviceHelper::getExtraDeviceInfo(const HardwareInfo &hwInfo, cl_device_info
1616
uint32_t DeviceHelper::getDevicesCount(const HardwareInfo *pHwInfo) {
1717
return DebugManager.flags.CreateMultipleDevices.get() > 0 ? DebugManager.flags.CreateMultipleDevices.get() : 1u;
1818
}
19+
20+
uint32_t DeviceHelper::getEnginesCount(const HardwareInfo &hwInfo) {
21+
return 1u;
22+
}
1923
} // namespace NEO

runtime/helpers/device_helpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ struct HardwareInfo;
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);
1717
uint32_t getDevicesCount(const HardwareInfo *pHwInfo);
18+
uint32_t getEnginesCount(const HardwareInfo &hwInfo);
1819
}; // namespace DeviceHelper
1920
} // namespace NEO

unit_tests/device/device_tests.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include "runtime/device/device.h"
9+
#include "runtime/helpers/device_helpers.h"
910
#include "runtime/helpers/hw_helper.h"
1011
#include "runtime/helpers/options.h"
1112
#include "runtime/indirect_heap/indirect_heap.h"
@@ -247,3 +248,8 @@ TEST(DeviceCreation, givenFtrSimulationModeFlagTrueWhenNoOtherSimulationFlagsAre
247248
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(&hwInfo));
248249
EXPECT_TRUE(device->isSimulation());
249250
}
251+
252+
TEST(DeviceCreation, givenDeviceWhenCheckingEnginesCountThenNumberGreaterThanZeroIsReturned) {
253+
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));
254+
EXPECT_GT(DeviceHelper::getEnginesCount(device->getHardwareInfo()), 0u);
255+
}

0 commit comments

Comments
 (0)