Skip to content

Commit f00a2c9

Browse files
Add UseBindlessDebugSip debug variable
Signed-off-by: Mateusz Hoppe <[email protected]>
1 parent 8f87dfa commit f00a2c9

File tree

6 files changed

+43
-3
lines changed

6 files changed

+43
-3
lines changed

opencl/test/unit_test/mocks/mock_compilers.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ bool MockIgcOclDeviceCtx::GetSystemRoutine(IGC::SystemRoutineType::SystemRoutine
492492
CIF::Builtins::BufferSimple *stateSaveAreaHeaderInit) {
493493
MockCompilerDebugVars &debugVars = *NEO::igcDebugVars;
494494
debugVars.typeOfSystemRoutine = typeOfSystemRoutine;
495+
debugVars.receivedSipAddressingType = bindless ? MockCompilerDebugVars::SipAddressingType::bindless : MockCompilerDebugVars::SipAddressingType::bindful;
496+
495497
const char mockData[64] = {'C', 'T', 'N', 'I'};
496498

497499
if (debugVars.forceBuildFailure || typeOfSystemRoutine == IGC::SystemRoutineType::undefined) {

opencl/test/unit_test/mocks/mock_compilers.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2020 Intel Corporation
2+
* Copyright (C) 2017-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -21,6 +21,11 @@
2121
namespace NEO {
2222

2323
struct MockCompilerDebugVars {
24+
enum class SipAddressingType {
25+
unknown,
26+
bindful,
27+
bindless
28+
};
2429
bool forceBuildFailure = false;
2530
bool forceCreateFailure = false;
2631
bool forceRegisterFail = false;
@@ -35,6 +40,7 @@ struct MockCompilerDebugVars {
3540
bool failCreateIgcFeWaInterface = false;
3641
int64_t overrideFclDeviceCtxVersion = -1;
3742
IGC::SystemRoutineType::SystemRoutineType_t typeOfSystemRoutine = IGC::SystemRoutineType::undefined;
43+
SipAddressingType receivedSipAddressingType = SipAddressingType::unknown;
3844
std::string *receivedInternalOptionsOutput = nullptr;
3945
std::string *receivedInput = nullptr;
4046

opencl/test/unit_test/test_files/igdrcl.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,4 @@ DisableDeepBind = 0
219219
GpuScratchRegWriteAfterWalker = -1
220220
GpuScratchRegWriteRegisterData = 0
221221
GpuScratchRegWriteRegisterOffset = 0
222+
UseBindlessDebugSip = 0

shared/source/compiler_interface/compiler_interface.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,22 +309,25 @@ TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &
309309
}
310310

311311
IGC::SystemRoutineType::SystemRoutineType_t typeOfSystemRoutine = IGC::SystemRoutineType::undefined;
312+
bool debugSip = false;
312313
switch (type) {
313314
case SipKernelType::Csr:
314315
typeOfSystemRoutine = IGC::SystemRoutineType::contextSaveRestore;
315316
break;
316317
case SipKernelType::DbgCsr:
317318
typeOfSystemRoutine = IGC::SystemRoutineType::debug;
319+
debugSip = true;
318320
break;
319321
case SipKernelType::DbgCsrLocal:
320322
typeOfSystemRoutine = IGC::SystemRoutineType::debugSlm;
323+
debugSip = true;
321324
break;
322325
default:
323326
break;
324327
}
325328

326329
auto deviceCtx = getIgcDeviceCtx(device);
327-
const bool bindlessSip = false;
330+
bool bindlessSip = debugSip ? DebugManager.flags.UseBindlessDebugSip.get() : false;
328331

329332
auto systemRoutineBuffer = igcMain.get()->CreateBuiltin<CIF::Builtins::BufferLatest>();
330333
auto stateSaveAreaBuffer = igcMain.get()->CreateBuiltin<CIF::Builtins::BufferLatest>();

shared/source/debug_settings/debug_variables_base.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ DECLARE_DEBUG_VARIABLE(bool, ForcePipeControlPriorToWalker, false, "Allows to fo
5454
DECLARE_DEBUG_VARIABLE(bool, ZebinAppendElws, false, "Append crossthread data with enqueue local work size")
5555
DECLARE_DEBUG_VARIABLE(bool, ZebinIgnoreIcbeVersion, false, "Ignore IGC\'s ICBE version")
5656
DECLARE_DEBUG_VARIABLE(bool, UseExternalAllocatorForSshAndDsh, false, "Use 32 bit external Allocator for ssh and dsh in Level Zero")
57+
DECLARE_DEBUG_VARIABLE(bool, UseBindlessDebugSip, false, "Use bindless debug system routine")
5758
DECLARE_DEBUG_VARIABLE(std::string, ForceDeviceId, std::string("unk"), "DeviceId selected for testing")
5859
DECLARE_DEBUG_VARIABLE(int32_t, ForceL1Caching, -1, "-1: default, 0: disable, 1: enable, When set to true driver will program L1 cache policy for surface state and stateless accessess")
5960
DECLARE_DEBUG_VARIABLE(int32_t, ForceAuxTranslationEnabled, -1, "-1: default, 0: disabled, 1: enabled")

shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,34 @@ TEST_F(CompilerInterfaceTest, whenRequestingSipKernelBinaryThenProperSystemRouti
10541054
gEnvironment->igcPopDebugVars();
10551055
}
10561056

1057-
TEST_F(CompilerInterfaceTest, whenRequestingIvalidSipKernelBinaryThenErrorIsReturned) {
1057+
TEST_F(CompilerInterfaceTest, givenUseBindlessDebugSipWhenRequestingSipKernelBinaryThenProperSystemRoutineIsSelectedFromCompiler) {
1058+
DebugManagerStateRestore dbgRestore;
1059+
DebugManager.flags.UseBindlessDebugSip.set(true);
1060+
MockCompilerDebugVars igcDebugVars;
1061+
gEnvironment->igcPushDebugVars(igcDebugVars);
1062+
std::vector<char> sipBinary;
1063+
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary);
1064+
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
1065+
EXPECT_NE(0U, sipBinary.size());
1066+
EXPECT_EQ(IGC::SystemRoutineType::contextSaveRestore, getIgcDebugVars().typeOfSystemRoutine);
1067+
EXPECT_EQ(MockCompilerDebugVars::SipAddressingType::bindful, getIgcDebugVars().receivedSipAddressingType);
1068+
1069+
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsr, sipBinary);
1070+
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
1071+
EXPECT_NE(0U, sipBinary.size());
1072+
EXPECT_EQ(IGC::SystemRoutineType::debug, getIgcDebugVars().typeOfSystemRoutine);
1073+
EXPECT_EQ(MockCompilerDebugVars::SipAddressingType::bindless, getIgcDebugVars().receivedSipAddressingType);
1074+
1075+
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsrLocal, sipBinary);
1076+
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
1077+
EXPECT_NE(0U, sipBinary.size());
1078+
EXPECT_EQ(IGC::SystemRoutineType::debugSlm, getIgcDebugVars().typeOfSystemRoutine);
1079+
EXPECT_EQ(MockCompilerDebugVars::SipAddressingType::bindless, getIgcDebugVars().receivedSipAddressingType);
1080+
1081+
gEnvironment->igcPopDebugVars();
1082+
}
1083+
1084+
TEST_F(CompilerInterfaceTest, whenRequestingInvalidSipKernelBinaryThenErrorIsReturned) {
10581085
MockCompilerDebugVars igcDebugVars;
10591086
gEnvironment->igcPushDebugVars(igcDebugVars);
10601087
std::vector<char> sipBinary;

0 commit comments

Comments
 (0)