Refactor SipKernel

- add debug bindless SipKernelType

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2021-10-18 15:59:47 +00:00
committed by Compute-Runtime-Automation
parent d79317da35
commit 2fb8edb69f
14 changed files with 69 additions and 40 deletions

View File

@@ -1006,7 +1006,7 @@ TEST_F(CompilerInterfaceTest, whenCompilerIsNotAvailableThenGetSipKernelBinaryFa
pCompilerInterface->igcMain.reset();
std::vector<char> sipBinary;
std::vector<char> stateAreaHeader;
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, sipBinary, stateAreaHeader);
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
EXPECT_EQ(TranslationOutput::ErrorCode::CompilerNotAvailable, err);
EXPECT_EQ(0U, sipBinary.size());
}
@@ -1018,7 +1018,7 @@ TEST_F(CompilerInterfaceTest, whenIgcReturnsErrorThenGetSipKernelBinaryFailsGrac
std::vector<char> sipBinary;
std::vector<char> stateAreaHeader;
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, sipBinary, stateAreaHeader);
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
EXPECT_EQ(TranslationOutput::ErrorCode::UnknownError, err);
EXPECT_EQ(0U, sipBinary.size());
@@ -1031,7 +1031,7 @@ TEST_F(CompilerInterfaceTest, whenEverythingIsOkThenGetSipKernelReturnsIgcsOutpu
gEnvironment->igcPushDebugVars(igcDebugVars);
std::vector<char> sipBinary;
std::vector<char> stateAreaHeader;
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, sipBinary, stateAreaHeader);
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
EXPECT_NE(0U, sipBinary.size());
@@ -1043,17 +1043,17 @@ TEST_F(CompilerInterfaceTest, whenRequestingSipKernelBinaryThenProperSystemRouti
gEnvironment->igcPushDebugVars(igcDebugVars);
std::vector<char> sipBinary;
std::vector<char> stateAreaHeader;
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, sipBinary, stateAreaHeader);
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
EXPECT_NE(0U, sipBinary.size());
EXPECT_EQ(IGC::SystemRoutineType::contextSaveRestore, getIgcDebugVars().typeOfSystemRoutine);
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsr, false, sipBinary, stateAreaHeader);
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsr, sipBinary, stateAreaHeader);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
EXPECT_NE(0U, sipBinary.size());
EXPECT_EQ(IGC::SystemRoutineType::debug, getIgcDebugVars().typeOfSystemRoutine);
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsrLocal, false, sipBinary, stateAreaHeader);
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsrLocal, sipBinary, stateAreaHeader);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
EXPECT_NE(0U, sipBinary.size());
EXPECT_EQ(IGC::SystemRoutineType::debugSlm, getIgcDebugVars().typeOfSystemRoutine);
@@ -1061,29 +1061,27 @@ TEST_F(CompilerInterfaceTest, whenRequestingSipKernelBinaryThenProperSystemRouti
gEnvironment->igcPopDebugVars();
}
TEST_F(CompilerInterfaceTest, givenUseBindlessDebugSipWhenRequestingSipKernelBinaryThenProperSystemRoutineIsSelectedFromCompiler) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.UseBindlessDebugSip.set(true);
TEST_F(CompilerInterfaceTest, WhenRequestingBindlessDebugSipThenProperSystemRoutineIsSelectedFromCompiler) {
MockCompilerDebugVars igcDebugVars;
gEnvironment->igcPushDebugVars(igcDebugVars);
std::vector<char> sipBinary;
std::vector<char> stateAreaHeader;
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, sipBinary, stateAreaHeader);
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
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, false, sipBinary, stateAreaHeader);
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, false, sipBinary, stateAreaHeader);
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsrLocal, sipBinary, stateAreaHeader);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
EXPECT_NE(0U, sipBinary.size());
EXPECT_EQ(IGC::SystemRoutineType::debugSlm, getIgcDebugVars().typeOfSystemRoutine);
EXPECT_EQ(MockCompilerDebugVars::SipAddressingType::bindful, getIgcDebugVars().receivedSipAddressingType);
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgBindless, sipBinary, stateAreaHeader);
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);
gEnvironment->igcPopDebugVars();
@@ -1094,7 +1092,7 @@ TEST_F(CompilerInterfaceTest, whenRequestingInvalidSipKernelBinaryThenErrorIsRet
gEnvironment->igcPushDebugVars(igcDebugVars);
std::vector<char> sipBinary;
std::vector<char> stateAreaHeader;
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::COUNT, false, sipBinary, stateAreaHeader);
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::COUNT, sipBinary, stateAreaHeader);
EXPECT_EQ(TranslationOutput::ErrorCode::UnknownError, err);
EXPECT_EQ(0U, sipBinary.size());
EXPECT_EQ(IGC::SystemRoutineType::undefined, getIgcDebugVars().typeOfSystemRoutine);