mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Switch to new compiler interface to get system routine
Related-To: NEO-4773
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
3ca77a6cbe
commit
0eb10d7505
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -1007,15 +1007,7 @@ TEST_F(CompilerInterfaceTest, whenCompilerIsNotAvailableThenGetSipKernelBinaryFa
|
||||
EXPECT_EQ(0U, sipBinary.size());
|
||||
}
|
||||
|
||||
TEST_F(CompilerInterfaceTest, whenIgcTranslatorReturnsNullptrThenGetSipKernelBinaryFailsGracefully) {
|
||||
pCompilerInterface->failCreateIgcTranslationCtx = true;
|
||||
std::vector<char> sipBinary;
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary);
|
||||
EXPECT_EQ(TranslationOutput::ErrorCode::UnknownError, err);
|
||||
EXPECT_EQ(0U, sipBinary.size());
|
||||
}
|
||||
|
||||
TEST_F(CompilerInterfaceTest, whenIgcTranslatorReturnsBuildErrorThenGetSipKernelBinaryFailsGracefully) {
|
||||
TEST_F(CompilerInterfaceTest, whenIgcReturnsErrorThenGetSipKernelBinaryFailsGracefully) {
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
igcDebugVars.forceBuildFailure = true;
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
@ -1040,22 +1032,36 @@ TEST_F(CompilerInterfaceTest, whenEverythingIsOkThenGetSipKernelReturnsIgcsOutpu
|
||||
gEnvironment->igcPopDebugVars();
|
||||
}
|
||||
|
||||
TEST_F(CompilerInterfaceTest, whenRequestingSipKernelBinaryThenProperInternalOptionsAndSrcAreUsed) {
|
||||
std::string receivedInternalOptions;
|
||||
std::string receivedInput;
|
||||
|
||||
TEST_F(CompilerInterfaceTest, whenRequestingSipKernelBinaryThenProperSystemRoutineIsSelectedFromCompiler) {
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBuffer_simd16_", ".bc");
|
||||
igcDebugVars.receivedInternalOptionsOutput = &receivedInternalOptions;
|
||||
igcDebugVars.receivedInput = &receivedInput;
|
||||
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(0, strcmp(getSipKernelCompilerInternalOptions(SipKernelType::Csr), receivedInternalOptions.c_str()));
|
||||
std::string expectedInut = getSipLlSrc(*this->pDevice);
|
||||
EXPECT_EQ(0, strcmp(expectedInut.c_str(), receivedInput.c_str()));
|
||||
EXPECT_EQ(IGC::SystemRoutineType::contextSaveRestore, getIgcDebugVars().typeOfSystemRoutine);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
gEnvironment->igcPopDebugVars();
|
||||
}
|
||||
|
||||
TEST_F(CompilerInterfaceTest, whenRequestingIvalidSipKernelBinaryThenErrorIsReturned) {
|
||||
MockCompilerDebugVars igcDebugVars;
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
std::vector<char> sipBinary;
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::COUNT, sipBinary);
|
||||
EXPECT_EQ(TranslationOutput::ErrorCode::UnknownError, err);
|
||||
EXPECT_EQ(0U, sipBinary.size());
|
||||
EXPECT_EQ(IGC::SystemRoutineType::undefined, getIgcDebugVars().typeOfSystemRoutine);
|
||||
|
||||
gEnvironment->igcPopDebugVars();
|
||||
}
|
||||
|
Reference in New Issue
Block a user