mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-31 12:11:31 +08:00
Add enable-kernel-debug option when debugger is used in L0
- correctly verify debug capabilites in Module Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
12669e897e
commit
718e4149a8
@@ -107,7 +107,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||
statePreemption = devicePreemption;
|
||||
|
||||
if (NEO::Debugger::isDebugEnabled(internalUsage) && !commandQueueDebugCmdsProgrammed) {
|
||||
debuggerCmdsSize += NEO::PreambleHelper<GfxFamily>::getKernelDebuggingCommandsSize(neoDevice->isDebuggerActive());
|
||||
debuggerCmdsSize += NEO::PreambleHelper<GfxFamily>::getKernelDebuggingCommandsSize(neoDevice->getSourceLevelDebugger() != nullptr);
|
||||
}
|
||||
|
||||
if (devicePreemption == NEO::PreemptionMode::MidThread) {
|
||||
@@ -227,7 +227,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||
programPipelineSelect(child);
|
||||
}
|
||||
|
||||
if (NEO::Debugger::isDebugEnabled(internalUsage) && !commandQueueDebugCmdsProgrammed && neoDevice->isDebuggerActive()) {
|
||||
if (NEO::Debugger::isDebugEnabled(internalUsage) && !commandQueueDebugCmdsProgrammed && neoDevice->getSourceLevelDebugger()) {
|
||||
NEO::PreambleHelper<GfxFamily>::programKernelDebugging(&child);
|
||||
commandQueueDebugCmdsProgrammed = true;
|
||||
}
|
||||
|
||||
@@ -584,8 +584,8 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, uint3
|
||||
device->getBuiltinFunctionsLib()->initImageFunctions();
|
||||
}
|
||||
auto hwInfo = neoDevice->getHardwareInfo();
|
||||
if (neoDevice->getPreemptionMode() == NEO::PreemptionMode::MidThread || neoDevice->isDebuggerActive()) {
|
||||
auto sipType = NEO::SipKernel::getSipKernelType(hwInfo.platform.eRenderCoreFamily, neoDevice->isDebuggerActive());
|
||||
if (neoDevice->getPreemptionMode() == NEO::PreemptionMode::MidThread || neoDevice->getDebugger()) {
|
||||
auto sipType = NEO::SipKernel::getSipKernelType(hwInfo.platform.eRenderCoreFamily, neoDevice->getDebugger());
|
||||
NEO::initSipKernel(sipType, *neoDevice);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,10 @@ bool ModuleTranslationUnit::buildFromSpirV(const char *input, uint32_t inputSize
|
||||
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, BuildOptions::debugKernelEnable);
|
||||
}
|
||||
|
||||
if (device->getL0Debugger()) {
|
||||
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, BuildOptions::debugKernelEnable);
|
||||
}
|
||||
|
||||
if (NEO::DebugManager.flags.DisableStatelessToStatefulOptimization.get()) {
|
||||
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired);
|
||||
}
|
||||
@@ -349,7 +353,7 @@ bool ModuleImp::initialize(const ze_module_desc_t *desc, NEO::Device *neoDevice)
|
||||
verifyDebugCapabilities();
|
||||
|
||||
this->updateBuildLog(neoDevice);
|
||||
if (debugEnabled) {
|
||||
if (debugEnabled && device->getSourceLevelDebugger()) {
|
||||
for (auto kernelInfo : this->translationUnit->programInfo.kernelInfos) {
|
||||
device->getSourceLevelDebugger()->notifyKernelDebugData(kernelInfo->kernelDescriptor.external.debugData.get(),
|
||||
kernelInfo->kernelDescriptor.kernelMetadata.kernelName,
|
||||
@@ -589,7 +593,7 @@ bool ModuleImp::isDebugEnabled() const {
|
||||
}
|
||||
|
||||
void ModuleImp::verifyDebugCapabilities() {
|
||||
bool debugCapabilities = device->getNEODevice()->isDebuggerActive();
|
||||
bool debugCapabilities = device->getNEODevice()->getDebugger() != nullptr;
|
||||
|
||||
if (debugCapabilities) {
|
||||
//verify all kernels are debuggable
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_l0_debugger.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_module.h"
|
||||
#include "level_zero/core/test/unit_tests/sources/debugger/l0_debugger_fixture.h"
|
||||
|
||||
#include "active_debugger_fixture.h"
|
||||
|
||||
@@ -169,5 +170,29 @@ HWTEST_F(KernelDebugSurfaceTest, givenDebuggerAndBindfulKernelWhenAppendingKerne
|
||||
EXPECT_EQ(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT, debugSurfaceState->getCoherencyType());
|
||||
}
|
||||
|
||||
using ModuleWithDebuggerL0Test = Test<L0DebuggerHwFixture>;
|
||||
TEST_F(ModuleWithDebuggerL0Test, givenDebuggingEnabledWhenModuleIsCreatedThenDebugOptionsAreUsed) {
|
||||
auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions();
|
||||
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->compilerInterface.reset(cip);
|
||||
|
||||
uint8_t binary[10];
|
||||
ze_module_desc_t moduleDesc = {};
|
||||
moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
|
||||
moduleDesc.pInputModule = binary;
|
||||
moduleDesc.inputSize = 10;
|
||||
|
||||
ModuleBuildLog *moduleBuildLog = nullptr;
|
||||
|
||||
auto module = std::unique_ptr<L0::ModuleImp>(new L0::ModuleImp(device, moduleBuildLog, ModuleType::User));
|
||||
ASSERT_NE(nullptr, module.get());
|
||||
module->initialize(&moduleDesc, neoDevice);
|
||||
|
||||
EXPECT_TRUE(module->isDebugEnabled());
|
||||
|
||||
EXPECT_TRUE(CompilerOptions::contains(cip->buildInternalOptions, L0::BuildOptions::debugKernelEnable));
|
||||
EXPECT_FALSE(CompilerOptions::contains(cip->buildOptions, NEO::CompilerOptions::generateDebugInfo));
|
||||
EXPECT_FALSE(CompilerOptions::contains(cip->buildOptions, L0::BuildOptions::optDisable));
|
||||
};
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user