mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Add bindlessSip param to SIP queries
Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
84da4648cd
commit
43fdd90330
@ -12,7 +12,7 @@
|
||||
namespace L0 {
|
||||
namespace ult {
|
||||
|
||||
const NEO::SipKernel &MockBuiltins::getSipKernel(NEO::SipKernelType type, NEO::Device &device) {
|
||||
const NEO::SipKernel &MockBuiltins::getSipKernel(NEO::SipKernelType type, bool bindlessSip, NEO::Device &device) {
|
||||
if (!(sipKernel && sipKernel->getType() == type)) {
|
||||
sipKernel.reset(new NEO::SipKernel(type, allocation.get(), stateSaveAreaHeader));
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class MockBuiltins : public NEO::BuiltIns {
|
||||
MockBuiltins() : BuiltIns() {
|
||||
allocation.reset(new NEO::MockGraphicsAllocation());
|
||||
}
|
||||
const NEO::SipKernel &getSipKernel(NEO::SipKernelType type, NEO::Device &device) override;
|
||||
const NEO::SipKernel &getSipKernel(NEO::SipKernelType type, bool bindlessSip, NEO::Device &device) override;
|
||||
std::unique_ptr<NEO::SipKernel> sipKernel;
|
||||
std::unique_ptr<NEO::MockGraphicsAllocation> allocation;
|
||||
std::vector<char> stateSaveAreaHeader{'s', 's', 'a', 'h'};
|
||||
|
@ -67,4 +67,14 @@ TEST(DebugSip, givenBuiltInsWhenDbgCsrSipIsRequestedThenCorrectSipKernelIsReturn
|
||||
EXPECT_EQ(SipKernelType::DbgCsr, sipKernel.getType());
|
||||
}
|
||||
|
||||
TEST(DebugBindlessSip, givenBindlessDebugSipIsRequestedThenCorrectSipKernelIsReturned) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
EXPECT_NE(nullptr, mockDevice);
|
||||
|
||||
auto &sipKernel = NEO::SipKernel::getBindlessDebugSipKernel(*mockDevice);
|
||||
|
||||
EXPECT_NE(nullptr, &sipKernel);
|
||||
EXPECT_LE(SipKernelType::DbgCsr, sipKernel.getType());
|
||||
EXPECT_FALSE(sipKernel.getStateSaveAreaHeader().empty());
|
||||
}
|
||||
} // namespace SipKernelTests
|
||||
|
@ -31,6 +31,10 @@ BuiltIns::BuiltIns() {
|
||||
BuiltIns::~BuiltIns() = default;
|
||||
|
||||
const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) {
|
||||
return getSipKernel(type, false, device);
|
||||
}
|
||||
|
||||
const SipKernel &BuiltIns::getSipKernel(SipKernelType type, bool bindlessSip, Device &device) {
|
||||
uint32_t kernelId = static_cast<uint32_t>(type);
|
||||
UNRECOVERABLE_IF(kernelId >= static_cast<uint32_t>(SipKernelType::COUNT));
|
||||
auto &sipBuiltIn = this->sipKernels[kernelId];
|
||||
@ -41,7 +45,7 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) {
|
||||
auto compilerInteface = device.getCompilerInterface();
|
||||
UNRECOVERABLE_IF(compilerInteface == nullptr);
|
||||
|
||||
auto ret = compilerInteface->getSipKernelBinary(device, type, sipBinary, stateSaveAreaHeader);
|
||||
auto ret = compilerInteface->getSipKernelBinary(device, type, bindlessSip, sipBinary, stateSaveAreaHeader);
|
||||
|
||||
UNRECOVERABLE_IF(ret != TranslationOutput::ErrorCode::Success);
|
||||
UNRECOVERABLE_IF(sipBinary.size() == 0);
|
||||
|
@ -157,6 +157,7 @@ class BuiltIns {
|
||||
virtual ~BuiltIns();
|
||||
|
||||
MOCKABLE_VIRTUAL const SipKernel &getSipKernel(SipKernelType type, Device &device);
|
||||
MOCKABLE_VIRTUAL const SipKernel &getSipKernel(SipKernelType type, bool bindlessSip, Device &device);
|
||||
MOCKABLE_VIRTUAL void freeSipKernels(MemoryManager *memoryManager);
|
||||
|
||||
BuiltinsLib &getBuiltinsLib() {
|
||||
|
@ -42,6 +42,10 @@ const std::vector<char> &SipKernel::getStateSaveAreaHeader() const {
|
||||
|
||||
SipKernelType SipKernel::getSipKernelType(Device &device) {
|
||||
bool debuggingEnabled = device.getDebugger() != nullptr || device.isDebuggerActive();
|
||||
return getSipKernelType(device, debuggingEnabled);
|
||||
}
|
||||
|
||||
SipKernelType SipKernel::getSipKernelType(Device &device, bool debuggingEnabled) {
|
||||
auto &hwHelper = HwHelper::get(device.getHardwareInfo().platform.eRenderCoreFamily);
|
||||
return hwHelper.getSipKernelType(debuggingEnabled);
|
||||
}
|
||||
@ -143,4 +147,9 @@ const SipKernel &SipKernel::getSipKernelImpl(Device &device) {
|
||||
return device.getBuiltIns()->getSipKernel(sipType, device);
|
||||
}
|
||||
|
||||
const SipKernel &SipKernel::getBindlessDebugSipKernel(Device &device) {
|
||||
auto debugSipType = SipKernel::getSipKernelType(device, true);
|
||||
return device.getBuiltIns()->getSipKernel(debugSipType, true, device);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -39,7 +39,9 @@ class SipKernel {
|
||||
static void freeSipKernels(RootDeviceEnvironment *rootDeviceEnvironment, MemoryManager *memoryManager);
|
||||
|
||||
static const SipKernel &getSipKernel(Device &device);
|
||||
static const SipKernel &getBindlessDebugSipKernel(Device &device);
|
||||
static SipKernelType getSipKernelType(Device &device);
|
||||
static SipKernelType getSipKernelType(Device &device, bool debuggingEnable);
|
||||
|
||||
static const size_t maxDbgSurfaceSize;
|
||||
static SipClassType classType;
|
||||
|
@ -300,7 +300,7 @@ TranslationOutput::ErrorCode CompilerInterface::createLibrary(
|
||||
return TranslationOutput::ErrorCode::Success;
|
||||
}
|
||||
|
||||
TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector<char> &retBinary,
|
||||
TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &device, SipKernelType type, bool bindlessSip, std::vector<char> &retBinary,
|
||||
std::vector<char> &stateSaveAreaHeader) {
|
||||
if (false == isIgcAvailable()) {
|
||||
return TranslationOutput::ErrorCode::CompilerNotAvailable;
|
||||
@ -325,7 +325,7 @@ TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &
|
||||
}
|
||||
|
||||
auto deviceCtx = getIgcDeviceCtx(device);
|
||||
bool bindlessSip = debugSip ? DebugManager.flags.UseBindlessDebugSip.get() : false;
|
||||
bindlessSip |= debugSip ? DebugManager.flags.UseBindlessDebugSip.get() : false;
|
||||
|
||||
auto systemRoutineBuffer = igcMain.get()->CreateBuiltin<CIF::Builtins::BufferLatest>();
|
||||
auto stateSaveAreaBuffer = igcMain.get()->CreateBuiltin<CIF::Builtins::BufferLatest>();
|
||||
|
@ -133,7 +133,7 @@ class CompilerInterface {
|
||||
const TranslationInput &input,
|
||||
TranslationOutput &output);
|
||||
|
||||
MOCKABLE_VIRTUAL TranslationOutput::ErrorCode getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector<char> &retBinary,
|
||||
MOCKABLE_VIRTUAL TranslationOutput::ErrorCode getSipKernelBinary(NEO::Device &device, SipKernelType type, bool bindlessSip, std::vector<char> &retBinary,
|
||||
std::vector<char> &stateSaveAreaHeader);
|
||||
|
||||
protected:
|
||||
|
@ -114,14 +114,14 @@ class MockCompilerInterface : public CompilerInterface {
|
||||
return this->fclBaseTranslationCtx.get();
|
||||
}
|
||||
|
||||
TranslationOutput::ErrorCode getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector<char> &retBinary,
|
||||
TranslationOutput::ErrorCode getSipKernelBinary(NEO::Device &device, SipKernelType type, bool bindlessSip, std::vector<char> &retBinary,
|
||||
std::vector<char> &stateAreaHeader) override {
|
||||
if (this->sipKernelBinaryOverride.size() > 0) {
|
||||
retBinary = this->sipKernelBinaryOverride;
|
||||
this->requestedSipKernel = type;
|
||||
return TranslationOutput::ErrorCode::Success;
|
||||
} else {
|
||||
return CompilerInterface::getSipKernelBinary(device, type, retBinary, stateAreaHeader);
|
||||
return CompilerInterface::getSipKernelBinary(device, type, bindlessSip, retBinary, stateAreaHeader);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ TEST_F(CompilerInterfaceTest, whenCompilerIsNotAvailableThenGetSipKernelBinaryFa
|
||||
pCompilerInterface->igcMain.reset();
|
||||
std::vector<char> sipBinary;
|
||||
std::vector<char> stateAreaHeader;
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, sipBinary, stateAreaHeader);
|
||||
EXPECT_EQ(TranslationOutput::ErrorCode::CompilerNotAvailable, err);
|
||||
EXPECT_EQ(0U, sipBinary.size());
|
||||
}
|
||||
@ -1016,7 +1016,7 @@ TEST_F(CompilerInterfaceTest, whenIgcReturnsErrorThenGetSipKernelBinaryFailsGrac
|
||||
|
||||
std::vector<char> sipBinary;
|
||||
std::vector<char> stateAreaHeader;
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, sipBinary, stateAreaHeader);
|
||||
EXPECT_EQ(TranslationOutput::ErrorCode::UnknownError, err);
|
||||
EXPECT_EQ(0U, sipBinary.size());
|
||||
|
||||
@ -1029,7 +1029,7 @@ TEST_F(CompilerInterfaceTest, whenEverythingIsOkThenGetSipKernelReturnsIgcsOutpu
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
std::vector<char> sipBinary;
|
||||
std::vector<char> stateAreaHeader;
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, sipBinary, stateAreaHeader);
|
||||
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
|
||||
EXPECT_NE(0U, sipBinary.size());
|
||||
|
||||
@ -1041,17 +1041,17 @@ TEST_F(CompilerInterfaceTest, whenRequestingSipKernelBinaryThenProperSystemRouti
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
std::vector<char> sipBinary;
|
||||
std::vector<char> stateAreaHeader;
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, 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, sipBinary, stateAreaHeader);
|
||||
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);
|
||||
|
||||
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsrLocal, sipBinary, stateAreaHeader);
|
||||
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsrLocal, false, sipBinary, stateAreaHeader);
|
||||
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
|
||||
EXPECT_NE(0U, sipBinary.size());
|
||||
EXPECT_EQ(IGC::SystemRoutineType::debugSlm, getIgcDebugVars().typeOfSystemRoutine);
|
||||
@ -1066,19 +1066,19 @@ TEST_F(CompilerInterfaceTest, givenUseBindlessDebugSipWhenRequestingSipKernelBin
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
std::vector<char> sipBinary;
|
||||
std::vector<char> stateAreaHeader;
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader);
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, false, 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, sipBinary, stateAreaHeader);
|
||||
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, sipBinary, stateAreaHeader);
|
||||
err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsrLocal, false, sipBinary, stateAreaHeader);
|
||||
EXPECT_EQ(TranslationOutput::ErrorCode::Success, err);
|
||||
EXPECT_NE(0U, sipBinary.size());
|
||||
EXPECT_EQ(IGC::SystemRoutineType::debugSlm, getIgcDebugVars().typeOfSystemRoutine);
|
||||
@ -1092,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, sipBinary, stateAreaHeader);
|
||||
auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::COUNT, false, sipBinary, stateAreaHeader);
|
||||
EXPECT_EQ(TranslationOutput::ErrorCode::UnknownError, err);
|
||||
EXPECT_EQ(0U, sipBinary.size());
|
||||
EXPECT_EQ(IGC::SystemRoutineType::undefined, getIgcDebugVars().typeOfSystemRoutine);
|
||||
|
Reference in New Issue
Block a user