fix: Use debug SIP when debugging is enabled

Disable wMTP when debug is enabled

Related-to: NEO-10085

Signed-off-by: Brandon Yates <brandon.yates@intel.com>
This commit is contained in:
Brandon Yates
2024-01-16 19:42:54 +00:00
committed by Compute-Runtime-Automation
parent 7fbf724c72
commit f56eeb0eb7
3 changed files with 31 additions and 8 deletions

View File

@@ -237,12 +237,18 @@ void SipKernel::freeSipKernels(RootDeviceEnvironment *rootDeviceEnvironment, Mem
} }
} }
void SipKernel::selectSipClassType(std::string &fileName, const GfxCoreHelper &gfxCoreHelper) { void SipKernel::selectSipClassType(std::string &fileName, Device &device) {
const GfxCoreHelper &gfxCoreHelper = device.getGfxCoreHelper();
const std::string unknown("unk"); const std::string unknown("unk");
if (fileName.compare(unknown) == 0) { if (fileName.compare(unknown) == 0) {
SipKernel::classType = gfxCoreHelper.isSipKernelAsHexadecimalArrayPreferred() bool debuggingEnabled = device.getDebugger() != nullptr;
? SipClassType::hexadecimalHeaderFile if (debuggingEnabled) {
: SipClassType::builtins; SipKernel::classType = SipClassType::builtins;
} else {
SipKernel::classType = gfxCoreHelper.isSipKernelAsHexadecimalArrayPreferred()
? SipClassType::hexadecimalHeaderFile
: SipClassType::builtins;
}
} else { } else {
SipKernel::classType = SipClassType::rawBinaryFromFile; SipKernel::classType = SipClassType::rawBinaryFromFile;
} }
@@ -250,7 +256,7 @@ void SipKernel::selectSipClassType(std::string &fileName, const GfxCoreHelper &g
bool SipKernel::initSipKernelImpl(SipKernelType type, Device &device, OsContext *context) { bool SipKernel::initSipKernelImpl(SipKernelType type, Device &device, OsContext *context) {
std::string fileName = debugManager.flags.LoadBinarySipFromFile.get(); std::string fileName = debugManager.flags.LoadBinarySipFromFile.get();
SipKernel::selectSipClassType(fileName, device.getGfxCoreHelper()); SipKernel::selectSipClassType(fileName, device);
switch (SipKernel::classType) { switch (SipKernel::classType) {
case SipClassType::rawBinaryFromFile: case SipClassType::rawBinaryFromFile:

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2023 Intel Corporation * Copyright (C) 2018-2024 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -78,7 +78,7 @@ class SipKernel {
static std::string createHeaderFilename(const std::string &filename); static std::string createHeaderFilename(const std::string &filename);
static bool initHexadecimalArraySipKernel(SipKernelType type, Device &device); static bool initHexadecimalArraySipKernel(SipKernelType type, Device &device);
static void selectSipClassType(std::string &fileName, const GfxCoreHelper &gfxCoreHelper); static void selectSipClassType(std::string &fileName, Device &device);
const std::vector<char> stateSaveAreaHeader; const std::vector<char> stateSaveAreaHeader;
const std::vector<char> binary; const std::vector<char> binary;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021-2023 Intel Corporation * Copyright (C) 2021-2024 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -730,3 +730,20 @@ TEST(DebugBindlessSip, givenOfflineDebuggingModeWhenDebugSipForContextIsCreatedT
gEnvironment->igcPopDebugVars(); gEnvironment->igcPopDebugVars();
} }
class SipKernelMock : public SipKernel {
public:
using SipKernel::selectSipClassType;
};
using DebugBuiltinSipTest = Test<DeviceFixture>;
TEST_F(DebugBuiltinSipTest, givenDebuggerWhenInitSipKernelThenDbgSipIsLoadedFromBuiltin) {
pDevice->executionEnvironment->rootDeviceEnvironments[0]->initDebuggerL0(pDevice);
auto sipKernelType = SipKernel::getSipKernelType(*pDevice);
EXPECT_TRUE(SipKernel::initSipKernel(sipKernelType, *pDevice));
EXPECT_LE(SipKernelType::dbgCsr, sipKernelType);
auto sipAllocation = SipKernel::getSipKernel(*pDevice, nullptr).getSipAllocation();
EXPECT_NE(nullptr, sipAllocation);
EXPECT_EQ(SipKernelMock::classType, SipClassType::builtins);
}