refactor: Remove default support for DCD Debugger

Related-To: NEO-7213
Signed-off-by: Fabian Zwolinski <fabian.zwolinski@intel.com>
This commit is contained in:
Fabian Zwolinski
2023-05-05 09:04:41 +00:00
committed by Compute-Runtime-Automation
parent 5402e2639f
commit 3f92f044a3
56 changed files with 377 additions and 210 deletions

View File

@@ -15,6 +15,10 @@ using namespace NEO;
using EhlTest = Test<DeviceFixture>;
EHLTEST_F(EhlTest, givenEhlThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
EHLTEST_F(EhlTest, givenEhlWhenSlmSizeIsRequiredThenReturnCorrectValue) {
EXPECT_EQ(64u, pDevice->getHardwareInfo().capabilityTable.slmSize);
}

View File

@@ -16,6 +16,10 @@ using namespace NEO;
using IcllpTest = Test<ClDeviceFixture>;
ICLLPTEST_F(IcllpTest, givenIcllpThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
ICLLPTEST_F(IcllpTest, givenIcllpWhenSlmSizeIsRequiredThenReturnCorrectValue) {
EXPECT_EQ(64u, pDevice->getHardwareInfo().capabilityTable.slmSize);
}

View File

@@ -16,6 +16,10 @@ using namespace NEO;
using LkfTest = Test<ClDeviceFixture>;
LKFTEST_F(LkfTest, givenLkfThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
LKFTEST_F(LkfTest, givenLkfWhenSlmSizeIsRequiredThenReturnCorrectValue) {
EXPECT_EQ(64u, pDevice->getHardwareInfo().capabilityTable.slmSize);
}

View File

@@ -17,6 +17,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> BxtDeviceCaps;
BXTTEST_F(BxtDeviceCaps, GivenBxtThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
BXTTEST_F(BxtDeviceCaps, WhenCheckingProfilingTimerResolutionThenCorrectResolutionIsReturned) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_EQ(52u, caps.outProfilingTimerResolution);

View File

@@ -16,6 +16,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> BxtDeviceCapsWindows;
BXTTEST_F(BxtDeviceCapsWindows, GivenBxtWindowsThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
BXTTEST_F(BxtDeviceCapsWindows, GivenWhenGettingKmdNotifyPropertiesThenItIsDisabled) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);

View File

@@ -16,6 +16,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> CflDeviceCaps;
CFLTEST_F(CflDeviceCaps, GivenCFLThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
CFLTEST_F(CflDeviceCaps, GivenCFLWhenCheckftr64KBpagesThenTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftr64KBpages);
}

View File

@@ -16,6 +16,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> CflDeviceCapsWindows;
CFLTEST_F(CflDeviceCapsWindows, GivenCflWindowsThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
CFLTEST_F(CflDeviceCapsWindows, GivenWhenGettingKmdNotifyPropertiesThenItIsDisabled) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);

View File

@@ -16,6 +16,10 @@ using namespace NEO;
using GlkDeviceCaps = Test<DeviceFixture>;
GLKTEST_F(GlkDeviceCaps, givenGlkThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
GLKTEST_F(GlkDeviceCaps, WhenCheckingProfilingTimerResolutionThenCorrectResolutionIsReturned) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_EQ(52u, caps.outProfilingTimerResolution);

View File

@@ -16,6 +16,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> GlkDeviceCapsWindows;
GLKTEST_F(GlkDeviceCapsWindows, GivenGlkWindowsThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
GLKTEST_F(GlkDeviceCapsWindows, WhenCheckingKmdNotifyPropertiesThenKmdNotifyIsEnabledCorrectly) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(30000, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);

View File

@@ -14,6 +14,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> KblDeviceCaps;
KBLTEST_F(KblDeviceCaps, GivenKBLThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
KBLTEST_F(KblDeviceCaps, GivenKBLWhenCheckftr64KBpagesThenTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftr64KBpages);
}

View File

@@ -14,6 +14,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> KblDeviceCapsWindows;
KBLTEST_F(KblDeviceCapsWindows, givenKblWindowsThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
KBLTEST_F(KblDeviceCapsWindows, GivenWhenGettingKmdNotifyPropertiesThenItIsDisabled) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);

View File

@@ -17,6 +17,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> SklDeviceCaps;
SKLTEST_F(SklDeviceCaps, givenSklThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
SKLTEST_F(SklDeviceCaps, WhenCheckingProfilingTimerResolutionThenCorrectResolutionIsReturned) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_EQ(83u, caps.outProfilingTimerResolution);

View File

@@ -16,6 +16,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> SklDeviceCapsWindows;
SKLTEST_F(SklDeviceCapsWindows, GivenSklWindowsThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
SKLTEST_F(SklDeviceCapsWindows, GivenWhenGettingKmdNotifyPropertiesThenItIsDisabled) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);

View File

@@ -165,6 +165,20 @@ MockUnrestrictiveContext::MockUnrestrictiveContext() : MockContext(nullptr, null
initializeWithDevices(ClDeviceVector{deviceIds, 3}, true);
}
MockUnrestrictiveDebuggingSupportedContext::MockUnrestrictiveDebuggingSupportedContext() : MockContext(nullptr, nullptr) {
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
hwInfo.capabilityTable.debuggerSupported = true;
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
ultClDeviceFactory = std::make_unique<UltClDeviceFactory>(1, 2, static_cast<ClExecutionEnvironment *>(executionEnvironment));
pRootDevice = ultClDeviceFactory->rootDevices[0];
pSubDevice0 = ultClDeviceFactory->subDevices[0];
pSubDevice1 = ultClDeviceFactory->subDevices[1];
cl_device_id deviceIds[] = {pRootDevice, pSubDevice0, pSubDevice1};
initializeWithDevices(ClDeviceVector{deviceIds, 3}, true);
}
MockUnrestrictiveContextMultiGPU::MockUnrestrictiveContextMultiGPU() : MockContext(nullptr, nullptr) {
pRootDevice0 = ultClDeviceFactory.rootDevices[0];
pSubDevice00 = ultClDeviceFactory.subDevices[0];

View File

@@ -92,6 +92,15 @@ struct MockUnrestrictiveContext : MockContext {
ClDevice *pSubDevice1 = nullptr;
};
struct MockUnrestrictiveDebuggingSupportedContext : MockContext {
MockUnrestrictiveDebuggingSupportedContext();
std::unique_ptr<UltClDeviceFactory> ultClDeviceFactory;
MockClDevice *pRootDevice;
ClDevice *pSubDevice0 = nullptr;
ClDevice *pSubDevice1 = nullptr;
};
struct MockUnrestrictiveContextMultiGPU : MockContext {
MockUnrestrictiveContextMultiGPU();

View File

@@ -18,6 +18,7 @@
#include "shared/test/common/mocks/mock_csr.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/platform/platform.h"
@@ -725,7 +726,9 @@ TEST(ProgramStringSectionTest, WhenConstStringBufferIsPresentThenUseItForLinking
program.getKernelInfoArray(rootDeviceIndex).clear();
}
TEST(ProgramImplicitArgsTest, givenImplicitRelocationAndStackCallsThenKernelRequiresImplicitArgs) {
using ProgramImplicitArgsTest = ::testing::Test;
TEST_F(ProgramImplicitArgsTest, givenImplicitRelocationAndStackCallsThenKernelRequiresImplicitArgs) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
auto rootDeviceIndex = device->getRootDeviceIndex();
MockProgram program{nullptr, false, toClDeviceVector(*device)};
@@ -750,13 +753,14 @@ TEST(ProgramImplicitArgsTest, givenImplicitRelocationAndStackCallsThenKernelRequ
program.getKernelInfoArray(rootDeviceIndex).clear();
}
TEST(ProgramImplicitArgsTest, givenImplicitRelocationAndEnabledDebuggerThenKernelRequiresImplicitArgs) {
if (!defaultHwInfo->capabilityTable.debuggerSupported) {
GTEST_SKIP();
}
HWTEST2_F(ProgramImplicitArgsTest, givenImplicitRelocationAndEnabledDebuggerThenKernelRequiresImplicitArgs, HasSourceLevelDebuggerSupport) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableMockSourceLevelDebugger.set(1);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
hwInfo.capabilityTable.debuggerSupported = true;
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0u));
EXPECT_NE(nullptr, device->getDebugger());
auto rootDeviceIndex = device->getRootDeviceIndex();
@@ -782,7 +786,7 @@ TEST(ProgramImplicitArgsTest, givenImplicitRelocationAndEnabledDebuggerThenKerne
program.getKernelInfoArray(rootDeviceIndex).clear();
}
TEST(ProgramImplicitArgsTest, givenImplicitRelocationAndNoStackCallsAndDisabledDebuggerThenKernelDoesntRequireImplicitArgs) {
TEST_F(ProgramImplicitArgsTest, givenImplicitRelocationAndNoStackCallsAndDisabledDebuggerThenKernelDoesntRequireImplicitArgs) {
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
EXPECT_EQ(nullptr, device->getDebugger());
auto rootDeviceIndex = device->getRootDeviceIndex();

View File

@@ -93,10 +93,6 @@ class ProgramWithKernelDebuggingFixture {
void setUp() {
pDevice = static_cast<MockDevice *>(&mockContext.getDevice(0)->getDevice());
if (!pDevice->getHardwareInfo().capabilityTable.debuggerSupported) {
GTEST_SKIP();
}
std::string filename;
std::string kernelOption(CompilerOptions::debugKernelEnable);
KernelFilenameHelper::getKernelFilenameFromInternalOption(kernelOption, filename);
@@ -106,21 +102,21 @@ class ProgramWithKernelDebuggingFixture {
void tearDown() {}
MockUnrestrictiveContext mockContext;
MockUnrestrictiveDebuggingSupportedContext mockContext;
std::unique_ptr<MockDebugProgram> program = nullptr;
MockDevice *pDevice = nullptr;
};
using ProgramWithKernelDebuggingTest = Test<ProgramWithKernelDebuggingFixture>;
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenInternalOptionsIncludeDebugFlag) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenInternalOptionsIncludeDebugFlag, HasSourceLevelDebuggerSupport) {
cl_int retVal = program->compile(program->getDevices(), nullptr,
0, nullptr, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_TRUE(CompilerOptions::contains(program->compilerInterface->buildInternalOptions, CompilerOptions::debugKernelEnable));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenInternalOptionsIncludeDashGFlag) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenInternalOptionsIncludeDashGFlag, HasSourceLevelDebuggerSupport) {
cl_int retVal = program->compile(program->getDevices(), nullptr,
0, nullptr, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
@@ -128,7 +124,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompi
EXPECT_TRUE(hasSubstr(program->getOptions(), "-g"));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhenProgramIsCompiledThenOptionsIncludeClOptDisableFlag) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhenProgramIsCompiledThenOptionsIncludeClOptDisableFlag, HasSourceLevelDebuggerSupport) {
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->isOptDisabled = true;
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
@@ -139,7 +135,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhen
EXPECT_TRUE(hasSubstr(program->getOptions(), CompilerOptions::optDisable.data()));
}
TEST_F(ProgramWithKernelDebuggingTest, GivenDebugVarDebuggerOptDisableZeroWhenOptDisableIsTrueFromDebuggerThenOptDisableIsNotAdded) {
HWTEST2_F(ProgramWithKernelDebuggingTest, GivenDebugVarDebuggerOptDisableZeroWhenOptDisableIsTrueFromDebuggerThenOptDisableIsNotAdded, HasSourceLevelDebuggerSupport) {
DebugManagerStateRestore dgbRestorer;
NEO::DebugManager.flags.DebuggerOptDisable.set(0);
@@ -153,7 +149,7 @@ TEST_F(ProgramWithKernelDebuggingTest, GivenDebugVarDebuggerOptDisableZeroWhenOp
EXPECT_FALSE(hasSubstr(program->getOptions(), CompilerOptions::optDisable.data()));
}
TEST_F(ProgramWithKernelDebuggingTest, GivenDebugVarDebuggerOptDisableOneWhenOptDisableIsFalseFromDebuggerThenOptDisableIsAdded) {
HWTEST2_F(ProgramWithKernelDebuggingTest, GivenDebugVarDebuggerOptDisableOneWhenOptDisableIsFalseFromDebuggerThenOptDisableIsAdded, HasSourceLevelDebuggerSupport) {
DebugManagerStateRestore dgbRestorer;
NEO::DebugManager.flags.DebuggerOptDisable.set(1);
@@ -167,7 +163,7 @@ TEST_F(ProgramWithKernelDebuggingTest, GivenDebugVarDebuggerOptDisableOneWhenOpt
EXPECT_TRUE(hasSubstr(program->getOptions(), CompilerOptions::optDisable.data()));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenOptionsStartsWithDashSFilename) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledThenOptionsStartsWithDashSFilename, HasSourceLevelDebuggerSupport) {
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->sourceCodeFilename = "debugFileName";
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
@@ -178,7 +174,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompi
EXPECT_TRUE(startsWith(program->getOptions(), "-s \"debugFileName\""));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledWithCmCOptionThenDashSFilenameIsNotPrepended) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompiledWithCmCOptionThenDashSFilenameIsNotPrepended, HasSourceLevelDebuggerSupport) {
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->sourceCodeFilename = "debugFileName";
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
@@ -191,19 +187,21 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsCompi
EXPECT_TRUE(hasSubstr(program->getOptions(), CompilerOptions::optDisable.data()));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenInternalOptionsIncludeDebugFlag) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenInternalOptionsIncludeDebugFlag, HasSourceLevelDebuggerSupport) {
cl_int retVal = program->build(program->getDevices(), nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_TRUE(CompilerOptions::contains(program->compilerInterface->buildInternalOptions, CompilerOptions::debugKernelEnable));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenOptionsIncludeDashGFlag) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenOptionsIncludeDashGFlag, HasSourceLevelDebuggerSupport) {
cl_int retVal = program->build(program->getDevices(), nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_TRUE(hasSubstr(program->getOptions(), "-g"));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhenProgramIsBuiltThenOptionsIncludeClOptDisableFlag) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhenProgramIsBuiltThenOptionsIncludeClOptDisableFlag, HasSourceLevelDebuggerSupport) {
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->isOptDisabled = true;
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
@@ -213,7 +211,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugAndOptDisabledWhen
EXPECT_TRUE(hasSubstr(program->getOptions(), CompilerOptions::optDisable.data()));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenOptionsStartsWithDashSFilename) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenOptionsStartsWithDashSFilename, HasSourceLevelDebuggerSupport) {
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->sourceCodeFilename = "debugFileName";
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
@@ -223,7 +221,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuilt
EXPECT_TRUE(startsWith(program->getOptions(), "-s \"debugFileName\""));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltWithCmCOptionThenDashSFilenameIsNotPrepended) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltWithCmCOptionThenDashSFilenameIsNotPrepended, HasSourceLevelDebuggerSupport) {
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
sourceLevelDebugger->sourceCodeFilename = "debugFileName";
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
@@ -234,7 +232,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuilt
EXPECT_FALSE(startsWith(program->getOptions(), "-s debugFileName"));
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinkedThenKernelDebugOptionsAreAppended) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinkedThenKernelDebugOptionsAreAppended, HasSourceLevelDebuggerSupport) {
MockActiveSourceLevelDebugger *sourceLevelDebugger = new MockActiveSourceLevelDebugger;
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
@@ -253,7 +251,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinke
EXPECT_EQ(static_cast<unsigned int>(mockContext.getRootDeviceIndices().size()), newProgram->appendKernelDebugOptionsCalled);
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenDebuggerIsNotifiedWithKernelDebugData) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuiltThenDebuggerIsNotifiedWithKernelDebugData, HasSourceLevelDebuggerSupport) {
const size_t rootDeviceIndicesSize = mockContext.getRootDeviceIndices().size();
std::vector<MockSourceLevelDebugger *> sourceLevelDebugger(rootDeviceIndicesSize, nullptr);
size_t i = 0;
@@ -279,7 +277,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsBuilt
}
}
TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinkedThenDebuggerIsNotifiedWithKernelDebugData) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinkedThenDebuggerIsNotifiedWithKernelDebugData, HasSourceLevelDebuggerSupport) {
const size_t rootDeviceIndicesSize = mockContext.getRootDeviceIndices().size();
std::vector<MockSourceLevelDebugger *> sourceLevelDebugger(rootDeviceIndicesSize, nullptr);
size_t i = 0;
@@ -311,7 +309,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenEnabledKernelDebugWhenProgramIsLinke
}
}
TEST_F(ProgramWithKernelDebuggingTest, givenGtpinInitializedWhenCreatingProgramFromBinaryThenDebugDataIsAvailable) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenGtpinInitializedWhenCreatingProgramFromBinaryThenDebugDataIsAvailable, HasSourceLevelDebuggerSupport) {
bool gtpinInitializedBackup = NEO::isGTPinInitialized;
NEO::isGTPinInitialized = true;
auto retVal = program->build(program->getDevices(), CompilerOptions::debugKernelEnable.data());
@@ -322,7 +320,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenGtpinInitializedWhenCreatingProgramF
NEO::isGTPinInitialized = gtpinInitializedBackup;
}
TEST_F(ProgramWithKernelDebuggingTest, givenGtpinNotInitializedWhenCreatingProgramFromBinaryThenDebugDataINullptr) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenGtpinNotInitializedWhenCreatingProgramFromBinaryThenDebugDataINullptr, HasSourceLevelDebuggerSupport) {
bool gtpinInitializedBackup = NEO::isGTPinInitialized;
NEO::isGTPinInitialized = false;
program->kernelDebugEnabled = false;
@@ -334,7 +332,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenGtpinNotInitializedWhenCreatingProgr
NEO::isGTPinInitialized = gtpinInitializedBackup;
}
TEST_F(ProgramWithKernelDebuggingTest, givenKernelDebugEnabledWhenProgramIsBuiltThenDebugDataIsStored) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenKernelDebugEnabledWhenProgramIsBuiltThenDebugDataIsStored, HasSourceLevelDebuggerSupport) {
auto retVal = program->build(program->getDevices(), nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
@@ -343,7 +341,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenKernelDebugEnabledWhenProgramIsBuilt
EXPECT_NE(0u, program->getDebugDataSize(pDevice->getRootDeviceIndex()));
}
TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenProcessDebugDataIsCalledThenKernelInfosAreFilledWithDebugData) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenProcessDebugDataIsCalledThenKernelInfosAreFilledWithDebugData, HasSourceLevelDebuggerSupport) {
iOpenCL::SProgramDebugDataHeaderIGC debugDataHeader{};
debugDataHeader.NumberOfKernels = 1u;
@@ -381,7 +379,7 @@ TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithKernelDebugEnabledWhenPro
EXPECT_NE(nullptr, receivedKernelInfo->debugData.vIsa);
}
TEST_F(ProgramWithKernelDebuggingTest, givenProgramWithNonZebinaryFormatAndKernelDebugEnabledWhenProgramIsBuiltThenProcessDebugDataIsCalledAndDebuggerNotified) {
HWTEST2_F(ProgramWithKernelDebuggingTest, givenProgramWithNonZebinaryFormatAndKernelDebugEnabledWhenProgramIsBuiltThenProcessDebugDataIsCalledAndDebuggerNotified, HasSourceLevelDebuggerSupport) {
MockSourceLevelDebugger *sourceLevelDebugger = new MockSourceLevelDebugger;
pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->debugger.reset(sourceLevelDebugger);
program->enableKernelDebug();

View File

@@ -32,6 +32,15 @@ using namespace NEO;
using std::string;
using std::unique_ptr;
class SourceLevelDebuggerSupportedFixture : public ::testing::Test {
public:
void SetUp() override {
hwInfo.capabilityTable.debuggerSupported = true;
}
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
};
TEST(SourceLevelDebugger, whenSourceLevelDebuggerIsCreatedThenLegacyModeIsTrue) {
DebuggerLibraryRestore restore;
DebuggerLibrary::setLibraryAvailable(true);
@@ -40,54 +49,47 @@ TEST(SourceLevelDebugger, whenSourceLevelDebuggerIsCreatedThenLegacyModeIsTrue)
EXPECT_TRUE(debugger.isLegacy());
}
TEST(SourceLevelDebugger, givenPlatformWhenItIsCreatedThenSourceLevelDebuggerIsCreatedInExecutionEnvironment) {
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenPlatformWhenItIsCreatedThenSourceLevelDebuggerIsCreatedInExecutionEnvironment, HasSourceLevelDebuggerSupport) {
DebuggerLibraryRestore restore;
if (defaultHwInfo->capabilityTable.debuggerSupported) {
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
auto executionEnvironment = new ExecutionEnvironment();
MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices();
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices();
EXPECT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger);
}
EXPECT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger);
}
TEST(SourceLevelDebugger, givenPlatformWhenSourceLevelDebuggerIsCreatedThenRuntimeCapabilityHasFusedEusDisabled) {
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenPlatformWhenSourceLevelDebuggerIsCreatedThenRuntimeCapabilityHasFusedEusDisabled, HasSourceLevelDebuggerSupport) {
DebuggerLibraryRestore restore;
if (defaultHwInfo->capabilityTable.debuggerSupported) {
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
auto executionEnvironment = new ExecutionEnvironment();
MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices();
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices();
ASSERT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger);
EXPECT_FALSE(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.fusedEuEnabled);
}
ASSERT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger);
EXPECT_FALSE(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.fusedEuEnabled);
}
TEST(SourceLevelDebugger, givenPlatformWhenInitializingSourceLevelDebuggerFailsThenRuntimeCapabilityFusedEusAreNotModified) {
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenPlatformWhenInitializingSourceLevelDebuggerFailsThenRuntimeCapabilityFusedEusAreNotModified, HasSourceLevelDebuggerSupport) {
DebuggerLibraryRestore restore;
if (defaultHwInfo->capabilityTable.debuggerSupported) {
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
interceptor.initRetVal = -1;
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
auto executionEnvironment = new ExecutionEnvironment();
MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices();
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
interceptor.initRetVal = -1;
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices();
bool defaultValue = defaultHwInfo->capabilityTable.fusedEuEnabled;
bool defaultValue = hwInfo.capabilityTable.fusedEuEnabled;
ASSERT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger);
EXPECT_EQ(defaultValue, executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.fusedEuEnabled);
}
ASSERT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger);
EXPECT_EQ(defaultValue, executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.fusedEuEnabled);
}
TEST(SourceLevelDebugger, givenNoKernelDebuggerLibraryWhenSourceLevelDebuggerIsCreatedThenLibraryIsNotLoaded) {
@@ -533,65 +535,63 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenInitializeIsCal
EXPECT_FALSE(interceptor.initCalled);
}
TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceIsConstructedThenDebuggerIsInitialized) {
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenKernelDebuggerLibraryActiveWhenDeviceIsConstructedThenDebuggerIsInitialized, HasSourceLevelDebuggerSupport) {
DebuggerLibraryRestore restore;
if (defaultHwInfo->capabilityTable.debuggerSupported) {
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
EXPECT_TRUE(interceptor.initCalled);
}
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0u));
EXPECT_TRUE(interceptor.initCalled);
}
TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreatedThenDebuggerIsNotified) {
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreatedThenDebuggerIsNotified, HasSourceLevelDebuggerSupport) {
DebuggerLibraryRestore restore;
if (defaultHwInfo->capabilityTable.debuggerSupported) {
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
unique_ptr<MockClDevice> pClDevice(new MockClDevice{device.get()});
EXPECT_TRUE(interceptor.newDeviceCalled);
uint32_t deviceHandleExpected = device->getGpgpuCommandStreamReceiver().getOSInterface() != nullptr ? device->getGpgpuCommandStreamReceiver().getOSInterface()->getDriverModel()->getDeviceHandle() : 0;
EXPECT_EQ(reinterpret_cast<GfxDeviceHandle>(static_cast<uint64_t>(deviceHandleExpected)), interceptor.newDeviceArgIn.dh);
pClDevice.reset();
device.release();
}
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
unique_ptr<MockDevice> device(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0u));
unique_ptr<MockClDevice> pClDevice(new MockClDevice{device.get()});
EXPECT_TRUE(interceptor.newDeviceCalled);
uint32_t deviceHandleExpected = device->getGpgpuCommandStreamReceiver().getOSInterface() != nullptr ? device->getGpgpuCommandStreamReceiver().getOSInterface()->getDriverModel()->getDeviceHandle() : 0;
EXPECT_EQ(reinterpret_cast<GfxDeviceHandle>(static_cast<uint64_t>(deviceHandleExpected)), interceptor.newDeviceArgIn.dh);
pClDevice.reset();
device.release();
}
TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreatedWithOsCsrThenDebuggerIsNotifiedWithCorrectDeviceHandle) {
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreatedWithOsCsrThenDebuggerIsNotifiedWithCorrectDeviceHandle, HasSourceLevelDebuggerSupport) {
DebuggerLibraryRestore restore;
if (defaultHwInfo->capabilityTable.debuggerSupported) {
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useHwCsr = true;
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useHwCsr = true;
HardwareInfo *hwInfo = nullptr;
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
HardwareInfo *hwInfo = nullptr;
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
hwInfo->capabilityTable.instrumentationEnabled = true;
unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0));
unique_ptr<MockClDevice> pClDevice(new MockClDevice{device.get()});
hwInfo->capabilityTable.debuggerSupported = true;
hwInfo->capabilityTable.instrumentationEnabled = true;
ASSERT_NE(nullptr, device->getGpgpuCommandStreamReceiver().getOSInterface());
unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0));
unique_ptr<MockClDevice> pClDevice(new MockClDevice{device.get()});
EXPECT_TRUE(interceptor.newDeviceCalled);
uint32_t deviceHandleExpected = device->getGpgpuCommandStreamReceiver().getOSInterface()->getDriverModel()->getDeviceHandle();
EXPECT_EQ(reinterpret_cast<GfxDeviceHandle>(static_cast<uint64_t>(deviceHandleExpected)), interceptor.newDeviceArgIn.dh);
device.release();
}
ASSERT_NE(nullptr, device->getGpgpuCommandStreamReceiver().getOSInterface());
EXPECT_TRUE(interceptor.newDeviceCalled);
uint32_t deviceHandleExpected = device->getGpgpuCommandStreamReceiver().getOSInterface()->getDriverModel()->getDeviceHandle();
EXPECT_EQ(reinterpret_cast<GfxDeviceHandle>(static_cast<uint64_t>(deviceHandleExpected)), interceptor.newDeviceArgIn.dh);
device.release();
}
TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenDeviceIsCreatedThenDebuggerIsNotCreatedInitializedAndNotNotified) {
@@ -609,6 +609,19 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenDeviceIsCreated
EXPECT_FALSE(interceptor.newDeviceCalled);
}
TEST(SourceLevelDebugger, givenDefaultStateWhenDeviceIsCreatedThenLoadDebuggerLibraryIsNotCalled) {
DebuggerLibraryRestore restore;
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(false);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
EXPECT_FALSE(interceptor.loadCalled);
}
TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenGettingSourceLevelDebuggerThenNullptrIsReturned) {
DebuggerLibraryRestore restore;
@@ -638,50 +651,46 @@ TEST(SourceLevelDebugger, givenDeviceWithDebuggerActiveSetWhenSourceLevelDebugge
EXPECT_FALSE(interceptor.deviceDestructionCalled);
}
TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenCreatingNewSourceLevelDebugger) {
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenTwoRootDevicesWhenSecondIsCreatedThenCreatingNewSourceLevelDebugger, HasSourceLevelDebuggerSupport) {
DebuggerLibraryRestore restore;
if (defaultHwInfo->capabilityTable.debuggerSupported) {
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
DebuggerLibraryInterceptor interceptor;
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor);
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(2);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
auto device1 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
EXPECT_NE(nullptr, executionEnvironment->memoryManager);
EXPECT_TRUE(interceptor.initCalled);
interceptor.initCalled = false;
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
EXPECT_NE(nullptr, executionEnvironment->memoryManager);
EXPECT_TRUE(interceptor.initCalled);
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(2);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(&hwInfo);
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
auto device1 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
EXPECT_NE(nullptr, executionEnvironment->memoryManager);
EXPECT_TRUE(interceptor.initCalled);
interceptor.initCalled = false;
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
EXPECT_NE(nullptr, executionEnvironment->memoryManager);
EXPECT_TRUE(interceptor.initCalled);
}
TEST(SourceLevelDebugger, givenMultipleRootDevicesWhenCreatedThenUseDedicatedSourceLevelDebugger) {
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenMultipleRootDevicesWhenCreatedThenUseDedicatedSourceLevelDebugger, HasSourceLevelDebuggerSupport) {
DebuggerLibraryRestore restore;
if (defaultHwInfo->capabilityTable.debuggerSupported) {
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
DebuggerLibrary::setLibraryAvailable(true);
DebuggerLibrary::setDebuggerActive(true);
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(2);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
auto device1 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
auto sourceLevelDebugger = device1->getDebugger();
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
EXPECT_NE(sourceLevelDebugger, device2->getDebugger());
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(2);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfoAndInitHelpers(&hwInfo);
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
auto device1 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
auto sourceLevelDebugger = device1->getDebugger();
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
EXPECT_NE(sourceLevelDebugger, device2->getDebugger());
}
TEST(SourceLevelDebugger, whenCaptureSBACalledThenNoCommandsAreAddedToStream) {
@@ -703,16 +712,13 @@ TEST(SourceLevelDebugger, whenGetSbaTrackingCommandsSizeQueriedThenZeroIsReturne
EXPECT_EQ(0u, size);
}
TEST(SourceLevelDebugger, givenEnableMockSourceLevelDebuggerWhenInitializingExecEnvThenActiveDebuggerWithEmptyInterfaceIsCreated) {
if (!defaultHwInfo->capabilityTable.debuggerSupported) {
GTEST_SKIP_("Source Level Debugger not supported");
}
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenEnableMockSourceLevelDebuggerWhenInitializingExecEnvThenActiveDebuggerWithEmptyInterfaceIsCreated, HasSourceLevelDebuggerSupport) {
DebugManagerStateRestore stateRestore;
DebuggerLibraryRestore restore;
DebuggerLibrary::setLibraryAvailable(false);
DebugManager.flags.EnableMockSourceLevelDebugger.set(1);
auto executionEnvironment = new ExecutionEnvironment();
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices();
@@ -751,10 +757,7 @@ TEST(SourceLevelDebugger, givenEnableMockSourceLevelDebuggerWhenInitializingExec
EXPECT_TRUE(debugger->notifyDeviceDestruction());
}
TEST(SourceLevelDebugger, givenMode1InEnableMockSourceLevelDebuggerWhenDebuggerCreatedThenIsOptimizationDisabledReturnsTrue) {
if (!defaultHwInfo->capabilityTable.debuggerSupported) {
GTEST_SKIP_("Source Level Debugger not supported");
}
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenMode1InEnableMockSourceLevelDebuggerWhenDebuggerCreatedThenIsOptimizationDisabledReturnsTrue, HasSourceLevelDebuggerSupport) {
DebugManagerStateRestore stateRestore;
DebuggerLibraryRestore restore;
DebuggerLibrary::setLibraryAvailable(false);
@@ -765,10 +768,7 @@ TEST(SourceLevelDebugger, givenMode1InEnableMockSourceLevelDebuggerWhenDebuggerC
EXPECT_TRUE(sld->isOptimizationDisabled());
}
TEST(SourceLevelDebugger, givenMode2InEnableMockSourceLevelDebuggerWhenDebuggerCreatedThenIsOptimizationDisabledReturnsFalse) {
if (!defaultHwInfo->capabilityTable.debuggerSupported) {
GTEST_SKIP_("Source Level Debugger not supported");
}
HWTEST2_F(SourceLevelDebuggerSupportedFixture, givenMode2InEnableMockSourceLevelDebuggerWhenDebuggerCreatedThenIsOptimizationDisabledReturnsFalse, HasSourceLevelDebuggerSupport) {
DebugManagerStateRestore stateRestore;
DebuggerLibraryRestore restore;
DebuggerLibrary::setLibraryAvailable(false);
@@ -889,7 +889,11 @@ HWTEST2_F(LegacyDebuggerTest, givenNotXeHpOrXeHpgCoreAndDebugIsActiveThenDisable
HWTEST2_F(LegacyDebuggerTest, givenXeHpOrXeHpgCoreAndDebugIsActiveThenDisableL3CacheInGmmHelperIsSet, IsXeHpOrXeHpgCore) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.EnableMockSourceLevelDebugger.set(1);
auto executionEnvironment = new ExecutionEnvironment();
auto hwInfo = *NEO::defaultHwInfo;
hwInfo.capabilityTable.debuggerSupported = true;
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices();

View File

@@ -30,6 +30,10 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XE_HP_COREDeviceCaps, givenKernelThatDoesStatelessW
EXPECT_EQ(statelessWritesEmitted, mockKernel.mockKernel->areStatelessWritesUsed());
}
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenXE_HP_COREThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
XE_HP_CORE_TEST_F(XE_HP_COREDeviceCaps, givenXE_HP_COREWhenCheckFtrSupportsInteger64BitAtomicsThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsInteger64BitAtomics);
}

View File

@@ -16,6 +16,10 @@ using namespace NEO;
typedef Test<ClDeviceFixture> XeHPUsDeviceIdTest;
XEHPTEST_F(XeHPUsDeviceIdTest, givenXeHPThenDebuggerIsNotSupported) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.debuggerSupported);
}
XEHPTEST_F(XeHPUsDeviceIdTest, WhenGettingHardwareInfoThenProductFamilyIsXeHpSdv) {
EXPECT_EQ(IGFX_XE_HP_SDV, pDevice->getHardwareInfo().platform.eProductFamily);
}