From 24ed89ed24af9c1d2e235fe9f9e02ad344c124b2 Mon Sep 17 00:00:00 2001 From: Mateusz Hoppe Date: Fri, 21 Feb 2025 09:58:47 +0000 Subject: [PATCH] refactor: simplify debug attach capability detection Signed-off-by: Mateusz Hoppe --- level_zero/core/source/device/device_imp.cpp | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 7f6cce9cca..496be2862d 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -1359,23 +1359,23 @@ ze_result_t DeviceImp::getDeviceImageProperties(ze_device_image_properties_t *pD ze_result_t DeviceImp::getDebugProperties(zet_device_debug_properties_t *pDebugProperties) { bool isDebugAttachAvailable = getOsInterface() ? getOsInterface()->isDebugAttachAvailable() : false; - auto &stateSaveAreaHeader = NEO::SipKernel::getDebugSipKernel(*this->getNEODevice()).getStateSaveAreaHeader(); - - if (stateSaveAreaHeader.size() == 0) { - PRINT_DEBUGGER_INFO_LOG("Context state save area header missing", ""); - isDebugAttachAvailable = false; - } + pDebugProperties->flags = 0; auto &hwInfo = neoDevice->getHardwareInfo(); if (!hwInfo.capabilityTable.l0DebuggerSupported) { isDebugAttachAvailable = false; } - - bool tileAttach = NEO::debugManager.flags.ExperimentalEnableTileAttach.get(); - pDebugProperties->flags = 0; if (isDebugAttachAvailable) { - if ((isSubdevice && tileAttach) || !isSubdevice) { - pDebugProperties->flags = zet_device_debug_property_flag_t::ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH; + auto &stateSaveAreaHeader = NEO::SipKernel::getDebugSipKernel(*this->getNEODevice()).getStateSaveAreaHeader(); + + if (stateSaveAreaHeader.size() == 0) { + PRINT_DEBUGGER_INFO_LOG("Context state save area header missing", ""); + } else { + bool tileAttach = NEO::debugManager.flags.ExperimentalEnableTileAttach.get(); + + if ((isSubdevice && tileAttach) || !isSubdevice) { + pDebugProperties->flags = zet_device_debug_property_flag_t::ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH; + } } } return ZE_RESULT_SUCCESS;