mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-28 16:48:45 +08:00
Return attach flag when state save area header available
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
21ca54d314
commit
09e8bc4eda
@@ -600,6 +600,13 @@ 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().isDebugAttachAvailable();
|
||||
auto &stateSaveAreaHeader = NEO::SipKernel::getBindlessDebugSipKernel(*this->getNEODevice()).getStateSaveAreaHeader();
|
||||
|
||||
if (stateSaveAreaHeader.size() == 0) {
|
||||
PRINT_DEBUGGER_INFO_LOG("Context state save area header missing", "");
|
||||
isDebugAttachAvailable = false;
|
||||
}
|
||||
|
||||
if (isDebugAttachAvailable && !isSubdevice) {
|
||||
pDebugProperties->flags = zet_device_debug_property_flag_t::ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH;
|
||||
} else {
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace ult {
|
||||
|
||||
void DeviceFixture::SetUp() { // NOLINT(readability-identifier-naming)
|
||||
neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(NEO::defaultHwInfo.get());
|
||||
auto mockBuiltIns = new MockBuiltins();
|
||||
mockBuiltIns = new MockBuiltins();
|
||||
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns);
|
||||
NEO::DeviceVector devices;
|
||||
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
|
||||
|
||||
@@ -28,6 +28,7 @@ struct Context;
|
||||
struct Device;
|
||||
|
||||
namespace ult {
|
||||
class MockBuiltins;
|
||||
|
||||
struct DeviceFixture {
|
||||
NEO::MockCompilerEnableGuard compilerMock = NEO::MockCompilerEnableGuard(true);
|
||||
@@ -38,6 +39,7 @@ struct DeviceFixture {
|
||||
NEO::MockDevice *neoDevice = nullptr;
|
||||
L0::Device *device = nullptr;
|
||||
L0::ContextImp *context = nullptr;
|
||||
MockBuiltins *mockBuiltIns = nullptr;
|
||||
};
|
||||
|
||||
struct PageFaultDeviceFixture {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "test.h"
|
||||
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_built_ins.h"
|
||||
#include "level_zero/tools/test/unit_tests/sources/debug/mock_debug_session.h"
|
||||
|
||||
namespace L0 {
|
||||
@@ -75,6 +76,19 @@ TEST_F(DebugApiTest, givenDeviceWhenDebugAttachIsAvaialbleThenGetPropertiesRetur
|
||||
EXPECT_EQ(ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH, debugProperties.flags);
|
||||
}
|
||||
|
||||
TEST_F(DebugApiTest, givenStateSaveAreaHeaderUnavailableWhenGettingDebugPropertiesThenAttachFlagIsNotReturned) {
|
||||
zet_device_debug_properties_t debugProperties = {};
|
||||
debugProperties.flags = ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32;
|
||||
|
||||
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new OsInterfaceWithDebugAttach);
|
||||
mockBuiltIns->stateSaveAreaHeader.clear();
|
||||
|
||||
auto result = zetDeviceGetDebugProperties(device->toHandle(), &debugProperties);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
EXPECT_EQ(0u, debugProperties.flags);
|
||||
}
|
||||
|
||||
TEST_F(DebugApiTest, givenSubDeviceWhenDebugAttachIsAvaialbleThenGetPropertiesReturnsNoFlag) {
|
||||
zet_device_debug_properties_t debugProperties = {};
|
||||
debugProperties.flags = ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32;
|
||||
|
||||
Reference in New Issue
Block a user