Skip to content

Commit f56eeb0

Browse files
bmyatesCompute-Runtime-Automation
authored andcommitted
fix: Use debug SIP when debugging is enabled
Disable wMTP when debug is enabled Related-to: NEO-10085 Signed-off-by: Brandon Yates <[email protected]>
1 parent 7fbf724 commit f56eeb0

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

shared/source/built_ins/sip.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,20 +237,26 @@ void SipKernel::freeSipKernels(RootDeviceEnvironment *rootDeviceEnvironment, Mem
237237
}
238238
}
239239

240-
void SipKernel::selectSipClassType(std::string &fileName, const GfxCoreHelper &gfxCoreHelper) {
240+
void SipKernel::selectSipClassType(std::string &fileName, Device &device) {
241+
const GfxCoreHelper &gfxCoreHelper = device.getGfxCoreHelper();
241242
const std::string unknown("unk");
242243
if (fileName.compare(unknown) == 0) {
243-
SipKernel::classType = gfxCoreHelper.isSipKernelAsHexadecimalArrayPreferred()
244-
? SipClassType::hexadecimalHeaderFile
245-
: SipClassType::builtins;
244+
bool debuggingEnabled = device.getDebugger() != nullptr;
245+
if (debuggingEnabled) {
246+
SipKernel::classType = SipClassType::builtins;
247+
} else {
248+
SipKernel::classType = gfxCoreHelper.isSipKernelAsHexadecimalArrayPreferred()
249+
? SipClassType::hexadecimalHeaderFile
250+
: SipClassType::builtins;
251+
}
246252
} else {
247253
SipKernel::classType = SipClassType::rawBinaryFromFile;
248254
}
249255
}
250256

251257
bool SipKernel::initSipKernelImpl(SipKernelType type, Device &device, OsContext *context) {
252258
std::string fileName = debugManager.flags.LoadBinarySipFromFile.get();
253-
SipKernel::selectSipClassType(fileName, device.getGfxCoreHelper());
259+
SipKernel::selectSipClassType(fileName, device);
254260

255261
switch (SipKernel::classType) {
256262
case SipClassType::rawBinaryFromFile:

shared/source/built_ins/sip.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2023 Intel Corporation
2+
* Copyright (C) 2018-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -78,7 +78,7 @@ class SipKernel {
7878
static std::string createHeaderFilename(const std::string &filename);
7979

8080
static bool initHexadecimalArraySipKernel(SipKernelType type, Device &device);
81-
static void selectSipClassType(std::string &fileName, const GfxCoreHelper &gfxCoreHelper);
81+
static void selectSipClassType(std::string &fileName, Device &device);
8282

8383
const std::vector<char> stateSaveAreaHeader;
8484
const std::vector<char> binary;

shared/test/unit_test/built_ins/sip_tests.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Intel Corporation
2+
* Copyright (C) 2021-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -729,4 +729,21 @@ TEST(DebugBindlessSip, givenOfflineDebuggingModeWhenDebugSipForContextIsCreatedT
729729
EXPECT_EQ(high, patchedBinary[6]);
730730

731731
gEnvironment->igcPopDebugVars();
732+
}
733+
class SipKernelMock : public SipKernel {
734+
public:
735+
using SipKernel::selectSipClassType;
736+
};
737+
738+
using DebugBuiltinSipTest = Test<DeviceFixture>;
739+
740+
TEST_F(DebugBuiltinSipTest, givenDebuggerWhenInitSipKernelThenDbgSipIsLoadedFromBuiltin) {
741+
pDevice->executionEnvironment->rootDeviceEnvironments[0]->initDebuggerL0(pDevice);
742+
auto sipKernelType = SipKernel::getSipKernelType(*pDevice);
743+
EXPECT_TRUE(SipKernel::initSipKernel(sipKernelType, *pDevice));
744+
EXPECT_LE(SipKernelType::dbgCsr, sipKernelType);
745+
746+
auto sipAllocation = SipKernel::getSipKernel(*pDevice, nullptr).getSipAllocation();
747+
EXPECT_NE(nullptr, sipAllocation);
748+
EXPECT_EQ(SipKernelMock::classType, SipClassType::builtins);
732749
}

0 commit comments

Comments
 (0)