Skip to content

Commit d17879d

Browse files
committed
Pass ExecutionEnvironment to get devices.
- this would allow for further re-use of objects allocated here. Change-Id: I73b62ae3991ebd786dea3c085e1391194b8de6ba
1 parent 4eb2e64 commit d17879d

18 files changed

+51
-37
lines changed

runtime/command_stream/create_command_stream_impl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo) {
6161
return commandStreamReceiver;
6262
}
6363

64-
bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned) {
64+
bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) {
6565
bool result;
6666
int32_t csr = DebugManager.flags.SetCommandStreamReceiver.get();
6767
if (csr) {
@@ -78,12 +78,12 @@ bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned) {
7878
return true;
7979
}
8080
case CSR_HW_WITH_AUB:
81-
return DeviceFactory::getDevices(hwInfo, numDevicesReturned);
81+
return DeviceFactory::getDevices(hwInfo, numDevicesReturned, executionEnvironment);
8282
default:
8383
return false;
8484
}
8585
}
86-
result = DeviceFactory::getDevices(hwInfo, numDevicesReturned);
86+
result = DeviceFactory::getDevices(hwInfo, numDevicesReturned, executionEnvironment);
8787
DEBUG_BREAK_IF(result && (hwInfo == nullptr));
8888
return result;
8989
}

runtime/command_stream/create_command_stream_impl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "runtime/helpers/hw_info.h"
2626

2727
namespace OCLRT {
28+
class ExecutionEnvironment;
2829
extern CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo);
29-
extern bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned);
30+
extern bool getDevicesImpl(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment);
3031
} // namespace OCLRT

runtime/dll/create_command_stream.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ CommandStreamReceiver *createCommandStream(const HardwareInfo *pHwInfo) {
3636
return createCommandStreamImpl(pHwInfo);
3737
}
3838

39-
bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned) {
40-
return getDevicesImpl(hwInfo, numDevicesReturned);
39+
bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnviornment) {
40+
return getDevicesImpl(hwInfo, numDevicesReturned, executionEnviornment);
4141
}
4242

4343
} // namespace OCLRT

runtime/os_interface/device_factory.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
namespace OCLRT {
2727

2828
struct HardwareInfo;
29+
class ExecutionEnvironment;
2930

3031
class DeviceFactory {
3132
public:
32-
static bool getDevices(HardwareInfo **pHWInfos, size_t &numDevices);
33+
static bool getDevices(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment);
3334
static void releaseDevices();
3435

3536
protected:

runtime/os_interface/linux/device_factory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace OCLRT {
3838
size_t DeviceFactory::numDevices = 0;
3939
HardwareInfo *DeviceFactory::hwInfos = nullptr;
4040

41-
bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
41+
bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
4242
std::vector<HardwareInfo> tHwInfos;
4343
unsigned int devNum = 0;
4444
size_t requiredDeviceCount = 1;

runtime/os_interface/windows/device_factory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
3636
size_t DeviceFactory::numDevices = 0;
3737
HardwareInfo *DeviceFactory::hwInfos = nullptr;
3838

39-
bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
39+
bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, ExecutionEnvironment &executionEnvironment) {
4040
auto totalDeviceCount = 1u;
4141
if (DebugManager.flags.CreateMultipleDevices.get()) {
4242
totalDeviceCount = DebugManager.flags.CreateMultipleDevices.get();

runtime/platform/platform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace OCLRT {
4242

4343
std::unique_ptr<Platform> platformImpl;
4444

45-
bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned);
45+
bool getDevices(HardwareInfo **hwInfo, size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment);
4646

4747
Platform *platform() { return platformImpl.get(); }
4848

@@ -138,7 +138,7 @@ bool Platform::initialize() {
138138
return true;
139139
}
140140

141-
state = OCLRT::getDevices(&hwInfo, numDevicesReturned) ? StateIniting : StateNone;
141+
state = OCLRT::getDevices(&hwInfo, numDevicesReturned, *executionEnvironment) ? StateIniting : StateNone;
142142

143143
if (state == StateNone) {
144144
return false;

unit_tests/command_stream/get_devices_tests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222

2323
#include "runtime/command_stream/command_stream_receiver.h"
24+
#include "runtime/execution_environment/execution_environment.h"
2425
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
2526
#include "runtime/os_interface/device_factory.h"
2627
#include "runtime/helpers/options.h"
@@ -57,7 +58,8 @@ HWTEST_P(GetDevicesTest, givenGetDevicesWhenCsrIsSetToValidTypeThenTheFuntionRet
5758
int i = 0;
5859
size_t numDevices = 0;
5960
HardwareInfo *hwInfo = nullptr;
60-
auto ret = getDevices(&hwInfo, numDevices);
61+
ExecutionEnvironment executionEnvironment;
62+
auto ret = getDevices(&hwInfo, numDevices, executionEnvironment);
6163

6264
switch (csrType) {
6365
case CSR_HW:

unit_tests/gen10/linux/device_factory_tests_gen10.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ GEN10TEST_F(DeviceFactoryLinuxTestCnl, queryWhitelistedPreemptionRegister) {
2929
HardwareInfo *hwInfo = nullptr;
3030
size_t numDevices = 0;
3131

32-
bool success = DeviceFactory::getDevices(&hwInfo, numDevices);
32+
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment);
3333
EXPECT_TRUE(success);
3434
#if defined(I915_PARAM_HAS_PREEMPTION)
3535
EXPECT_TRUE(hwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580);
@@ -45,7 +45,7 @@ GEN10TEST_F(DeviceFactoryLinuxTestCnl, queryNotWhitelistedPreemptionRegister) {
4545
HardwareInfo *hwInfo = nullptr;
4646
size_t numDevices = 0;
4747

48-
bool success = DeviceFactory::getDevices(&hwInfo, numDevices);
48+
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment);
4949
EXPECT_TRUE(success);
5050
EXPECT_FALSE(hwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580);
5151

unit_tests/gen10/windows/os_interface_tests_gen10.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* OTHER DEALINGS IN THE SOFTWARE.
2121
*/
2222

23+
#include "runtime/execution_environment/execution_environment.h"
2324
#include "unit_tests/os_interface/windows/os_interface_win_tests.h"
2425
#include "unit_tests/gen_common/test.h"
2526

@@ -30,7 +31,8 @@ GEN10TEST_F(OsInterfaceTestCnl, askKmdIfPreemptionRegisterWhitelisted) {
3031
const HardwareInfo *refHwinfo = *platformDevices;
3132
size_t numDevices = 0;
3233

33-
bool success = DeviceFactory::getDevices(&hwInfo, numDevices);
34+
ExecutionEnvironment executionEnvironment;
35+
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment);
3436
EXPECT_TRUE(success);
3537

3638
for (size_t i = 0u; i < numDevices; i++) {

0 commit comments

Comments
 (0)