diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 3d00a50b60..52e528bb8e 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -730,6 +730,11 @@ ze_result_t DeviceImp::getDebugProperties(zet_device_debug_properties_t *pDebugP isDebugAttachAvailable = false; } + auto &hwInfo = neoDevice->getHardwareInfo(); + if (!hwInfo.capabilityTable.l0DebuggerSupported) { + isDebugAttachAvailable = false; + } + if (isDebugAttachAvailable && !isSubdevice) { pDebugProperties->flags = zet_device_debug_property_flag_t::ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH; } else { diff --git a/level_zero/core/source/dll/linux/debugger_l0_linux.cpp b/level_zero/core/source/dll/linux/debugger_l0_linux.cpp index 421a05a142..fd5d5a7059 100644 --- a/level_zero/core/source/dll/linux/debugger_l0_linux.cpp +++ b/level_zero/core/source/dll/linux/debugger_l0_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -13,6 +13,10 @@ namespace L0 { std::unique_ptr DebuggerL0::create(NEO::Device *device) { + auto &hwInfo = device->getHardwareInfo(); + if (!hwInfo.capabilityTable.l0DebuggerSupported) { + return nullptr; + } auto success = initDebuggingInOs(device->getRootDeviceEnvironment().osInterface.get()); if (success) { auto debugger = debuggerL0Factory[device->getHardwareInfo().platform.eRenderCoreFamily](device); diff --git a/level_zero/tools/test/unit_tests/sources/debug/test_debug_api.inl b/level_zero/tools/test/unit_tests/sources/debug/test_debug_api.inl index 8ec8780e3c..e747d5000d 100644 --- a/level_zero/tools/test/unit_tests/sources/debug/test_debug_api.inl +++ b/level_zero/tools/test/unit_tests/sources/debug/test_debug_api.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -63,7 +63,8 @@ TEST_F(DebugApiTest, givenSubDeviceWhenCallingDebugAttachThenErrorIsReturned) { EXPECT_EQ(nullptr, debugSession); } -TEST_F(DebugApiTest, givenDeviceWhenDebugAttachIsAvaialbleThenGetPropertiesReturnsCorrectFlag) { +using isDebugSupportedProduct = IsWithinProducts; +HWTEST2_F(DebugApiTest, givenDeviceWhenDebugAttachIsAvaialbleThenGetPropertiesReturnsCorrectFlag, isDebugSupportedProduct) { zet_device_debug_properties_t debugProperties = {}; debugProperties.flags = ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32; @@ -75,6 +76,19 @@ TEST_F(DebugApiTest, givenDeviceWhenDebugAttachIsAvaialbleThenGetPropertiesRetur EXPECT_EQ(ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH, debugProperties.flags); } +using isDebugNotSupportedProduct = IsNotWithinProducts; +HWTEST2_F(DebugApiTest, givenDeviceWhenDebugIsNotSupportedThenGetPropertiesReturnsCorrectFlag, isDebugNotSupportedProduct) { + zet_device_debug_properties_t debugProperties = {}; + debugProperties.flags = ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32; + + neoDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new OsInterfaceWithDebugAttach); + + auto result = zetDeviceGetDebugProperties(device->toHandle(), &debugProperties); + + EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(0u, debugProperties.flags); +} + TEST_F(DebugApiTest, givenStateSaveAreaHeaderUnavailableWhenGettingDebugPropertiesThenAttachFlagIsNotReturned) { zet_device_debug_properties_t debugProperties = {}; debugProperties.flags = ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32; diff --git a/shared/source/gen11/hw_info_ehl.cpp b/shared/source/gen11/hw_info_ehl.cpp index d985dbe839..4a98e8b3b9 100644 --- a/shared/source/gen11/hw_info_ehl.cpp +++ b/shared/source/gen11/hw_info_ehl.cpp @@ -82,7 +82,8 @@ const RuntimeCapabilityTable EHL::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable EHL::workaroundTable = {}; diff --git a/shared/source/gen11/hw_info_icllp.cpp b/shared/source/gen11/hw_info_icllp.cpp index 1f1559f44a..20d2a64d79 100644 --- a/shared/source/gen11/hw_info_icllp.cpp +++ b/shared/source/gen11/hw_info_icllp.cpp @@ -83,7 +83,8 @@ const RuntimeCapabilityTable ICLLP::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable ICLLP::workaroundTable = {}; diff --git a/shared/source/gen11/hw_info_lkf.cpp b/shared/source/gen11/hw_info_lkf.cpp index 3923864de3..f2cac70847 100644 --- a/shared/source/gen11/hw_info_lkf.cpp +++ b/shared/source/gen11/hw_info_lkf.cpp @@ -82,7 +82,8 @@ const RuntimeCapabilityTable LKF::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable LKF::workaroundTable = {}; diff --git a/shared/source/gen12lp/hw_info_adlp.cpp b/shared/source/gen12lp/hw_info_adlp.cpp index 223931e204..76a2720b81 100644 --- a/shared/source/gen12lp/hw_info_adlp.cpp +++ b/shared/source/gen12lp/hw_info_adlp.cpp @@ -80,7 +80,8 @@ const RuntimeCapabilityTable ADLP::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - true // fusedEuEnabled + true, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable ADLP::workaroundTable = {}; diff --git a/shared/source/gen12lp/hw_info_adls.cpp b/shared/source/gen12lp/hw_info_adls.cpp index 57ce1737c2..04628ef5bd 100644 --- a/shared/source/gen12lp/hw_info_adls.cpp +++ b/shared/source/gen12lp/hw_info_adls.cpp @@ -80,7 +80,8 @@ const RuntimeCapabilityTable ADLS::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - true // fusedEuEnabled + true, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable ADLS::workaroundTable = {}; diff --git a/shared/source/gen12lp/hw_info_dg1.cpp b/shared/source/gen12lp/hw_info_dg1.cpp index ee961edef4..f3e67f5f85 100644 --- a/shared/source/gen12lp/hw_info_dg1.cpp +++ b/shared/source/gen12lp/hw_info_dg1.cpp @@ -88,7 +88,8 @@ const RuntimeCapabilityTable DG1::capabilityTable{ true, // supportsMediaBlock true, // p2pAccessSupported false, // p2pAtomicAccessSupported - true // fusedEuEnabled + true, // fusedEuEnabled + true, // l0DebuggerSupported; }; WorkaroundTable DG1::workaroundTable = {}; diff --git a/shared/source/gen12lp/hw_info_rkl.cpp b/shared/source/gen12lp/hw_info_rkl.cpp index dc0142c498..b35c433e92 100644 --- a/shared/source/gen12lp/hw_info_rkl.cpp +++ b/shared/source/gen12lp/hw_info_rkl.cpp @@ -80,7 +80,8 @@ const RuntimeCapabilityTable RKL::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - true // fusedEuEnabled + true, // fusedEuEnabled + false, // l0DebuggerSupported; }; WorkaroundTable RKL::workaroundTable = {}; diff --git a/shared/source/gen12lp/hw_info_tgllp.cpp b/shared/source/gen12lp/hw_info_tgllp.cpp index 834606f644..ae475865f6 100644 --- a/shared/source/gen12lp/hw_info_tgllp.cpp +++ b/shared/source/gen12lp/hw_info_tgllp.cpp @@ -84,7 +84,8 @@ const RuntimeCapabilityTable TGLLP::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - true // fusedEuEnabled + true, // fusedEuEnabled + false, // l0DebuggerSupported; }; WorkaroundTable TGLLP::workaroundTable = {}; diff --git a/shared/source/gen8/hw_info_bdw.cpp b/shared/source/gen8/hw_info_bdw.cpp index 0768edd3eb..f3ab2f4f69 100644 --- a/shared/source/gen8/hw_info_bdw.cpp +++ b/shared/source/gen8/hw_info_bdw.cpp @@ -87,7 +87,8 @@ const RuntimeCapabilityTable BDW::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable BDW::workaroundTable = {}; diff --git a/shared/source/gen9/hw_info_bxt.cpp b/shared/source/gen9/hw_info_bxt.cpp index badd69d64d..344cc6070a 100644 --- a/shared/source/gen9/hw_info_bxt.cpp +++ b/shared/source/gen9/hw_info_bxt.cpp @@ -84,7 +84,8 @@ const RuntimeCapabilityTable BXT::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable BXT::workaroundTable = {}; diff --git a/shared/source/gen9/hw_info_cfl.cpp b/shared/source/gen9/hw_info_cfl.cpp index 7b10f7f9ac..049059a1b6 100644 --- a/shared/source/gen9/hw_info_cfl.cpp +++ b/shared/source/gen9/hw_info_cfl.cpp @@ -79,7 +79,8 @@ const RuntimeCapabilityTable CFL::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable CFL::workaroundTable = {}; diff --git a/shared/source/gen9/hw_info_glk.cpp b/shared/source/gen9/hw_info_glk.cpp index 06db186262..8fa7929e26 100644 --- a/shared/source/gen9/hw_info_glk.cpp +++ b/shared/source/gen9/hw_info_glk.cpp @@ -79,7 +79,8 @@ const RuntimeCapabilityTable GLK::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable GLK::workaroundTable = {}; diff --git a/shared/source/gen9/hw_info_kbl.cpp b/shared/source/gen9/hw_info_kbl.cpp index 97be4b39b8..14dcd69f20 100644 --- a/shared/source/gen9/hw_info_kbl.cpp +++ b/shared/source/gen9/hw_info_kbl.cpp @@ -79,7 +79,8 @@ const RuntimeCapabilityTable KBL::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable KBL::workaroundTable = {}; diff --git a/shared/source/gen9/hw_info_skl.cpp b/shared/source/gen9/hw_info_skl.cpp index e9971d1e46..880998e0ab 100644 --- a/shared/source/gen9/hw_info_skl.cpp +++ b/shared/source/gen9/hw_info_skl.cpp @@ -87,7 +87,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{ true, // supportsMediaBlock false, // p2pAccessSupported false, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + false // l0DebuggerSupported; }; WorkaroundTable SKL::workaroundTable = {}; diff --git a/shared/source/helpers/hw_info.h b/shared/source/helpers/hw_info.h index 92c4734e1e..639a98dc49 100644 --- a/shared/source/helpers/hw_info.h +++ b/shared/source/helpers/hw_info.h @@ -68,6 +68,7 @@ struct RuntimeCapabilityTable { bool p2pAccessSupported; bool p2pAtomicAccessSupported; bool fusedEuEnabled; + bool l0DebuggerSupported; }; inline bool operator==(const RuntimeCapabilityTable &lhs, const RuntimeCapabilityTable &rhs) { @@ -133,6 +134,7 @@ inline bool operator==(const RuntimeCapabilityTable &lhs, const RuntimeCapabilit result &= (lhs.isIntegratedDevice == rhs.isIntegratedDevice); result &= (lhs.supportsMediaBlock == rhs.supportsMediaBlock); result &= (lhs.fusedEuEnabled == rhs.fusedEuEnabled); + result &= (lhs.l0DebuggerSupported == rhs.l0DebuggerSupported); return result; } diff --git a/shared/source/xe_hp_core/hw_info_xe_hp_sdv.cpp b/shared/source/xe_hp_core/hw_info_xe_hp_sdv.cpp index bf3a9b884c..666da61d82 100644 --- a/shared/source/xe_hp_core/hw_info_xe_hp_sdv.cpp +++ b/shared/source/xe_hp_core/hw_info_xe_hp_sdv.cpp @@ -84,7 +84,8 @@ const RuntimeCapabilityTable XE_HP_SDV::capabilityTable{ true, // supportsMediaBlock true, // p2pAccessSupported false, // p2pAtomicAccessSupported - true // fusedEuEnabled + true, // fusedEuEnabled + true // l0DebuggerSupported; }; WorkaroundTable XE_HP_SDV::workaroundTable = {}; diff --git a/shared/source/xe_hpc_core/hw_info_pvc.cpp b/shared/source/xe_hpc_core/hw_info_pvc.cpp index 65e38dec12..7333ccc3fd 100644 --- a/shared/source/xe_hpc_core/hw_info_pvc.cpp +++ b/shared/source/xe_hpc_core/hw_info_pvc.cpp @@ -93,7 +93,8 @@ const RuntimeCapabilityTable PVC::capabilityTable{ false, // supportsMediaBlock true, // p2pAccessSupported true, // p2pAtomicAccessSupported - false // fusedEuEnabled + false, // fusedEuEnabled + true // l0DebuggerSupported; }; void PVC::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { diff --git a/shared/source/xe_hpg_core/hw_info_dg2.cpp b/shared/source/xe_hpg_core/hw_info_dg2.cpp index 848403a2b1..394bda9bce 100644 --- a/shared/source/xe_hpg_core/hw_info_dg2.cpp +++ b/shared/source/xe_hpg_core/hw_info_dg2.cpp @@ -84,7 +84,8 @@ const RuntimeCapabilityTable DG2::capabilityTable{ true, // supportsMediaBlock true, // p2pAccessSupported false, // p2pAtomicAccessSupported - true // fusedEuEnabled + true, // fusedEuEnabled + true // l0DebuggerSupported }; WorkaroundTable DG2::workaroundTable = {}; diff --git a/shared/test/common/test_macros/test.h b/shared/test/common/test_macros/test.h index 43c04f3f44..5e2d2f8524 100644 --- a/shared/test/common/test_macros/test.h +++ b/shared/test/common/test_macros/test.h @@ -849,6 +849,14 @@ struct IsWithinProducts { } }; +template +struct IsNotWithinProducts { + template + static constexpr bool isMatched() { + return (productFamily < productFamilyMin) || (productFamily > productFamilyMax); + } +}; + struct MatchAny { template static constexpr bool isMatched() { return true; }