feature: add debug key to generate sip header file

- header file can be used with LoadBinarySipFromFile

Related-To: GSD-8253

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2024-03-06 12:30:11 +00:00
committed by Compute-Runtime-Automation
parent f71f6d2b72
commit cb7ac1ada0
4 changed files with 21 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#include "shared/source/built_ins/sip.h" #include "shared/source/built_ins/sip.h"
#include "shared/source/compiler_interface/compiler_interface.h" #include "shared/source/compiler_interface/compiler_interface.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/device/device.h" #include "shared/source/device/device.h"
#include "shared/source/execution_environment/execution_environment.h" #include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/execution_environment/root_device_environment.h"
@@ -45,6 +46,11 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) {
UNRECOVERABLE_IF(ret != TranslationOutput::ErrorCode::success); UNRECOVERABLE_IF(ret != TranslationOutput::ErrorCode::success);
UNRECOVERABLE_IF(sipBinary.size() == 0); UNRECOVERABLE_IF(sipBinary.size() == 0);
if (NEO::debugManager.flags.DumpSipHeaderFile.get() != "unk") {
std::string name = NEO::debugManager.flags.DumpSipHeaderFile.get() + "_header.bin";
writeDataToFile(name.c_str(), stateSaveAreaHeader.data(), stateSaveAreaHeader.size());
}
const auto allocType = AllocationType::kernelIsaInternal; const auto allocType = AllocationType::kernelIsaInternal;
AllocationProperties properties = {device.getRootDeviceIndex(), sipBinary.size(), allocType, device.getDeviceBitfield()}; AllocationProperties properties = {device.getRootDeviceIndex(), sipBinary.size(), allocType, device.getDeviceBitfield()};

View File

@@ -90,6 +90,7 @@ DECLARE_DEBUG_VARIABLE(std::string, ForceDeviceId, std::string("unk"), "Override
DECLARE_DEBUG_VARIABLE(std::string, FilterDeviceId, std::string("unk"), "Device id filter, adapter matching device id will be opened; ignored when unk") DECLARE_DEBUG_VARIABLE(std::string, FilterDeviceId, std::string("unk"), "Device id filter, adapter matching device id will be opened; ignored when unk")
DECLARE_DEBUG_VARIABLE(std::string, FilterBdfPath, std::string("unk"), "Linux-only, BDF path filter, only matching paths will be opened; ignored when unk") DECLARE_DEBUG_VARIABLE(std::string, FilterBdfPath, std::string("unk"), "Linux-only, BDF path filter, only matching paths will be opened; ignored when unk")
DECLARE_DEBUG_VARIABLE(std::string, LoadBinarySipFromFile, std::string("unk"), "Select binary file to load SIP kernel raw binary; when file named *_header.* exists, it is used as header") DECLARE_DEBUG_VARIABLE(std::string, LoadBinarySipFromFile, std::string("unk"), "Select binary file to load SIP kernel raw binary; when file named *_header.* exists, it is used as header")
DECLARE_DEBUG_VARIABLE(std::string, DumpSipHeaderFile, std::string("unk"), "Dumps binary file with sip header, value is used as NAME in filename: NAME_header.bin; ignored when unk")
DECLARE_DEBUG_VARIABLE(std::string, InjectInternalBuildOptions, std::string("unk"), "Append provided string to internal build options for user modules; ignored when unk") DECLARE_DEBUG_VARIABLE(std::string, InjectInternalBuildOptions, std::string("unk"), "Append provided string to internal build options for user modules; ignored when unk")
DECLARE_DEBUG_VARIABLE(std::string, InjectApiBuildOptions, std::string("unk"), "Append provided string to api build options for user modules; ignored when unk") DECLARE_DEBUG_VARIABLE(std::string, InjectApiBuildOptions, std::string("unk"), "Append provided string to api build options for user modules; ignored when unk")
DECLARE_DEBUG_VARIABLE(std::string, OverrideDeviceName, std::string("unk"), "Override device name to provided string; ignored when unk") DECLARE_DEBUG_VARIABLE(std::string, OverrideDeviceName, std::string("unk"), "Override device name to provided string; ignored when unk")

View File

@@ -37,6 +37,7 @@ ForceDeviceId = unk
FilterDeviceId = unk FilterDeviceId = unk
FilterBdfPath = unk FilterBdfPath = unk
LoadBinarySipFromFile = unk LoadBinarySipFromFile = unk
DumpSipHeaderFile = unk
InjectInternalBuildOptions = unk InjectInternalBuildOptions = unk
InjectApiBuildOptions = unk InjectApiBuildOptions = unk
OverrideCsrAllocationSize = -1 OverrideCsrAllocationSize = -1

View File

@@ -752,3 +752,16 @@ TEST_F(DebugBuiltinSipTest, givenDebuggerWhenInitSipKernelThenDbgSipIsLoadedFrom
EXPECT_NE(nullptr, sipAllocation); EXPECT_NE(nullptr, sipAllocation);
EXPECT_EQ(SipKernelMock::classType, SipClassType::builtins); EXPECT_EQ(SipKernelMock::classType, SipClassType::builtins);
} }
TEST_F(DebugBuiltinSipTest, givenDumpSipHeaderFileWhenGettingSipKernelThenSipHeaderFileIsCreated) {
DebugManagerStateRestore restorer;
NEO::debugManager.flags.DumpSipHeaderFile.set("sip");
pDevice->executionEnvironment->rootDeviceEnvironments[0]->initDebuggerL0(pDevice);
auto &builtins = *pDevice->getBuiltIns();
builtins.getSipKernel(SipKernelType::dbgCsr, *pDevice);
EXPECT_EQ(1u, NEO::virtualFileList.size());
EXPECT_TRUE(NEO::virtualFileList.find("sip_header.bin") != NEO::virtualFileList.end());
}