Add UseBindlessDebugSip debug variable

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2021-02-26 17:33:26 +00:00
committed by Compute-Runtime-Automation
parent 8f87dfaf0c
commit f00a2c9422
6 changed files with 43 additions and 3 deletions

View File

@@ -492,6 +492,8 @@ bool MockIgcOclDeviceCtx::GetSystemRoutine(IGC::SystemRoutineType::SystemRoutine
CIF::Builtins::BufferSimple *stateSaveAreaHeaderInit) { CIF::Builtins::BufferSimple *stateSaveAreaHeaderInit) {
MockCompilerDebugVars &debugVars = *NEO::igcDebugVars; MockCompilerDebugVars &debugVars = *NEO::igcDebugVars;
debugVars.typeOfSystemRoutine = typeOfSystemRoutine; debugVars.typeOfSystemRoutine = typeOfSystemRoutine;
debugVars.receivedSipAddressingType = bindless ? MockCompilerDebugVars::SipAddressingType::bindless : MockCompilerDebugVars::SipAddressingType::bindful;
const char mockData[64] = {'C', 'T', 'N', 'I'}; const char mockData[64] = {'C', 'T', 'N', 'I'};
if (debugVars.forceBuildFailure || typeOfSystemRoutine == IGC::SystemRoutineType::undefined) { if (debugVars.forceBuildFailure || typeOfSystemRoutine == IGC::SystemRoutineType::undefined) {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017-2020 Intel Corporation * Copyright (C) 2017-2021 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -21,6 +21,11 @@
namespace NEO { namespace NEO {
struct MockCompilerDebugVars { struct MockCompilerDebugVars {
enum class SipAddressingType {
unknown,
bindful,
bindless
};
bool forceBuildFailure = false; bool forceBuildFailure = false;
bool forceCreateFailure = false; bool forceCreateFailure = false;
bool forceRegisterFail = false; bool forceRegisterFail = false;
@@ -35,6 +40,7 @@ struct MockCompilerDebugVars {
bool failCreateIgcFeWaInterface = false; bool failCreateIgcFeWaInterface = false;
int64_t overrideFclDeviceCtxVersion = -1; int64_t overrideFclDeviceCtxVersion = -1;
IGC::SystemRoutineType::SystemRoutineType_t typeOfSystemRoutine = IGC::SystemRoutineType::undefined; IGC::SystemRoutineType::SystemRoutineType_t typeOfSystemRoutine = IGC::SystemRoutineType::undefined;
SipAddressingType receivedSipAddressingType = SipAddressingType::unknown;
std::string *receivedInternalOptionsOutput = nullptr; std::string *receivedInternalOptionsOutput = nullptr;
std::string *receivedInput = nullptr; std::string *receivedInput = nullptr;

View File

@@ -219,3 +219,4 @@ DisableDeepBind = 0
GpuScratchRegWriteAfterWalker = -1 GpuScratchRegWriteAfterWalker = -1
GpuScratchRegWriteRegisterData = 0 GpuScratchRegWriteRegisterData = 0
GpuScratchRegWriteRegisterOffset = 0 GpuScratchRegWriteRegisterOffset = 0
UseBindlessDebugSip = 0

View File

@@ -309,22 +309,25 @@ TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &
} }
IGC::SystemRoutineType::SystemRoutineType_t typeOfSystemRoutine = IGC::SystemRoutineType::undefined; IGC::SystemRoutineType::SystemRoutineType_t typeOfSystemRoutine = IGC::SystemRoutineType::undefined;
bool debugSip = false;
switch (type) { switch (type) {
case SipKernelType::Csr: case SipKernelType::Csr:
typeOfSystemRoutine = IGC::SystemRoutineType::contextSaveRestore; typeOfSystemRoutine = IGC::SystemRoutineType::contextSaveRestore;
break; break;
case SipKernelType::DbgCsr: case SipKernelType::DbgCsr:
typeOfSystemRoutine = IGC::SystemRoutineType::debug; typeOfSystemRoutine = IGC::SystemRoutineType::debug;
debugSip = true;
break; break;
case SipKernelType::DbgCsrLocal: case SipKernelType::DbgCsrLocal:
typeOfSystemRoutine = IGC::SystemRoutineType::debugSlm; typeOfSystemRoutine = IGC::SystemRoutineType::debugSlm;
debugSip = true;
break; break;
default: default:
break; break;
} }
auto deviceCtx = getIgcDeviceCtx(device); auto deviceCtx = getIgcDeviceCtx(device);
const bool bindlessSip = false; bool bindlessSip = debugSip ? DebugManager.flags.UseBindlessDebugSip.get() : false;
auto systemRoutineBuffer = igcMain.get()->CreateBuiltin<CIF::Builtins::BufferLatest>(); auto systemRoutineBuffer = igcMain.get()->CreateBuiltin<CIF::Builtins::BufferLatest>();
auto stateSaveAreaBuffer = igcMain.get()->CreateBuiltin<CIF::Builtins::BufferLatest>(); auto stateSaveAreaBuffer = igcMain.get()->CreateBuiltin<CIF::Builtins::BufferLatest>();

View File

@@ -54,6 +54,7 @@ DECLARE_DEBUG_VARIABLE(bool, ForcePipeControlPriorToWalker, false, "Allows to fo
DECLARE_DEBUG_VARIABLE(bool, ZebinAppendElws, false, "Append crossthread data with enqueue local work size") DECLARE_DEBUG_VARIABLE(bool, ZebinAppendElws, false, "Append crossthread data with enqueue local work size")
DECLARE_DEBUG_VARIABLE(bool, ZebinIgnoreIcbeVersion, false, "Ignore IGC\'s ICBE version") DECLARE_DEBUG_VARIABLE(bool, ZebinIgnoreIcbeVersion, false, "Ignore IGC\'s ICBE version")
DECLARE_DEBUG_VARIABLE(bool, UseExternalAllocatorForSshAndDsh, false, "Use 32 bit external Allocator for ssh and dsh in Level Zero") DECLARE_DEBUG_VARIABLE(bool, UseExternalAllocatorForSshAndDsh, false, "Use 32 bit external Allocator for ssh and dsh in Level Zero")
DECLARE_DEBUG_VARIABLE(bool, UseBindlessDebugSip, false, "Use bindless debug system routine")
DECLARE_DEBUG_VARIABLE(std::string, ForceDeviceId, std::string("unk"), "DeviceId selected for testing") DECLARE_DEBUG_VARIABLE(std::string, ForceDeviceId, std::string("unk"), "DeviceId selected for testing")
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") 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")
DECLARE_DEBUG_VARIABLE(int32_t, ForceAuxTranslationEnabled, -1, "-1: default, 0: disabled, 1: enabled") DECLARE_DEBUG_VARIABLE(int32_t, ForceAuxTranslationEnabled, -1, "-1: default, 0: disabled, 1: enabled")

View File

@@ -1054,7 +1054,34 @@ TEST_F(CompilerInterfaceTest, whenRequestingSipKernelBinaryThenProperSystemRouti
gEnvironment->igcPopDebugVars(); gEnvironment->igcPopDebugVars();
} }
TEST_F(CompilerInterfaceTest, whenRequestingIvalidSipKernelBinaryThenErrorIsReturned) { TEST_F(CompilerInterfaceTest, givenUseBindlessDebugSipWhenRequestingSipKernelBinaryThenProperSystemRoutineIsSelectedFromCompiler) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.UseBindlessDebugSip.set(true);
MockCompilerDebugVars igcDebugVars;
gEnvironment->igcPushDebugVars(igcDebugVars);
std::vector<char> sipBinary;
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
EXPECT_NE(0U, sipBinary.size());
EXPECT_EQ(IGC::SystemRoutineType::contextSaveRestore, getIgcDebugVars().typeOfSystemRoutine);
EXPECT_EQ(MockCompilerDebugVars::SipAddressingType::bindful, getIgcDebugVars().receivedSipAddressingType);
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsr, sipBinary);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
EXPECT_NE(0U, sipBinary.size());
EXPECT_EQ(IGC::SystemRoutineType::debug, getIgcDebugVars().typeOfSystemRoutine);
EXPECT_EQ(MockCompilerDebugVars::SipAddressingType::bindless, getIgcDebugVars().receivedSipAddressingType);
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsrLocal, sipBinary);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
EXPECT_NE(0U, sipBinary.size());
EXPECT_EQ(IGC::SystemRoutineType::debugSlm, getIgcDebugVars().typeOfSystemRoutine);
EXPECT_EQ(MockCompilerDebugVars::SipAddressingType::bindless, getIgcDebugVars().receivedSipAddressingType);
gEnvironment->igcPopDebugVars();
}
TEST_F(CompilerInterfaceTest, whenRequestingInvalidSipKernelBinaryThenErrorIsReturned) {
MockCompilerDebugVars igcDebugVars; MockCompilerDebugVars igcDebugVars;
gEnvironment->igcPushDebugVars(igcDebugVars); gEnvironment->igcPushDebugVars(igcDebugVars);
std::vector<char> sipBinary; std::vector<char> sipBinary;