diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 127f97b882..d1fb6118f2 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -355,10 +355,6 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties) pDeviceProperties->coreClockRate = deviceInfo.maxClockFrequency; - if (hardwareInfo.capabilityTable.supportsOnDemandPageFaults) { - pDeviceProperties->flags |= ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING; - } - pDeviceProperties->maxCommandQueuePriority = 0; pDeviceProperties->numThreadsPerEU = deviceInfo.numThreadsPerEU; @@ -375,6 +371,22 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties) pDeviceProperties->maxMemAllocSize = this->neoDevice->getDeviceInfo().maxMemAllocSize; + if (hardwareInfo.capabilityTable.isIntegratedDevice) { + pDeviceProperties->flags |= ZE_DEVICE_PROPERTY_FLAG_INTEGRATED; + } + + if (isSubdevice) { + pDeviceProperties->flags |= ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE; + } + + if (this->neoDevice->getDeviceInfo().errorCorrectionSupport) { + pDeviceProperties->flags |= ZE_DEVICE_PROPERTY_FLAG_ECC; + } + + if (hardwareInfo.capabilityTable.supportsOnDemandPageFaults) { + pDeviceProperties->flags |= ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING; + } + memset(pDeviceProperties->name, 0, ZE_MAX_DEVICE_NAME); std::string name = "Intel(R) "; name += NEO::familyName[hardwareInfo.platform.eRenderCoreFamily]; diff --git a/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp b/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp index e151bd7f41..ee65f0379f 100644 --- a/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp +++ b/level_zero/core/test/unit_tests/gen9/test_device_gen9.cpp @@ -27,11 +27,14 @@ HWTEST2_F(KernelPropertyTest, givenReturnedKernelPropertiesThenExpectedDp4aSuppo using DevicePropertyTest = Test; -HWTEST2_F(DevicePropertyTest, givenReturnedDevicePropertiesThenExpectedPageFaultSupportReturned, IsGen9) { +HWTEST2_F(DevicePropertyTest, givenReturnedDevicePropertiesThenExpectedPropertiesFlagsSet, IsGen9) { ze_device_properties_t deviceProps; device->getProperties(&deviceProps); EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING); + EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_ECC); + EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE); + EXPECT_EQ(ZE_DEVICE_PROPERTY_FLAG_INTEGRATED, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED); } using DeviceQueueGroupTest = Test; diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index 516b40b599..1bb1244b83 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -156,6 +156,14 @@ TEST_F(DeviceTest, givenCallToDevicePropertiesThenMaximumMemoryToBeAllocatedIsCo EXPECT_EQ(deviceProperties.maxMemAllocSize, this->neoDevice->getDeviceInfo().maxMemAllocSize); } +TEST_F(DeviceTest, whenGetDevicePropertiesCalledThenCorrectDevicePropertyEccFlagSet) { + ze_device_properties_t deviceProps; + + device->getProperties(&deviceProps); + auto expected = (this->neoDevice->getDeviceInfo().errorCorrectionSupport) ? ZE_DEVICE_PROPERTY_FLAG_ECC : static_cast(0u); + EXPECT_EQ(expected, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_ECC); +} + TEST_F(DeviceTest, givenCommandQueuePropertiesCallThenCallSucceeds) { uint32_t count = 0; ze_result_t res = device->getCommandQueueGroupProperties(&count, nullptr); @@ -270,6 +278,27 @@ TEST_F(MultipleDevicesTest, whenRetrievingNumberOfSubdevicesThenCorrectNumberIsR } } +TEST_F(MultipleDevicesTest, whenRetriecingSubDevicePropertiesThenCorrectFlagIsSet) { + L0::Device *device0 = driverHandle->devices[0]; + + uint32_t count = 0; + auto result = device0->getSubDevices(&count, nullptr); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(numSubDevices, count); + + std::vector subDevices(count); + count++; + result = device0->getSubDevices(&count, subDevices.data()); + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(numSubDevices, count); + + ze_device_properties_t deviceProps; + + L0::Device *subdevice0 = static_cast(subDevices[0]); + subdevice0->getProperties(&deviceProps); + EXPECT_EQ(ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE); +} + TEST_F(MultipleDevicesTest, givenTheSameDeviceThenCanAccessPeerReturnsTrue) { L0::Device *device0 = driverHandle->devices[0]; @@ -463,5 +492,41 @@ TEST_F(DeviceTest, givenNoL0DebuggerWhenGettingL0DebuggerThenNullptrReturned) { EXPECT_EQ(nullptr, device->getL0Debugger()); } +TEST(DevicePropertyFlagIsIntegratedTest, givenIntegratedDeviceThenCorrectDevicePropertyFlagSet) { + std::unique_ptr> driverHandle; + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.capabilityTable.isIntegratedDevice = true; + + NEO::MockDevice *neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo); + NEO::DeviceVector devices; + devices.push_back(std::unique_ptr(neoDevice)); + driverHandle = std::make_unique>(); + driverHandle->initialize(std::move(devices)); + auto device = driverHandle->devices[0]; + + ze_device_properties_t deviceProps; + + device->getProperties(&deviceProps); + EXPECT_EQ(ZE_DEVICE_PROPERTY_FLAG_INTEGRATED, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED); +} + +TEST(DevicePropertyFlagDiscreteDeviceTest, givenDiscreteDeviceThenCorrectDevicePropertyFlagSet) { + std::unique_ptr> driverHandle; + NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.capabilityTable.isIntegratedDevice = false; + + NEO::MockDevice *neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo); + NEO::DeviceVector devices; + devices.push_back(std::unique_ptr(neoDevice)); + driverHandle = std::make_unique>(); + driverHandle->initialize(std::move(devices)); + auto device = driverHandle->devices[0]; + + ze_device_properties_t deviceProps; + + device->getProperties(&deviceProps); + EXPECT_EQ(0u, deviceProps.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED); +} + } // namespace ult } // namespace L0 \ No newline at end of file diff --git a/opencl/source/gen11/hw_info_ehl.inl b/opencl/source/gen11/hw_info_ehl.inl index 913599d97f..9c1b0192b5 100644 --- a/opencl/source/gen11/hw_info_ehl.inl +++ b/opencl/source/gen11/hw_info_ehl.inl @@ -75,7 +75,8 @@ const RuntimeCapabilityTable EHL::capabilityTable{ false, // supportsOnDemandPageFaults false, // supportsIndependentForwardProgress true, // hostPtrTrackingEnabled - false // levelZeroSupported + false, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable EHL::workaroundTable = {}; diff --git a/opencl/source/gen11/hw_info_icllp.inl b/opencl/source/gen11/hw_info_icllp.inl index 5065438cc2..5e356bb77a 100644 --- a/opencl/source/gen11/hw_info_icllp.inl +++ b/opencl/source/gen11/hw_info_icllp.inl @@ -76,7 +76,8 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{ false, // supportsOnDemandPageFaults true, // supportsIndependentForwardProgress true, // hostPtrTrackingEnabled - true // levelZeroSupported + true, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable ICLLP::workaroundTable = {}; diff --git a/opencl/source/gen11/hw_info_lkf.inl b/opencl/source/gen11/hw_info_lkf.inl index a447169828..5f3ddebef9 100644 --- a/opencl/source/gen11/hw_info_lkf.inl +++ b/opencl/source/gen11/hw_info_lkf.inl @@ -75,7 +75,8 @@ const RuntimeCapabilityTable LKF::capabilityTable{ false, // supportsOnDemandPageFaults false, // supportsIndependentForwardProgress true, // hostPtrTrackingEnabled - false // levelZeroSupported + false, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable LKF::workaroundTable = {}; diff --git a/opencl/source/gen12lp/hw_info_dg1.inl b/opencl/source/gen12lp/hw_info_dg1.inl index 9a0966e620..3c0dca8122 100644 --- a/opencl/source/gen12lp/hw_info_dg1.inl +++ b/opencl/source/gen12lp/hw_info_dg1.inl @@ -79,7 +79,8 @@ const RuntimeCapabilityTable DG1::capabilityTable{ false, // supportsOnDemandPageFaults false, // supportsIndependentForwardProgress false, // hostPtrTrackingEnabled - true // levelZeroSupported + true, // levelZeroSupported + false // isIntegratedDevice }; WorkaroundTable DG1::workaroundTable = {}; diff --git a/opencl/source/gen12lp/hw_info_tgllp.inl b/opencl/source/gen12lp/hw_info_tgllp.inl index e9e6b47c37..3c4be3486a 100644 --- a/opencl/source/gen12lp/hw_info_tgllp.inl +++ b/opencl/source/gen12lp/hw_info_tgllp.inl @@ -77,7 +77,8 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{ false, // supportsOnDemandPageFaults false, // supportsIndependentForwardProgress false, // hostPtrTrackingEnabled - true // levelZeroSupported + true, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable TGLLP::workaroundTable = {}; diff --git a/opencl/source/gen8/hw_info_bdw.inl b/opencl/source/gen8/hw_info_bdw.inl index c01e7633ed..c846ec9e48 100644 --- a/opencl/source/gen8/hw_info_bdw.inl +++ b/opencl/source/gen8/hw_info_bdw.inl @@ -80,7 +80,8 @@ const RuntimeCapabilityTable BDW::capabilityTable{ false, // supportsOnDemandPageFaults true, // supportsIndependentForwardProgress true, // hostPtrTrackingEnabled - false // levelZeroSupported + false, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable BDW::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_bxt.inl b/opencl/source/gen9/hw_info_bxt.inl index 2a1bd48fb5..bfd903cc49 100644 --- a/opencl/source/gen9/hw_info_bxt.inl +++ b/opencl/source/gen9/hw_info_bxt.inl @@ -77,7 +77,8 @@ const RuntimeCapabilityTable BXT::capabilityTable{ false, // supportsOnDemandPageFaults false, // supportsIndependentForwardProgress true, // hostPtrTrackingEnabled - false // levelZeroSupported + false, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable BXT::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_cfl.inl b/opencl/source/gen9/hw_info_cfl.inl index 3b3f13c850..2043792179 100644 --- a/opencl/source/gen9/hw_info_cfl.inl +++ b/opencl/source/gen9/hw_info_cfl.inl @@ -72,7 +72,8 @@ const RuntimeCapabilityTable CFL::capabilityTable{ false, // supportsOnDemandPageFaults true, // supportsIndependentForwardProgress true, // hostPtrTrackingEnabled - true // levelZeroSupported + true, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable CFL::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_glk.inl b/opencl/source/gen9/hw_info_glk.inl index 457c82a879..54cebf6aa9 100644 --- a/opencl/source/gen9/hw_info_glk.inl +++ b/opencl/source/gen9/hw_info_glk.inl @@ -72,7 +72,8 @@ const RuntimeCapabilityTable GLK::capabilityTable{ false, // supportsOnDemandPageFaults false, // supportsIndependentForwardProgress true, // hostPtrTrackingEnabled - false // levelZeroSupported + false, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable GLK::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_kbl.inl b/opencl/source/gen9/hw_info_kbl.inl index 870d44b42d..c68b23ff1d 100644 --- a/opencl/source/gen9/hw_info_kbl.inl +++ b/opencl/source/gen9/hw_info_kbl.inl @@ -72,7 +72,8 @@ const RuntimeCapabilityTable KBL::capabilityTable{ false, // supportsOnDemandPageFaults true, // supportsIndependentForwardProgress true, // hostPtrTrackingEnabled - true // levelZeroSupported + true, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable KBL::workaroundTable = {}; diff --git a/opencl/source/gen9/hw_info_skl.inl b/opencl/source/gen9/hw_info_skl.inl index e968b8b245..ee2eb4d1dc 100644 --- a/opencl/source/gen9/hw_info_skl.inl +++ b/opencl/source/gen9/hw_info_skl.inl @@ -80,7 +80,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{ false, // supportsOnDemandPageFaults true, // supportsIndependentForwardProgress true, // hostPtrTrackingEnabled - true // levelZeroSupported + true, // levelZeroSupported + true // isIntegratedDevice }; WorkaroundTable SKL::workaroundTable = {}; FeatureTable SKL::featureTable = {}; diff --git a/shared/source/helpers/hw_info.h b/shared/source/helpers/hw_info.h index b437b195f9..b134fce83b 100644 --- a/shared/source/helpers/hw_info.h +++ b/shared/source/helpers/hw_info.h @@ -60,6 +60,7 @@ struct RuntimeCapabilityTable { bool supportsIndependentForwardProgress; bool hostPtrTrackingEnabled; bool levelZeroSupported; + bool isIntegratedDevice; }; struct HardwareCapabilities {