Add initial support for context debug

Related-To: NEO-5478

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2021-01-25 20:43:48 +00:00
committed by Compute-Runtime-Automation
parent eb1ea19360
commit 3ab932b101
7 changed files with 72 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -468,3 +468,36 @@ TEST(DrmTest, givenNoPerContextVmsDrmWhenCreatingOsContextsThenVmIdIsNotQueriedA
auto &drmVmIds = osContext.getDrmVmIds();
EXPECT_EQ(0u, drmVmIds.size());
}
TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextThenSetContextDebugFlagIsCalled) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
DrmMockNonFailing drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drmMock.contextDebugSupported = true;
OsContextLinux osContext(drmMock, 5u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
// drmMock returns ctxId == 0
EXPECT_EQ(0u, drmMock.passedContextDebugId);
}
TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextForInternalEngineThenSetContextDebugFlagIsNotCalled) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
DrmMockNonFailing drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drmMock.contextDebugSupported = true;
OsContextLinux osContext(drmMock, 5u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, true, false);
EXPECT_EQ(static_cast<uint32_t>(-1), drmMock.passedContextDebugId);
}