From e35ffb06017a0f10d4032d753510174796ebf5c7 Mon Sep 17 00:00:00 2001 From: Matias Cabral Date: Tue, 30 Mar 2021 19:31:58 -0700 Subject: [PATCH] Retrieve state save area header from IGC Signed-off-by: Matias Cabral --- level_zero/core/source/debugger/debugger_l0.h | 14 +++++++- level_zero/core/source/device/device_imp.cpp | 8 +++++ .../test/unit_tests/mocks/mock_built_ins.cpp | 4 +-- .../test/unit_tests/mocks/mock_built_ins.h | 1 + .../sources/debugger/test_l0_debugger.cpp | 35 +++++++++++++++++++ .../unit_tests/sources/device/test_device.cpp | 25 +++++++++++++ opencl/test/unit_test/built_ins/sip_tests.cpp | 9 ++--- .../test/unit_test/mocks/mock_compilers.cpp | 6 ++-- shared/source/built_ins/built_ins.cpp | 5 +-- shared/source/built_ins/sip.cpp | 12 ++++++- shared/source/built_ins/sip.h | 5 ++- .../compiler_interface/compiler_interface.cpp | 5 ++- .../compiler_interface/compiler_interface.h | 5 +-- .../common/mocks/mock_compiler_interface.h | 5 +-- shared/test/common/mocks/mock_sip.cpp | 8 +++-- shared/test/common/mocks/mock_sip.h | 2 ++ .../compiler_interface_tests.cpp | 26 ++++++++------ 17 files changed, 145 insertions(+), 30 deletions(-) diff --git a/level_zero/core/source/debugger/debugger_l0.h b/level_zero/core/source/debugger/debugger_l0.h index 84b55e084c..1d9d579eb3 100644 --- a/level_zero/core/source/debugger/debugger_l0.h +++ b/level_zero/core/source/debugger/debugger_l0.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -47,6 +47,18 @@ struct DebugAreaHeader { uint16_t scratchEnd; uint64_t isShared : 1; }; +struct alignas(4) DebuggerVersion { + uint8_t major; + uint8_t minor; + uint16_t patch; +}; +struct alignas(8) StateSaveAreaHeader { + char magic[8] = "tssarea"; + uint64_t reserved1; + struct DebuggerVersion version; + uint8_t size; + uint8_t reserved2[3]; +}; #pragma pack() diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 312fc122fe..5f0dbb1627 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -645,6 +645,14 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, uint3 if (neoDevice->getPreemptionMode() == NEO::PreemptionMode::MidThread || neoDevice->getDebugger()) { auto sipType = NEO::SipKernel::getSipKernelType(hwInfo.platform.eRenderCoreFamily, neoDevice->getDebugger()); NEO::initSipKernel(sipType, *neoDevice); + + auto stateSaveAreaHeader = NEO::SipKernel::getSipStateSaveAreaHeader(*neoDevice); + if (debugSurface && stateSaveAreaHeader.size() > 0) { + auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily); + NEO::MemoryTransferHelper::transferMemoryToAllocation(hwHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *debugSurface), + *neoDevice, debugSurface, 0, stateSaveAreaHeader.data(), + stateSaveAreaHeader.size()); + } } } else { *returnValue = ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE; diff --git a/level_zero/core/test/unit_tests/mocks/mock_built_ins.cpp b/level_zero/core/test/unit_tests/mocks/mock_built_ins.cpp index 0d5885226a..fe9b5444d6 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_built_ins.cpp +++ b/level_zero/core/test/unit_tests/mocks/mock_built_ins.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2020 Intel Corporation + * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,7 +14,7 @@ namespace ult { const NEO::SipKernel &MockBuiltins::getSipKernel(NEO::SipKernelType type, NEO::Device &device) { if (!(sipKernel && sipKernel->getType() == type)) { - sipKernel.reset(new NEO::SipKernel(type, allocation.get())); + sipKernel.reset(new NEO::SipKernel(type, allocation.get(), stateSaveAreaHeader)); } return *sipKernel; diff --git a/level_zero/core/test/unit_tests/mocks/mock_built_ins.h b/level_zero/core/test/unit_tests/mocks/mock_built_ins.h index aeb960046f..01f2847c0f 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_built_ins.h +++ b/level_zero/core/test/unit_tests/mocks/mock_built_ins.h @@ -20,6 +20,7 @@ class MockBuiltins : public NEO::BuiltIns { const NEO::SipKernel &getSipKernel(NEO::SipKernelType type, NEO::Device &device) override; std::unique_ptr sipKernel; std::unique_ptr allocation; + std::vector stateSaveAreaHeader{'s', 's', 'a', 'h'}; }; } // namespace ult } // namespace L0 diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger.cpp index 1bcd068dd4..1e401557d0 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger.cpp @@ -48,6 +48,41 @@ TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingSipAllocationThenValidSipTypeIs EXPECT_EQ(expectedSipAllocation, systemRoutine); } +TEST_F(L0DebuggerTest, givenL0DebuggerWhenGettingStateSaveAreaHeaderThenValidSipTypeIsReturned) { + auto stateSaveAreaHeader = SipKernel::getSipStateSaveAreaHeader(*neoDevice); + + auto sipType = SipKernel::getSipKernelType(neoDevice->getHardwareInfo().platform.eRenderCoreFamily, true); + auto expectedStateSaveAreaHeader = neoDevice->getBuiltIns()->getSipKernel(sipType, *neoDevice).getStateSaveAreaHeader(); + + EXPECT_EQ(expectedStateSaveAreaHeader, stateSaveAreaHeader); +} + +TEST(Debugger, givenL0DebuggerOFFWhenGettingStateSaveAreaHeaderThenValidSipTypeIsReturned) { + auto executionEnvironment = new NEO::ExecutionEnvironment(); + auto mockBuiltIns = new MockBuiltins(); + executionEnvironment->prepareRootDeviceEnvironments(1); + executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns); + auto hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.featureTable.ftrLocalMemory = true; + executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo); + executionEnvironment->initializeMemoryManager(); + + auto neoDevice = NEO::MockDevice::create(executionEnvironment, 0u); + NEO::DeviceVector devices; + devices.push_back(std::unique_ptr(neoDevice)); + auto driverHandle = std::make_unique>(); + driverHandle->enableProgramDebugging = false; + + driverHandle->initialize(std::move(devices)); + + auto stateSaveAreaHeader = SipKernel::getSipStateSaveAreaHeader(*neoDevice); + + auto sipType = SipKernel::getSipKernelType(neoDevice->getHardwareInfo().platform.eRenderCoreFamily, false); + auto expectedStateSaveAreaHeader = neoDevice->getBuiltIns()->getSipKernel(sipType, *neoDevice).getStateSaveAreaHeader(); + + EXPECT_EQ(expectedStateSaveAreaHeader, stateSaveAreaHeader); +} + HWTEST_F(L0DebuggerTest, givenL0DebuggerWhenCreatedThenPerContextSbaTrackingBuffersAreAllocated) { auto debugger = device->getL0Debugger(); ASSERT_NE(nullptr, debugger); diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index feeb5e04b9..1d3142ef3d 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -21,6 +21,7 @@ #include "level_zero/core/source/cmdqueue/cmdqueue_imp.h" #include "level_zero/core/source/driver/driver_handle_imp.h" #include "level_zero/core/source/driver/host_pointer_manager.h" +#include "level_zero/core/test/unit_tests/mocks/mock_built_ins.h" #include "level_zero/core/test/unit_tests/mocks/mock_driver_handle.h" #include "gtest/gtest.h" @@ -81,6 +82,30 @@ TEST(L0DeviceTest, givenMidThreadPreemptionWhenCreatingDeviceThenSipKernelIsInit EXPECT_TRUE(NEO::MockSipData::called); } +TEST(L0DeviceTest, givenDebuggerEnabledButIGCNotReturnsSSAHThenSSAHIsNotCopied) { + NEO::MockCompilerEnableGuard mock(true); + auto executionEnvironment = new NEO::ExecutionEnvironment(); + auto mockBuiltIns = new MockBuiltins(); + mockBuiltIns->stateSaveAreaHeader.clear(); + + executionEnvironment->prepareRootDeviceEnvironments(1); + executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns); + auto hwInfo = *NEO::defaultHwInfo.get(); + hwInfo.featureTable.ftrLocalMemory = true; + executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo); + executionEnvironment->initializeMemoryManager(); + + auto neoDevice = NEO::MockDevice::create(executionEnvironment, 0u); + NEO::DeviceVector devices; + devices.push_back(std::unique_ptr(neoDevice)); + auto driverHandle = std::make_unique>(); + driverHandle->enableProgramDebugging = true; + + driverHandle->initialize(std::move(devices)); + auto stateSaveAreaHeader = NEO::SipKernel::getSipStateSaveAreaHeader(*neoDevice); + EXPECT_EQ(static_cast(0), stateSaveAreaHeader.size()); +} + TEST(L0DeviceTest, givenDisabledPreemptionWhenCreatingDeviceThenSipKernelIsNotInitialized) { ze_result_t returnValue = ZE_RESULT_SUCCESS; VariableBackup mockSipCalled(&NEO::MockSipData::called, false); diff --git a/opencl/test/unit_test/built_ins/sip_tests.cpp b/opencl/test/unit_test/built_ins/sip_tests.cpp index 63a35d9cfd..258f289076 100644 --- a/opencl/test/unit_test/built_ins/sip_tests.cpp +++ b/opencl/test/unit_test/built_ins/sip_tests.cpp @@ -21,16 +21,17 @@ using namespace NEO; namespace SipKernelTests { TEST(Sip, WhenGettingTypeThenCorrectTypeIsReturned) { - SipKernel csr{SipKernelType::Csr, nullptr}; + std::vector ssaHeader; + SipKernel csr{SipKernelType::Csr, nullptr, ssaHeader}; EXPECT_EQ(SipKernelType::Csr, csr.getType()); - SipKernel dbgCsr{SipKernelType::DbgCsr, nullptr}; + SipKernel dbgCsr{SipKernelType::DbgCsr, nullptr, ssaHeader}; EXPECT_EQ(SipKernelType::DbgCsr, dbgCsr.getType()); - SipKernel dbgCsrLocal{SipKernelType::DbgCsrLocal, nullptr}; + SipKernel dbgCsrLocal{SipKernelType::DbgCsrLocal, nullptr, ssaHeader}; EXPECT_EQ(SipKernelType::DbgCsrLocal, dbgCsrLocal.getType()); - SipKernel undefined{SipKernelType::COUNT, nullptr}; + SipKernel undefined{SipKernelType::COUNT, nullptr, ssaHeader}; EXPECT_EQ(SipKernelType::COUNT, undefined.getType()); } diff --git a/opencl/test/unit_test/mocks/mock_compilers.cpp b/opencl/test/unit_test/mocks/mock_compilers.cpp index d4b5b17a09..89cdafd0fc 100644 --- a/opencl/test/unit_test/mocks/mock_compilers.cpp +++ b/opencl/test/unit_test/mocks/mock_compilers.cpp @@ -494,13 +494,15 @@ bool MockIgcOclDeviceCtx::GetSystemRoutine(IGC::SystemRoutineType::SystemRoutine debugVars.typeOfSystemRoutine = typeOfSystemRoutine; debugVars.receivedSipAddressingType = bindless ? MockCompilerDebugVars::SipAddressingType::bindless : MockCompilerDebugVars::SipAddressingType::bindful; - const char mockData[64] = {'C', 'T', 'N', 'I'}; + const char mockData1[64] = {'C', 'T', 'N', 'I'}; + const char mockData2[64] = {'S', 'S', 'A', 'H'}; if (debugVars.forceBuildFailure || typeOfSystemRoutine == IGC::SystemRoutineType::undefined) { return false; } - outSystemRoutineBuffer->PushBackRawBytes(mockData, 64); + outSystemRoutineBuffer->PushBackRawBytes(mockData1, 64); + stateSaveAreaHeaderInit->PushBackRawBytes(mockData2, 64); return true; } diff --git a/shared/source/built_ins/built_ins.cpp b/shared/source/built_ins/built_ins.cpp index 21ed8e5950..b6a5f93c56 100644 --- a/shared/source/built_ins/built_ins.cpp +++ b/shared/source/built_ins/built_ins.cpp @@ -38,10 +38,11 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) { auto initializer = [&] { std::vector sipBinary; + std::vector stateSaveAareHeader; auto compilerInteface = device.getCompilerInterface(); UNRECOVERABLE_IF(compilerInteface == nullptr); - auto ret = compilerInteface->getSipKernelBinary(device, type, sipBinary); + auto ret = compilerInteface->getSipKernelBinary(device, type, sipBinary, stateSaveAareHeader); UNRECOVERABLE_IF(ret != TranslationOutput::ErrorCode::Success); UNRECOVERABLE_IF(sipBinary.size() == 0); @@ -61,7 +62,7 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) { device, sipAllocation, 0, sipBinary.data(), sipBinary.size()); } - sipBuiltIn.first.reset(new SipKernel(type, sipAllocation)); + sipBuiltIn.first.reset(new SipKernel(type, sipAllocation, std::move(stateSaveAareHeader))); }; std::call_once(sipBuiltIn.second, initializer); UNRECOVERABLE_IF(sipBuiltIn.first == nullptr); diff --git a/shared/source/built_ins/sip.cpp b/shared/source/built_ins/sip.cpp index dae8ff3477..e0877441d8 100644 --- a/shared/source/built_ins/sip.cpp +++ b/shared/source/built_ins/sip.cpp @@ -24,13 +24,17 @@ const size_t SipKernel::maxDbgSurfaceSize = 0x1800000; // proper value should be SipKernel::~SipKernel() = default; -SipKernel::SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc) : type(type), sipAllocation(sipAlloc) { +SipKernel::SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc, std::vector ssah) : type(type), sipAllocation(sipAlloc), stateSaveAreaHeader(ssah) { } GraphicsAllocation *SipKernel::getSipAllocation() const { return sipAllocation; } +const std::vector &SipKernel::getStateSaveAreaHeader() const { + return stateSaveAreaHeader; +} + SipKernelType SipKernel::getSipKernelType(GFXCORE_FAMILY family, bool debuggingActive) { auto &hwHelper = HwHelper::get(family); return hwHelper.getSipKernelType(debuggingActive); @@ -41,4 +45,10 @@ GraphicsAllocation *SipKernel::getSipKernelAllocation(Device &device) { auto sipType = SipKernel::getSipKernelType(device.getHardwareInfo().platform.eRenderCoreFamily, debuggingEnabled); return device.getBuiltIns()->getSipKernel(sipType, device).getSipAllocation(); } + +const std::vector &SipKernel::getSipStateSaveAreaHeader(Device &device) { + bool debuggingEnabled = device.getDebugger() != nullptr; + auto sipType = SipKernel::getSipKernelType(device.getHardwareInfo().platform.eRenderCoreFamily, debuggingEnabled); + return device.getBuiltIns()->getSipKernel(sipType, device).getStateSaveAreaHeader(); +} } // namespace NEO diff --git a/shared/source/built_ins/sip.h b/shared/source/built_ins/sip.h index fcebc5ffd2..8e106dc175 100644 --- a/shared/source/built_ins/sip.h +++ b/shared/source/built_ins/sip.h @@ -19,7 +19,7 @@ class GraphicsAllocation; class SipKernel { public: - SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc); + SipKernel(SipKernelType type, GraphicsAllocation *sipAlloc, std::vector ssah); SipKernel(const SipKernel &) = delete; SipKernel &operator=(const SipKernel &) = delete; SipKernel(SipKernel &&) = delete; @@ -33,11 +33,14 @@ class SipKernel { static const size_t maxDbgSurfaceSize; MOCKABLE_VIRTUAL GraphicsAllocation *getSipAllocation() const; + MOCKABLE_VIRTUAL const std::vector &getStateSaveAreaHeader() const; static SipKernelType getSipKernelType(GFXCORE_FAMILY family, bool debuggingActive); static GraphicsAllocation *getSipKernelAllocation(Device &device); + static const std::vector &getSipStateSaveAreaHeader(Device &device); protected: SipKernelType type = SipKernelType::COUNT; GraphicsAllocation *sipAllocation = nullptr; + const std::vector stateSaveAreaHeader; }; } // namespace NEO diff --git a/shared/source/compiler_interface/compiler_interface.cpp b/shared/source/compiler_interface/compiler_interface.cpp index d5eefa6b0c..9f2f8cfa3f 100644 --- a/shared/source/compiler_interface/compiler_interface.cpp +++ b/shared/source/compiler_interface/compiler_interface.cpp @@ -303,7 +303,8 @@ TranslationOutput::ErrorCode CompilerInterface::createLibrary( return TranslationOutput::ErrorCode::Success; } -TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector &retBinary) { +TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector &retBinary, + std::vector &stateSaveAreaHeader) { if (false == isIgcAvailable()) { return TranslationOutput::ErrorCode::CompilerNotAvailable; } @@ -342,6 +343,8 @@ TranslationOutput::ErrorCode CompilerInterface::getSipKernelBinary(NEO::Device & } retBinary.assign(systemRoutineBuffer->GetMemory(), systemRoutineBuffer->GetMemory() + systemRoutineBuffer->GetSizeRaw()); + stateSaveAreaHeader.assign(stateSaveAreaBuffer->GetMemory(), stateSaveAreaBuffer->GetMemory() + stateSaveAreaBuffer->GetSizeRaw()); + return TranslationOutput::ErrorCode::Success; } diff --git a/shared/source/compiler_interface/compiler_interface.h b/shared/source/compiler_interface/compiler_interface.h index 0aed26b573..7a04d87251 100644 --- a/shared/source/compiler_interface/compiler_interface.h +++ b/shared/source/compiler_interface/compiler_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2020 Intel Corporation + * Copyright (C) 2017-2021 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -133,7 +133,8 @@ class CompilerInterface { const TranslationInput &input, TranslationOutput &output); - MOCKABLE_VIRTUAL TranslationOutput::ErrorCode getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector &retBinary); + MOCKABLE_VIRTUAL TranslationOutput::ErrorCode getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector &retBinary, + std::vector &stateSaveAreaHeader); protected: MOCKABLE_VIRTUAL bool initialize(std::unique_ptr cache, bool requireFcl); diff --git a/shared/test/common/mocks/mock_compiler_interface.h b/shared/test/common/mocks/mock_compiler_interface.h index bc45d0623d..6a7637a0cc 100644 --- a/shared/test/common/mocks/mock_compiler_interface.h +++ b/shared/test/common/mocks/mock_compiler_interface.h @@ -114,13 +114,14 @@ class MockCompilerInterface : public CompilerInterface { return this->fclBaseTranslationCtx.get(); } - TranslationOutput::ErrorCode getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector &retBinary) override { + TranslationOutput::ErrorCode getSipKernelBinary(NEO::Device &device, SipKernelType type, std::vector &retBinary, + std::vector &stateAreaHeader) override { if (this->sipKernelBinaryOverride.size() > 0) { retBinary = this->sipKernelBinaryOverride; this->requestedSipKernel = type; return TranslationOutput::ErrorCode::Success; } else { - return CompilerInterface::getSipKernelBinary(device, type, retBinary); + return CompilerInterface::getSipKernelBinary(device, type, retBinary, stateAreaHeader); } } diff --git a/shared/test/common/mocks/mock_sip.cpp b/shared/test/common/mocks/mock_sip.cpp index 6a81bb107d..ebf6c2cfdc 100644 --- a/shared/test/common/mocks/mock_sip.cpp +++ b/shared/test/common/mocks/mock_sip.cpp @@ -19,7 +19,7 @@ #include namespace NEO { -MockSipKernel::MockSipKernel(SipKernelType type, GraphicsAllocation *sipAlloc) : SipKernel(type, sipAlloc) { +MockSipKernel::MockSipKernel(SipKernelType type, GraphicsAllocation *sipAlloc) : SipKernel(type, sipAlloc, {'s', 's', 'a', 'h'}) { this->mockSipMemoryAllocation = std::make_unique(0u, GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL, @@ -30,7 +30,7 @@ MockSipKernel::MockSipKernel(SipKernelType type, GraphicsAllocation *sipAlloc) : MemoryPool::System4KBPages, 3u); } -MockSipKernel::MockSipKernel() : SipKernel(SipKernelType::Csr, nullptr) { +MockSipKernel::MockSipKernel() : SipKernel(SipKernelType::Csr, nullptr, {'s', 's', 'a', 'h'}) { this->mockSipMemoryAllocation = std::make_unique(0u, GraphicsAllocation::AllocationType::KERNEL_ISA_INTERNAL, @@ -52,4 +52,8 @@ std::vector MockSipKernel::getDummyGenBinary() { GraphicsAllocation *MockSipKernel::getSipAllocation() const { return mockSipMemoryAllocation.get(); } + +const std::vector &MockSipKernel::getStateSaveAreaHeader() const { + return mockStateSaveAreaHeader; +} } // namespace NEO diff --git a/shared/test/common/mocks/mock_sip.h b/shared/test/common/mocks/mock_sip.h index 73f4605ccd..2ccda4d00a 100644 --- a/shared/test/common/mocks/mock_sip.h +++ b/shared/test/common/mocks/mock_sip.h @@ -29,8 +29,10 @@ class MockSipKernel : public SipKernel { static std::vector getDummyGenBinary(); GraphicsAllocation *getSipAllocation() const override; + const std::vector &getStateSaveAreaHeader() const override; std::unique_ptr mockSipMemoryAllocation; + const std::vector mockStateSaveAreaHeader = {'s', 's', 'a', 'h'}; MockExecutionEnvironment executionEnvironment; }; diff --git a/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp b/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp index 153bd3ec3d..7c467bcd6e 100644 --- a/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp +++ b/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp @@ -1002,7 +1002,8 @@ TEST_F(CompilerInterfaceTest, GivenCompilerWhenGettingCompilerAvailabilityThenCo TEST_F(CompilerInterfaceTest, whenCompilerIsNotAvailableThenGetSipKernelBinaryFailsGracefully) { pCompilerInterface->igcMain.reset(); std::vector sipBinary; - auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary); + std::vector stateAreaHeader; + auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader); EXPECT_EQ(TranslationOutput::ErrorCode::CompilerNotAvailable, err); EXPECT_EQ(0U, sipBinary.size()); } @@ -1013,7 +1014,8 @@ TEST_F(CompilerInterfaceTest, whenIgcReturnsErrorThenGetSipKernelBinaryFailsGrac gEnvironment->igcPushDebugVars(igcDebugVars); std::vector sipBinary; - auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary); + std::vector stateAreaHeader; + auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader); EXPECT_EQ(TranslationOutput::ErrorCode::UnknownError, err); EXPECT_EQ(0U, sipBinary.size()); @@ -1025,7 +1027,8 @@ TEST_F(CompilerInterfaceTest, whenEverythingIsOkThenGetSipKernelReturnsIgcsOutpu retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBuffer_simd16_", ".bc"); gEnvironment->igcPushDebugVars(igcDebugVars); std::vector sipBinary; - auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary); + std::vector stateAreaHeader; + auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary, stateAreaHeader); EXPECT_EQ(TranslationOutput::ErrorCode::Success, err); EXPECT_NE(0U, sipBinary.size()); @@ -1036,17 +1039,18 @@ TEST_F(CompilerInterfaceTest, whenRequestingSipKernelBinaryThenProperSystemRouti MockCompilerDebugVars igcDebugVars; gEnvironment->igcPushDebugVars(igcDebugVars); std::vector sipBinary; - auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary); + std::vector 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, sipBinary); + 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, sipBinary); + 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); @@ -1060,19 +1064,20 @@ TEST_F(CompilerInterfaceTest, givenUseBindlessDebugSipWhenRequestingSipKernelBin MockCompilerDebugVars igcDebugVars; gEnvironment->igcPushDebugVars(igcDebugVars); std::vector sipBinary; - auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::Csr, sipBinary); + std::vector 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, sipBinary); + 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); EXPECT_EQ(MockCompilerDebugVars::SipAddressingType::bindless, getIgcDebugVars().receivedSipAddressingType); - err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::DbgCsrLocal, sipBinary); + 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); @@ -1085,7 +1090,8 @@ TEST_F(CompilerInterfaceTest, whenRequestingInvalidSipKernelBinaryThenErrorIsRet MockCompilerDebugVars igcDebugVars; gEnvironment->igcPushDebugVars(igcDebugVars); std::vector sipBinary; - auto err = pCompilerInterface->getSipKernelBinary(*this->pDevice, SipKernelType::COUNT, sipBinary); + std::vector 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);