diff --git a/opencl/test/unit_test/os_interface/device_factory_tests.cpp b/opencl/test/unit_test/os_interface/device_factory_tests.cpp index a1017b7392..31d42df67c 100644 --- a/opencl/test/unit_test/os_interface/device_factory_tests.cpp +++ b/opencl/test/unit_test/os_interface/device_factory_tests.cpp @@ -142,6 +142,21 @@ TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToGreaterSubDeviceThanAvailableW EXPECT_EQ(devices[0]->getNumAvailableDevices(), 4u); } +TEST_F(DeviceFactoryTest, givenEmptyAffintyMaskWhenCreateDeviceThenAllDevicesAreReturned) { + DebugManagerStateRestore restorer; + DebugManager.flags.CreateMultipleRootDevices.set(2); + DebugManager.flags.CreateMultipleSubDevices.set(4); + DebugManager.flags.ZE_AFFINITY_MASK.set(""); + VariableBackup backup(&ultHwConfig); + ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false; + + auto devices = DeviceFactory::createDevices(*executionEnvironment); + + EXPECT_EQ(devices.size(), 2u); + EXPECT_EQ(devices[0]->getNumAvailableDevices(), 4u); + EXPECT_EQ(devices[0]->getNumAvailableDevices(), 4u); +} + TEST_F(DeviceFactoryTest, givenZeAffinityMaskSetToRootDevicesOnlyWhenCreateDevicesThenProperNumberOfDevicesIsReturned) { DebugManagerStateRestore restorer; DebugManager.flags.CreateMultipleRootDevices.set(2); diff --git a/shared/source/execution_environment/execution_environment.cpp b/shared/source/execution_environment/execution_environment.cpp index 79066739e6..3896024033 100644 --- a/shared/source/execution_environment/execution_environment.cpp +++ b/shared/source/execution_environment/execution_environment.cpp @@ -82,7 +82,7 @@ void ExecutionEnvironment::prepareRootDeviceEnvironments(uint32_t numRootDevices void ExecutionEnvironment::parseAffinityMask() { auto affinityMaskString = DebugManager.flags.ZE_AFFINITY_MASK.get(); - if (affinityMaskString.compare("default") == 0) { + if (affinityMaskString.compare("default") == 0 || affinityMaskString.empty()) { return; }