fix: Update SIP kernel initialization logic
Initialize SIP kernel when shared device is being initialized instead of api-specific device. Initialize debugger when shared device is being initialized instead of during platform or driver initialization. Add missing makeResident calls for SIP kernel in heapless paths. Related-To: HSD-18038645398, HSD-18038819112 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
parent
6ded319b0f
commit
2f6eaf149a
|
@ -1368,9 +1368,6 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
|
|||
|
||||
if (neoDevice->getDebugger() || neoDevice->getPreemptionMode() == NEO::PreemptionMode::MidThread) {
|
||||
if (neoDevice->getCompilerInterface()) {
|
||||
bool ret = NEO::SipKernel::initSipKernel(NEO::SipKernel::getSipKernelType(*neoDevice), *neoDevice);
|
||||
UNRECOVERABLE_IF(!ret);
|
||||
|
||||
if (rootDeviceEnvironment.executionEnvironment.getDebuggingMode() == NEO::DebuggingMode::offline) {
|
||||
if (NEO::SipKernel::getSipKernel(*neoDevice, nullptr).getCtxOffset() == 0) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
|
|
|
@ -226,14 +226,6 @@ void DriverHandleImp::updateRootDeviceBitFields(std::unique_ptr<NEO::Device> &ne
|
|||
entry->second = neoDevice->getDeviceBitfield();
|
||||
}
|
||||
|
||||
void DriverHandleImp::enableRootDeviceDebugger(std::unique_ptr<NEO::Device> &neoDevice) {
|
||||
if (enableProgramDebugging != NEO::DebuggingMode::disabled) {
|
||||
const auto rootDeviceIndex = neoDevice->getRootDeviceIndex();
|
||||
auto rootDeviceEnvironment = neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex].get();
|
||||
rootDeviceEnvironment->initDebuggerL0(neoDevice.get());
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t DriverHandleImp::initialize(std::vector<std::unique_ptr<NEO::Device>> neoDevices) {
|
||||
bool multiOsContextDriver = false;
|
||||
for (auto &neoDevice : neoDevices) {
|
||||
|
@ -251,15 +243,6 @@ ze_result_t DriverHandleImp::initialize(std::vector<std::unique_ptr<NEO::Device>
|
|||
|
||||
const auto rootDeviceIndex = neoDevice->getRootDeviceIndex();
|
||||
|
||||
auto osInterface = neoDevice->getRootDeviceEnvironment().osInterface.get();
|
||||
if (osInterface && !osInterface->isDebugAttachAvailable() && enableProgramDebugging != NEO::DebuggingMode::disabled) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Debug mode is not enabled in the system.\n");
|
||||
enableProgramDebugging = NEO::DebuggingMode::disabled;
|
||||
}
|
||||
|
||||
enableRootDeviceDebugger(neoDevice);
|
||||
|
||||
this->rootDeviceIndices.pushUnique(rootDeviceIndex);
|
||||
|
||||
this->deviceBitfields.insert({rootDeviceIndex, neoDevice->getDeviceBitfield()});
|
||||
|
|
|
@ -158,7 +158,6 @@ struct DriverHandleImp : public DriverHandle {
|
|||
RootDeviceIndicesContainer rootDeviceIndices;
|
||||
std::map<uint32_t, NEO::DeviceBitfield> deviceBitfields;
|
||||
void updateRootDeviceBitFields(std::unique_ptr<NEO::Device> &neoDevice);
|
||||
void enableRootDeviceDebugger(std::unique_ptr<NEO::Device> &neoDevice);
|
||||
|
||||
// Environment Variables
|
||||
NEO::DebuggingMode enableProgramDebugging = NEO::DebuggingMode::disabled;
|
||||
|
|
|
@ -415,40 +415,6 @@ HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndDebugAttachAvailableWhenIn
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledAndDebugAttachNotAvailableWhenInitializingDriverThenErrorIsPrintedButNotReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::debugManager.flags.PrintDebugMessages.set(1);
|
||||
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
auto osInterface = new OSInterface();
|
||||
auto drmMock = new DrmMockResources(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<Drm>(drmMock));
|
||||
|
||||
auto neoDevice = NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, 0u);
|
||||
|
||||
NEO::DeviceVector devices;
|
||||
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
|
||||
auto driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
|
||||
driverHandle->enableProgramDebugging = NEO::DebuggingMode::online;
|
||||
|
||||
drmMock->allowDebugAttach = false;
|
||||
|
||||
::testing::internal::CaptureStderr();
|
||||
ze_result_t result = driverHandle->initialize(std::move(devices));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
auto output = testing::internal::GetCapturedStderr();
|
||||
EXPECT_EQ(std::string("Debug mode is not enabled in the system.\n"), output);
|
||||
|
||||
EXPECT_EQ(NEO::DebuggingMode::disabled, driverHandle->enableProgramDebugging);
|
||||
EXPECT_EQ(nullptr, neoDevice->getL0Debugger());
|
||||
}
|
||||
|
||||
HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledWhenImmCommandListsCreatedAndDestroyedThenDebuggerL0IsNotified) {
|
||||
auto debuggerL0Hw = static_cast<MockDebuggerL0Hw<FamilyType> *>(device->getL0Debugger());
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ struct L0DebuggerWindowsFixture {
|
|||
void setUp() {
|
||||
debugManager.flags.ForcePreferredAllocationMethod.set(static_cast<int32_t>(GfxMemoryAllocationMethod::useUmdSystemPtr));
|
||||
executionEnvironment = new NEO::ExecutionEnvironment;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
auto osEnvironment = new OsEnvironmentWin();
|
||||
gdi = new MockGdi();
|
||||
|
@ -225,47 +225,5 @@ TEST_F(L0DebuggerWindowsTest, givenProgramDebuggingEnabledAndDebugAttachAvailabl
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
}
|
||||
|
||||
TEST_F(L0DebuggerWindowsTest, givenProgramDebuggingEnabledAndDebugAttachNotAvailableWhenInitializingDriverThenErrorIsPrintedButNotReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(&hwInfo);
|
||||
|
||||
WddmEuDebugInterfaceMock *wddm = new WddmEuDebugInterfaceMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
wddm->callBaseDestroyAllocations = false;
|
||||
wddm->callBaseMapGpuVa = false;
|
||||
wddm->callBaseWaitFromCpu = false;
|
||||
|
||||
auto osInterface = new OSInterface();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(osInterface);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
|
||||
wddm->init();
|
||||
executionEnvironment->memoryManager.reset(new MockWddmMemoryManager(*executionEnvironment));
|
||||
|
||||
auto neoDevice = NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, 0u);
|
||||
NEO::DeviceVector devices;
|
||||
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
|
||||
auto driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
|
||||
|
||||
driverHandle->enableProgramDebugging = NEO::DebuggingMode::online;
|
||||
wddm->debugAttachAvailable = false;
|
||||
|
||||
::testing::internal::CaptureStderr();
|
||||
|
||||
NEO::debugManager.flags.PrintDebugMessages.set(1);
|
||||
ze_result_t result = driverHandle->initialize(std::move(devices));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
|
||||
NEO::debugManager.flags.PrintDebugMessages.set(0);
|
||||
auto output = testing::internal::GetCapturedStderr();
|
||||
EXPECT_EQ(std::string("Debug mode is not enabled in the system.\n"), output);
|
||||
|
||||
EXPECT_EQ(NEO::DebuggingMode::disabled, driverHandle->enableProgramDebugging);
|
||||
EXPECT_EQ(nullptr, neoDevice->getL0Debugger());
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
|
|
@ -226,7 +226,6 @@ HWTEST2_F(DeviceCopyEngineTests, givenRootOrSubDeviceWhenAskingForCopyOrdinalThe
|
|||
|
||||
TEST(L0DeviceTest, givenMidThreadPreemptionWhenCreatingDeviceThenSipKernelIsInitialized) {
|
||||
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
VariableBackup<bool> mockSipCalled(&NEO::MockSipData::called, false);
|
||||
VariableBackup<NEO::SipKernelType> mockSipCalledType(&NEO::MockSipData::calledType, NEO::SipKernelType::count);
|
||||
VariableBackup<bool> backupSipInitType(&MockSipData::useMockSip, true);
|
||||
|
@ -237,12 +236,6 @@ TEST(L0DeviceTest, givenMidThreadPreemptionWhenCreatingDeviceThenSipKernelIsInit
|
|||
|
||||
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
|
||||
EXPECT_EQ(NEO::SipKernelType::count, NEO::MockSipData::calledType);
|
||||
EXPECT_FALSE(NEO::MockSipData::called);
|
||||
|
||||
auto device = std::unique_ptr<L0::Device>(Device::create(driverHandle.get(), neoDevice.release(), false, &returnValue));
|
||||
ASSERT_NE(nullptr, device);
|
||||
|
||||
EXPECT_EQ(NEO::SipKernelType::csr, NEO::MockSipData::calledType);
|
||||
EXPECT_TRUE(NEO::MockSipData::called);
|
||||
}
|
||||
|
@ -338,15 +331,16 @@ TEST(L0DeviceTest, givenDeviceWithoutAnyCompilerLibraryThenInvalidDependencyIsNo
|
|||
}
|
||||
|
||||
TEST(L0DeviceTest, givenDeviceWithoutIGCCompilerLibraryAndMidThreadPreemptionThenInvalidDependencyIsReturned) {
|
||||
DebugManagerStateRestore restore{};
|
||||
debugManager.flags.ForcePreemptionMode.set(PreemptionMode::MidThread);
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
|
||||
std::unique_ptr<DriverHandleImp> driverHandle(new DriverHandleImp);
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
|
||||
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
|
||||
auto oldIgcDllName = Os::igcDllName;
|
||||
Os::igcDllName = "_invalidIGC";
|
||||
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
auto mockDevice = reinterpret_cast<NEO::MockDevice *>(neoDevice.get());
|
||||
mockDevice->setPreemptionMode(NEO::PreemptionMode::MidThread);
|
||||
|
||||
|
@ -358,17 +352,18 @@ TEST(L0DeviceTest, givenDeviceWithoutIGCCompilerLibraryAndMidThreadPreemptionThe
|
|||
}
|
||||
|
||||
TEST(L0DeviceTest, givenDeviceWithoutAnyCompilerLibraryAndMidThreadPreemptionThenInvalidDependencyIsReturned) {
|
||||
DebugManagerStateRestore restore{};
|
||||
debugManager.flags.ForcePreemptionMode.set(PreemptionMode::MidThread);
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
|
||||
std::unique_ptr<DriverHandleImp> driverHandle(new DriverHandleImp);
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
|
||||
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
|
||||
auto oldFclDllName = Os::frontEndDllName;
|
||||
auto oldIgcDllName = Os::igcDllName;
|
||||
Os::frontEndDllName = "_invalidFCL";
|
||||
Os::igcDllName = "_invalidIGC";
|
||||
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
auto mockDevice = reinterpret_cast<NEO::MockDevice *>(neoDevice.get());
|
||||
mockDevice->setPreemptionMode(NEO::PreemptionMode::MidThread);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_io_functions.h"
|
||||
#include "shared/test/common/mocks/mock_sip.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
|
@ -868,11 +869,13 @@ TEST(DriverTest, givenBuiltinsAsyncInitEnabledWhenCreatingDriverThenMakeSureBuil
|
|||
}
|
||||
|
||||
TEST(DriverTest, givenInvalidCompilerEnvironmentThenDependencyUnavailableErrorIsReturned) {
|
||||
VariableBackup<bool> backupUseMockSip{&MockSipData::useMockSip};
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.capabilityTable.levelZeroSupported = true;
|
||||
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "1"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
backupUseMockSip = true;
|
||||
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
DriverImp driverImp;
|
||||
|
@ -890,11 +893,13 @@ TEST(DriverTest, givenInvalidCompilerEnvironmentThenDependencyUnavailableErrorIs
|
|||
}
|
||||
|
||||
TEST(DriverTest, givenInvalidCompilerEnvironmentAndEnableProgramDebuggingWithValue2ThenDependencyUnavailableErrorIsReturned) {
|
||||
VariableBackup<bool> backupUseMockSip{&MockSipData::useMockSip};
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.capabilityTable.levelZeroSupported = true;
|
||||
VariableBackup<uint32_t> mockGetenvCalledBackup(&IoFunctions::mockGetenvCalled, 0);
|
||||
std::unordered_map<std::string, std::string> mockableEnvs = {{"ZET_ENABLE_PROGRAM_DEBUGGING", "2"}};
|
||||
VariableBackup<std::unordered_map<std::string, std::string> *> mockableEnvValuesBackup(&IoFunctions::mockableEnvValues, &mockableEnvs);
|
||||
backupUseMockSip = true;
|
||||
|
||||
ze_result_t result = ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
DriverImp driverImp;
|
||||
|
|
|
@ -385,7 +385,6 @@ ze_result_t LinuxSysmanImp::initDevice() {
|
|||
return ZE_RESULT_ERROR_DEVICE_LOST;
|
||||
}
|
||||
static_cast<L0::DriverHandleImp *>(device->getDriverHandle())->updateRootDeviceBitFields(neoDevice);
|
||||
static_cast<L0::DriverHandleImp *>(device->getDriverHandle())->enableRootDeviceDebugger(neoDevice);
|
||||
Device::deviceReinit(device->getDriverHandle(), device, neoDevice, &result);
|
||||
reInitSysmanDeviceResources();
|
||||
|
||||
|
|
|
@ -1086,21 +1086,21 @@ TEST_F(SysmanGlobalOperationsIntegratedFixture, GivenProcessStartsMidResetWhenCa
|
|||
}
|
||||
|
||||
TEST(SysmanGlobalOperationsTest, GivenValidDevicePciPathWhenPreparingDeviceEnvironmentThenPrepareDeviceEnvironmentReturnsTrue) {
|
||||
auto device1 = std::unique_ptr<MockDevice>{MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get())};
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
std::string pciPath1 = "0000:00:02.0";
|
||||
EXPECT_TRUE(DeviceFactory::prepareDeviceEnvironment(*device1->getExecutionEnvironment(), pciPath1, 0u));
|
||||
EXPECT_TRUE(DeviceFactory::prepareDeviceEnvironment(executionEnvironment, pciPath1, 0u));
|
||||
}
|
||||
|
||||
TEST(SysmanGlobalOperationsTest, GivenValidDevicePciPathWhoseFileDescriptorOpenFailedThenPrepareDeviceEnvironmentReturnsFalse) {
|
||||
auto device2 = std::unique_ptr<MockDevice>{MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get())};
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
std::string pciPath2 = "0000:00:03.0";
|
||||
EXPECT_FALSE(DeviceFactory::prepareDeviceEnvironment(*device2->getExecutionEnvironment(), pciPath2, 0u));
|
||||
EXPECT_FALSE(DeviceFactory::prepareDeviceEnvironment(executionEnvironment, pciPath2, 0u));
|
||||
}
|
||||
|
||||
TEST(SysmanGlobalOperationsTest, GivenNotExisitingPciPathWhenPrepareDeviceEnvironmentIsCalledThenFalseIsReturned) {
|
||||
auto device3 = std::unique_ptr<MockDevice>{MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get())};
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
std::string pciPath3 = "0000:00:04.0";
|
||||
EXPECT_FALSE(DeviceFactory::prepareDeviceEnvironment(*device3->getExecutionEnvironment(), pciPath3, 0u));
|
||||
EXPECT_FALSE(DeviceFactory::prepareDeviceEnvironment(executionEnvironment, pciPath3, 0u));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDeviceFixture, GivenValidDeviceHandleWhenCallingDeviceGetStateThenSuccessResultIsReturned) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -143,17 +143,6 @@ bool Platform::initialize(std::vector<std::unique_ptr<Device>> devices) {
|
|||
UNRECOVERABLE_IF(!pDevice);
|
||||
pClDevice = new ClDevice{*pDevice, this};
|
||||
this->clDevices.push_back(pClDevice);
|
||||
|
||||
if (pClDevice->getDevice().getExecutionEnvironment()->isDebuggingEnabled()) {
|
||||
const auto rootDeviceIndex = pClDevice->getDevice().getRootDeviceIndex();
|
||||
auto rootDeviceEnvironment = pClDevice->getDevice().getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex].get();
|
||||
rootDeviceEnvironment->initDebuggerL0(&pClDevice->getDevice());
|
||||
}
|
||||
|
||||
if (pClDevice->getPreemptionMode() == PreemptionMode::MidThread) {
|
||||
bool ret = SipKernel::initSipKernel(SipKernel::getSipKernelType(*pDevice), *pDevice);
|
||||
UNRECOVERABLE_IF(!ret);
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_BREAK_IF(this->platformInfo);
|
||||
|
|
|
@ -177,7 +177,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenflushTaskThenDshAndIoh
|
|||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndMidThreadPreemptionWhenFlushTaskIsCalledThenSipKernelIsMadeResident) {
|
||||
auto &mockCsr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
debugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(NEO::PreemptionMode::MidThread));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto &mockCsr = mockDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
mockCsr.overrideDispatchPolicy(DispatchMode::batchedDispatch);
|
||||
mockCsr.useNewResourceImplicitFlush = false;
|
||||
mockCsr.useGpuIdleImplicitFlush = false;
|
||||
|
@ -187,8 +190,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndMidThread
|
|||
|
||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
dispatchFlags.preemptionMode = PreemptionMode::MidThread;
|
||||
auto sipType = SipKernel::getSipKernelType(*pDevice);
|
||||
SipKernel::initSipKernel(sipType, *pDevice);
|
||||
auto sipType = SipKernel::getSipKernelType(*mockDevice);
|
||||
SipKernel::initSipKernel(sipType, *mockDevice);
|
||||
|
||||
mockCsr.flushTask(commandStream,
|
||||
0,
|
||||
|
@ -197,10 +200,10 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndMidThread
|
|||
&ssh,
|
||||
taskLevel,
|
||||
dispatchFlags,
|
||||
*pDevice);
|
||||
*mockDevice);
|
||||
|
||||
auto cmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
|
||||
auto sipAllocation = SipKernel::getSipKernel(*pDevice, nullptr).getSipAllocation();
|
||||
auto sipAllocation = SipKernel::getSipKernel(*mockDevice, nullptr).getSipAllocation();
|
||||
bool found = false;
|
||||
for (auto allocation : cmdBuffer->surfaces) {
|
||||
if (allocation == sipAllocation) {
|
||||
|
@ -212,16 +215,19 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndMidThread
|
|||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeAndMidThreadPreemptionWhenFlushTaskIsCalledThenSipKernelIsMadeResident) {
|
||||
auto mockCsr = new MockCsrHw2<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
pDevice->resetCommandStreamReceiver(mockCsr);
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
debugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(NEO::PreemptionMode::MidThread));
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto mockCsr = new MockCsrHw2<FamilyType>(*mockDevice->executionEnvironment, mockDevice->getRootDeviceIndex(), mockDevice->getDeviceBitfield());
|
||||
mockDevice->resetCommandStreamReceiver(mockCsr);
|
||||
|
||||
CommandQueueHw<FamilyType> commandQueue(nullptr, pClDevice, 0, false);
|
||||
auto &commandStream = commandQueue.getCS(4096u);
|
||||
|
||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
dispatchFlags.preemptionMode = PreemptionMode::MidThread;
|
||||
auto sipType = SipKernel::getSipKernelType(*pDevice);
|
||||
SipKernel::initSipKernel(sipType, *pDevice);
|
||||
auto sipType = SipKernel::getSipKernelType(*mockDevice);
|
||||
SipKernel::initSipKernel(sipType, *mockDevice);
|
||||
|
||||
mockCsr->flushTask(commandStream,
|
||||
0,
|
||||
|
@ -230,9 +236,9 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInDefaultModeAndMidThreadP
|
|||
&ssh,
|
||||
taskLevel,
|
||||
dispatchFlags,
|
||||
*pDevice);
|
||||
*mockDevice);
|
||||
|
||||
auto sipAllocation = SipKernel::getSipKernel(*pDevice, nullptr).getSipAllocation();
|
||||
auto sipAllocation = SipKernel::getSipKernel(*mockDevice, nullptr).getSipAllocation();
|
||||
bool found = false;
|
||||
for (auto allocation : mockCsr->copyOfAllocations) {
|
||||
if (allocation == sipAllocation) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_io_functions.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_sip.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
|
@ -198,12 +199,17 @@ TEST(SubDevicesTest, givenClDeviceWithSubDevicesWhenSubDeviceInternalRefCountsAr
|
|||
}
|
||||
|
||||
TEST(SubDevicesTest, givenDeviceWithSubDevicesWhenSubDeviceCreationFailThenWholeDeviceIsDestroyed) {
|
||||
VariableBackup<bool> useMockSip(&MockSipData::useMockSip);
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.CreateMultipleSubDevices.set(4);
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.incRefInternal();
|
||||
executionEnvironment.memoryManager.reset(new FailMemoryManager(4, executionEnvironment));
|
||||
auto &gfxCoreHelper = executionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||
if (gfxCoreHelper.isSipKernelAsHexadecimalArrayPreferred()) {
|
||||
useMockSip = true;
|
||||
}
|
||||
auto device = Device::create<RootDevice>(&executionEnvironment, 0u);
|
||||
EXPECT_EQ(nullptr, device);
|
||||
}
|
||||
|
|
|
@ -641,6 +641,9 @@ struct CompressedBuffersTests : public ::testing::Test {
|
|||
device = std::make_unique<MockClDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0u));
|
||||
context = std::make_unique<MockContext>(device.get(), true);
|
||||
context->contextType = ContextType::CONTEXT_TYPE_UNRESTRICTIVE;
|
||||
|
||||
auto memoryManager = static_cast<MockMemoryManager *>(device->getExecutionEnvironment()->memoryManager.get());
|
||||
memoryManager->allocate32BitGraphicsMemoryImplCalled = false;
|
||||
}
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
|
|
@ -429,16 +429,6 @@ TEST(PlatformInitTest, givenSingleDeviceWithNonZeroRootDeviceIndexInPassedDevice
|
|||
EXPECT_EQ(2u, platform()->getClDevice(0)->getRootDeviceIndex());
|
||||
}
|
||||
|
||||
TEST(PlatformInitTest, GivenDebuggingEnabledWhenPlatformIsInitializedThenL0DebuggerIsCreated) {
|
||||
std::vector<std::unique_ptr<Device>> devices;
|
||||
auto executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get(), false, 1);
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
devices.push_back(std::make_unique<MockDevice>(executionEnvironment, 0));
|
||||
auto status = platform()->initialize(std::move(devices));
|
||||
EXPECT_TRUE(status);
|
||||
EXPECT_NE(nullptr, platform()->getClDevice(0)->getDevice().getL0Debugger());
|
||||
}
|
||||
|
||||
TEST(PlatformInitTest, GivenPreferredPlatformNameWhenPlatformIsInitializedThenOverridePlatformName) {
|
||||
std::vector<std::unique_ptr<Device>> devices;
|
||||
auto executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get(), false, 1);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -10,6 +10,7 @@
|
|||
#include "shared/source/program/kernel_info.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_sip.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/multi_root_device_fixture.h"
|
||||
|
@ -90,12 +91,17 @@ class MyMemoryManager : public OsAgnosticMemoryManager {
|
|||
};
|
||||
|
||||
TEST(KernelInfoTest, givenKernelInfoWhenCreateKernelAllocationAndCannotAllocateMemoryThenReturnsFalse) {
|
||||
VariableBackup<bool> useMockSip(&MockSipData::useMockSip);
|
||||
KernelInfo kernelInfo;
|
||||
auto executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get());
|
||||
executionEnvironment->memoryManager.reset(new MyMemoryManager(*executionEnvironment));
|
||||
if (executionEnvironment->memoryManager->isLimitedGPU(0)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||
if (gfxCoreHelper.isSipKernelAsHexadecimalArrayPreferred()) {
|
||||
useMockSip = true;
|
||||
}
|
||||
auto device = std::unique_ptr<Device>(Device::create<RootDevice>(executionEnvironment, mockRootDeviceIndex));
|
||||
auto retVal = kernelInfo.createKernelAllocation(*device, false);
|
||||
EXPECT_FALSE(retVal);
|
||||
|
|
|
@ -198,7 +198,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
|||
void programHeaplessStateProlog(Device &device, LinearStream &commandStream);
|
||||
void programStateBaseAddressHeapless(Device &device, LinearStream &commandStream);
|
||||
void programComputeModeHeapless(Device &device, LinearStream &commandStream);
|
||||
void handleAllocationsResidencyForflushTaskStateless(const IndirectHeap *dsh, const IndirectHeap *ioh, const IndirectHeap *ssh);
|
||||
void handleAllocationsResidencyForflushTaskStateless(const IndirectHeap *dsh, const IndirectHeap *ioh, const IndirectHeap *ssh, Device &device);
|
||||
bool submitDependencyUpdate(TagNodeBase *tag) override;
|
||||
|
||||
protected:
|
||||
|
@ -310,7 +310,8 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
|||
ImmediateFlushData &flushData);
|
||||
|
||||
void handleImmediateFlushStatelessAllocationsResidency(size_t csrEstimatedSize,
|
||||
LinearStream &csrStream);
|
||||
LinearStream &csrStream,
|
||||
Device &device);
|
||||
|
||||
inline void handleImmediateFlushAllocationsResidency(Device &device,
|
||||
LinearStream &immediateCommandStream,
|
||||
|
|
|
@ -542,8 +542,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
|||
|
||||
bool debuggingEnabled = device.getDebugger() != nullptr;
|
||||
|
||||
if (dispatchFlags.preemptionMode == PreemptionMode::MidThread || debuggingEnabled) {
|
||||
|
||||
if (device.isStateSipRequired()) {
|
||||
GraphicsAllocation *sipAllocation = SipKernel::getSipKernel(device, this->osContext).getSipAllocation();
|
||||
makeResident(*sipAllocation);
|
||||
}
|
||||
|
@ -2119,7 +2118,6 @@ void CommandStreamReceiverHw<GfxFamily>::handleImmediateFlushAllocationsResidenc
|
|||
}
|
||||
|
||||
if (device.isStateSipRequired()) {
|
||||
|
||||
GraphicsAllocation *sipAllocation = SipKernel::getSipKernel(device, this->osContext).getSipAllocation();
|
||||
makeResident(*sipAllocation);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushImmediateTaskStateless(
|
|||
|
||||
template <typename GfxFamily>
|
||||
void CommandStreamReceiverHw<GfxFamily>::handleImmediateFlushStatelessAllocationsResidency(size_t csrEstimatedSize,
|
||||
LinearStream &csrStream) {
|
||||
LinearStream &csrStream,
|
||||
Device &device) {
|
||||
UNRECOVERABLE_IF(true);
|
||||
}
|
||||
|
||||
|
@ -68,7 +69,8 @@ size_t CommandStreamReceiverHw<GfxFamily>::getCmdSizeForHeaplessPrologue(Device
|
|||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void CommandStreamReceiverHw<GfxFamily>::handleAllocationsResidencyForflushTaskStateless(const IndirectHeap *dsh, const IndirectHeap *ioh, const IndirectHeap *ssh) {
|
||||
void CommandStreamReceiverHw<GfxFamily>::handleAllocationsResidencyForflushTaskStateless(const IndirectHeap *dsh, const IndirectHeap *ioh,
|
||||
const IndirectHeap *ssh, Device &device) {
|
||||
UNRECOVERABLE_IF(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "shared/source/device/device.h"
|
||||
|
||||
#include "shared/source/built_ins/sip.h"
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/command_stream/submission_status.h"
|
||||
|
@ -229,6 +230,21 @@ bool Device::createDeviceImpl() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (getExecutionEnvironment()->isDebuggingEnabled()) {
|
||||
const auto rootDeviceIndex = getRootDeviceIndex();
|
||||
auto rootDeviceEnvironment = getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex].get();
|
||||
rootDeviceEnvironment->initDebuggerL0(this);
|
||||
if (rootDeviceEnvironment->debugger == nullptr) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Debug mode is not enabled in the system.\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (this->isStateSipRequired()) {
|
||||
bool ret = SipKernel::initSipKernel(SipKernel::getSipKernelType(*this), *this);
|
||||
UNRECOVERABLE_IF(!ret);
|
||||
}
|
||||
|
||||
getDefaultEngine().osContext->setDefaultContext(true);
|
||||
|
||||
for (auto &engine : allEngines) {
|
||||
|
|
|
@ -187,7 +187,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
|||
MOCKABLE_VIRTUAL void stopDirectSubmissionAndWaitForCompletion();
|
||||
bool isAnyDirectSubmissionEnabled();
|
||||
bool isStateSipRequired() const {
|
||||
return getPreemptionMode() == PreemptionMode::MidThread || getDebugger() != nullptr;
|
||||
return (getPreemptionMode() == PreemptionMode::MidThread || getDebugger() != nullptr) && getCompilerInterface();
|
||||
}
|
||||
|
||||
MOCKABLE_VIRTUAL EngineControl *getSecondaryEngineCsr(EngineTypeUsage engineTypeUsage, bool allocateInterrupt);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -8,6 +8,7 @@
|
|||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
|
||||
#include "shared/source/built_ins/sip.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
|
@ -55,4 +56,20 @@ template ProductHelper &DeviceFixture::getHelper<ProductHelper>() const;
|
|||
template GfxCoreHelper &DeviceFixture::getHelper<GfxCoreHelper>() const;
|
||||
template CompilerProductHelper &DeviceFixture::getHelper<CompilerProductHelper>() const;
|
||||
|
||||
void DeviceWithoutSipFixture::setUp() {
|
||||
debugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(NEO::PreemptionMode::Disabled));
|
||||
DeviceFixture::setUp();
|
||||
|
||||
for (auto &rootDeviceEnvironment : pDevice->executionEnvironment->rootDeviceEnvironments) {
|
||||
for (auto &sipKernel : rootDeviceEnvironment->sipKernels) {
|
||||
EXPECT_EQ(nullptr, sipKernel);
|
||||
}
|
||||
}
|
||||
debugManager.flags.ForcePreemptionMode.set(dbgRestorer.debugVarSnapshot.ForcePreemptionMode.get());
|
||||
}
|
||||
|
||||
void DeviceWithoutSipFixture::tearDown() {
|
||||
DeviceFixture::tearDown();
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -8,6 +8,7 @@
|
|||
#pragma once
|
||||
#include "shared/source/command_stream/task_count_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
|
@ -33,4 +34,10 @@ struct DeviceFixture {
|
|||
const ReleaseHelper *getReleaseHelper();
|
||||
};
|
||||
|
||||
struct DeviceWithoutSipFixture : DeviceFixture {
|
||||
void setUp();
|
||||
void tearDown();
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -11,10 +11,14 @@
|
|||
#include "shared/test/common/mocks/mock_l0_debugger.h"
|
||||
|
||||
NEO::DebugerL0CreateFn mockDebuggerL0HwFactory[IGFX_MAX_CORE];
|
||||
bool forceCreateNullptrDebugger = false;
|
||||
|
||||
namespace NEO {
|
||||
|
||||
std::unique_ptr<Debugger> DebuggerL0::create(NEO::Device *device) {
|
||||
if (forceCreateNullptrDebugger) {
|
||||
return nullptr;
|
||||
}
|
||||
initDebuggingInOs(device->getRootDeviceEnvironment().osInterface.get());
|
||||
auto debugger = mockDebuggerL0HwFactory[device->getHardwareInfo().platform.eRenderCoreFamily](device);
|
||||
return std::unique_ptr<DebuggerL0>(debugger);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace NEO {
|
|||
extern std::set<std::string> virtualFileList;
|
||||
}
|
||||
|
||||
struct RawBinarySipFixture : public DeviceFixture {
|
||||
struct RawBinarySipFixture : public DeviceWithoutSipFixture {
|
||||
void setUp() {
|
||||
debugManager.flags.LoadBinarySipFromFile.set("dummy_file.bin");
|
||||
|
||||
|
@ -52,11 +52,11 @@ struct RawBinarySipFixture : public DeviceFixture {
|
|||
backupFcloseCalled = std::make_unique<VariableBackup<uint32_t>>(&IoFunctions::mockFcloseCalled, 0u);
|
||||
backupFailAfterNFopenCount = std::make_unique<VariableBackup<uint32_t>>(&IoFunctions::failAfterNFopenCount, 0u);
|
||||
|
||||
DeviceFixture::setUp();
|
||||
DeviceWithoutSipFixture::setUp();
|
||||
}
|
||||
|
||||
void tearDown() {
|
||||
DeviceFixture::tearDown();
|
||||
DeviceWithoutSipFixture::tearDown();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
|
@ -326,7 +326,8 @@ struct HexadecimalHeaderSipKernel : public SipKernel {
|
|||
using SipKernel::getSipKernelImpl;
|
||||
using SipKernel::initHexadecimalArraySipKernel;
|
||||
};
|
||||
using HexadecimalHeaderSipTest = Test<DeviceFixture>;
|
||||
|
||||
using HexadecimalHeaderSipTest = Test<DeviceWithoutSipFixture>;
|
||||
|
||||
TEST_F(HexadecimalHeaderSipTest, whenInitHexadecimalArraySipKernelIsCalledThenSipKernelIsCorrect) {
|
||||
VariableBackup<SipClassType> backupSipClassType(&SipKernel::classType, SipClassType::hexadecimalHeaderFile);
|
||||
|
@ -470,11 +471,11 @@ TEST(DebugBindlessSip, givenBindlessDebugSipIsRequestedThenCorrectSipKernelIsRet
|
|||
}
|
||||
|
||||
TEST(DebugBindlessSip, givenContextWhenBindlessDebugSipIsRequestedThenCorrectSipKernelIsReturned) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto executionEnvironment = mockDevice->getExecutionEnvironment();
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
auto builtIns = new NEO::MockBuiltins();
|
||||
builtIns->callBaseGetSipKernel = true;
|
||||
MockRootDeviceEnvironment::resetBuiltins(executionEnvironment->rootDeviceEnvironments[0].get(), builtIns);
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
|
||||
const uint32_t contextId = 0u;
|
||||
std::unique_ptr<OsContext> osContext(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(),
|
||||
|
@ -499,12 +500,12 @@ TEST(DebugBindlessSip, givenContextWhenBindlessDebugSipIsRequestedThenCorrectSip
|
|||
}
|
||||
|
||||
TEST(DebugBindlessSip, givenOfflineDebuggingModeWhenGettingSipForContextThenCorrectSipKernelIsReturned) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto executionEnvironment = mockDevice->getExecutionEnvironment();
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::offline);
|
||||
auto builtIns = new NEO::MockBuiltins();
|
||||
builtIns->callBaseGetSipKernel = true;
|
||||
MockRootDeviceEnvironment::resetBuiltins(executionEnvironment->rootDeviceEnvironments[0].get(), builtIns);
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::offline);
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
|
||||
const uint32_t contextId = 0u;
|
||||
std::unique_ptr<OsContext> osContext(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(),
|
||||
|
@ -529,11 +530,11 @@ TEST(DebugBindlessSip, givenOfflineDebuggingModeWhenGettingSipForContextThenCorr
|
|||
}
|
||||
|
||||
TEST(DebugBindlessSip, givenTwoContextsWhenBindlessDebugSipIsRequestedThenEachSipKernelIsAssignedToADifferentContextId) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto executionEnvironment = mockDevice->getExecutionEnvironment();
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
auto builtIns = new NEO::MockBuiltins();
|
||||
builtIns->callBaseGetSipKernel = true;
|
||||
MockRootDeviceEnvironment::resetBuiltins(executionEnvironment->rootDeviceEnvironments[0].get(), builtIns);
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
|
||||
const uint32_t context0Id = 0u;
|
||||
std::unique_ptr<OsContext> osContext0(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(),
|
||||
|
@ -561,18 +562,18 @@ TEST(DebugBindlessSip, givenTwoContextsWhenBindlessDebugSipIsRequestedThenEachSi
|
|||
}
|
||||
|
||||
TEST(DebugBindlessSip, givenFailingSipAllocationWhenBindlessDebugSipWithContextIsRequestedThenSipAllocationInSipKernelIsNull) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto executionEnvironment = mockDevice->getExecutionEnvironment();
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
|
||||
auto builtIns = new NEO::MockBuiltins();
|
||||
builtIns->callBaseGetSipKernel = true;
|
||||
MockRootDeviceEnvironment::resetBuiltins(executionEnvironment->rootDeviceEnvironments[0].get(), builtIns);
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
|
||||
auto mockMemoryManager = new MockMemoryManager();
|
||||
mockMemoryManager->isMockHostMemoryManager = true;
|
||||
mockMemoryManager->forceFailureInPrimaryAllocation = true;
|
||||
executionEnvironment->memoryManager.reset(mockMemoryManager);
|
||||
|
||||
auto builtIns = new NEO::MockBuiltins();
|
||||
builtIns->callBaseGetSipKernel = true;
|
||||
MockRootDeviceEnvironment::resetBuiltins(executionEnvironment->rootDeviceEnvironments[0].get(), builtIns);
|
||||
|
||||
const uint32_t contextId = 0u;
|
||||
std::unique_ptr<OsContext> osContext(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(),
|
||||
mockDevice->getRootDeviceIndex(), contextId,
|
||||
|
@ -596,11 +597,11 @@ TEST(DebugBindlessSip, givenFailingSipAllocationWhenBindlessDebugSipWithContextI
|
|||
}
|
||||
|
||||
TEST(DebugBindlessSip, givenCorrectSipKernelWhenReleasingAllocationManuallyThenFreeGraphicsMemoryIsSkippedOnDestruction) {
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto executionEnvironment = mockDevice->getExecutionEnvironment();
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
auto builtIns = new NEO::MockBuiltins();
|
||||
builtIns->callBaseGetSipKernel = true;
|
||||
MockRootDeviceEnvironment::resetBuiltins(executionEnvironment->rootDeviceEnvironments[0].get(), builtIns);
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
|
||||
const uint32_t contextId = 0u;
|
||||
std::unique_ptr<OsContext> osContext(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(),
|
||||
|
@ -628,13 +629,12 @@ TEST(DebugBindlessSip, givenOfflineDebuggingModeWhenSipIsInitializedThenBinaryIs
|
|||
igcDebugVars.binaryToReturn = binary;
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
auto executionEnvironment = mockDevice->getExecutionEnvironment();
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
auto builtIns = new NEO::MockBuiltins();
|
||||
builtIns->callBaseGetSipKernel = true;
|
||||
MockRootDeviceEnvironment::resetBuiltins(executionEnvironment->rootDeviceEnvironments[0].get(), builtIns);
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::offline);
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
|
||||
auto osContext = std::make_unique<OsContextMock>(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::regular}));
|
||||
osContext->debuggableContext = true;
|
||||
|
@ -665,13 +665,12 @@ TEST(DebugBindlessSip, givenOfflineDebuggingModeAndInvalidSipWhenSipIsInitialize
|
|||
igcDebugVars.binaryToReturn = binary;
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
auto executionEnvironment = mockDevice->getExecutionEnvironment();
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
auto builtIns = new NEO::MockBuiltins();
|
||||
builtIns->callBaseGetSipKernel = true;
|
||||
MockRootDeviceEnvironment::resetBuiltins(executionEnvironment->rootDeviceEnvironments[0].get(), builtIns);
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::offline);
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
|
||||
auto osContext = std::make_unique<OsContextMock>(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::regular}));
|
||||
osContext->debuggableContext = true;
|
||||
|
@ -703,12 +702,12 @@ TEST(DebugBindlessSip, givenOfflineDebuggingModeWhenDebugSipForContextIsCreatedT
|
|||
igcDebugVars.binaryToReturn = binary;
|
||||
gEnvironment->igcPushDebugVars(igcDebugVars);
|
||||
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
auto executionEnvironment = mockDevice->getExecutionEnvironment();
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
auto builtIns = new NEO::MockBuiltins();
|
||||
builtIns->callBaseGetSipKernel = true;
|
||||
MockRootDeviceEnvironment::resetBuiltins(executionEnvironment->rootDeviceEnvironments[0].get(), builtIns);
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::offline);
|
||||
auto mockDevice = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
|
||||
auto osContext = std::make_unique<OsContextMock>(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::regular}));
|
||||
osContext->debuggableContext = true;
|
||||
|
|
|
@ -5296,11 +5296,11 @@ HWTEST_F(CommandStreamReceiverHwHeaplessTest, whenHeaplessCommandStreamReceiverF
|
|||
EXPECT_ANY_THROW(csr->getCmdSizeForHeaplessPrologue(*pDevice));
|
||||
EXPECT_ANY_THROW(csr->handleAllocationsResidencyForHeaplessProlog(commandStream, *pDevice));
|
||||
EXPECT_ANY_THROW(csr->programHeaplessStateProlog(*pDevice, commandStream));
|
||||
EXPECT_ANY_THROW(csr->handleAllocationsResidencyForflushTaskStateless(nullptr, nullptr, nullptr));
|
||||
EXPECT_ANY_THROW(csr->handleAllocationsResidencyForflushTaskStateless(nullptr, nullptr, nullptr, *pDevice));
|
||||
EXPECT_ANY_THROW(csr->getRequiredCmdStreamHeaplessSize(csr->recordedDispatchFlags, *pDevice));
|
||||
EXPECT_ANY_THROW(csr->getRequiredCmdStreamHeaplessSizeAligned(csr->recordedDispatchFlags, *pDevice));
|
||||
EXPECT_ANY_THROW(csr->flushImmediateTaskStateless(commandStream, 0, csr->recordedImmediateDispatchFlags, *pDevice));
|
||||
EXPECT_ANY_THROW(csr->handleImmediateFlushStatelessAllocationsResidency(0, commandStream));
|
||||
EXPECT_ANY_THROW(csr->handleImmediateFlushStatelessAllocationsResidency(0, commandStream, *pDevice));
|
||||
|
||||
EXPECT_FALSE(csr->heaplessStateInitialized);
|
||||
}
|
||||
|
|
|
@ -1033,6 +1033,46 @@ TEST_F(DeviceTests, givenDeviceThreadGroupPreemptionWhenDebuggerDisabledThenStat
|
|||
EXPECT_FALSE(device->isStateSipRequired());
|
||||
}
|
||||
|
||||
TEST_F(DeviceTests, WhenIsStateSipRequiredIsCalledThenCorrectValueIsReturned) {
|
||||
struct MockRootDeviceEnvironment : RootDeviceEnvironment {
|
||||
using RootDeviceEnvironment::RootDeviceEnvironment;
|
||||
CompilerInterface *getCompilerInterface() override {
|
||||
return compilerInterfaceReturnValue;
|
||||
}
|
||||
CompilerInterface *compilerInterfaceReturnValue = nullptr;
|
||||
};
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
||||
auto mockRootDeviceEnvironment = new MockRootDeviceEnvironment{*device->executionEnvironment};
|
||||
auto backupenv = device->executionEnvironment->rootDeviceEnvironments[0].release();
|
||||
device->executionEnvironment->rootDeviceEnvironments[0].reset(mockRootDeviceEnvironment);
|
||||
device->executionEnvironment->rootDeviceEnvironments[0]->compilerInterface.release();
|
||||
device->executionEnvironment->rootDeviceEnvironments[0]->debugger.release();
|
||||
|
||||
std::array<std::tuple<PreemptionMode, Debugger *, CompilerInterface *, bool>, 8> testParameters = {
|
||||
{{PreemptionMode::Disabled, nullptr, nullptr, false},
|
||||
{PreemptionMode::MidThread, nullptr, nullptr, false},
|
||||
{PreemptionMode::Disabled, (Debugger *)0x1234, nullptr, false},
|
||||
{PreemptionMode::MidThread, (Debugger *)0x1234, nullptr, false},
|
||||
|
||||
{PreemptionMode::Disabled, nullptr, (CompilerInterface *)0x1234, false},
|
||||
{PreemptionMode::MidThread, nullptr, (CompilerInterface *)0x1234, true},
|
||||
{PreemptionMode::Disabled, (Debugger *)0x1234, (CompilerInterface *)0x1234, true},
|
||||
{PreemptionMode::MidThread, (Debugger *)0x1234, (CompilerInterface *)0x1234, true}}};
|
||||
|
||||
for (const auto &[preemptionMode, debugger, compilerInterface, expectedResult] : testParameters) {
|
||||
device->setPreemptionMode(preemptionMode);
|
||||
device->executionEnvironment->rootDeviceEnvironments[0]->debugger.release();
|
||||
device->executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(debugger);
|
||||
mockRootDeviceEnvironment->compilerInterfaceReturnValue = compilerInterface;
|
||||
|
||||
EXPECT_EQ(expectedResult, device->isStateSipRequired());
|
||||
}
|
||||
device->executionEnvironment->rootDeviceEnvironments[0]->debugger.release();
|
||||
mockRootDeviceEnvironment->compilerInterfaceReturnValue = nullptr;
|
||||
delete device->executionEnvironment->rootDeviceEnvironments[0].release();
|
||||
device->executionEnvironment->rootDeviceEnvironments[0].reset(backupenv);
|
||||
}
|
||||
|
||||
HWTEST2_F(DeviceTests, GivenXeHpAndLaterThenDefaultPreemptionModeIsThreadGroup, IsWithinXeGfxFamily) {
|
||||
EXPECT_EQ(PreemptionMode::ThreadGroup, defaultHwInfo->capabilityTable.defaultPreemptionMode);
|
||||
}
|
||||
|
@ -1452,4 +1492,29 @@ HWTEST_F(DeviceTests, givenDebugFlagSetWhenCreatingSecondaryEnginesThenSkipSelec
|
|||
EXPECT_EQ(device->secondaryEngines.end(), device->secondaryEngines.find(aub_stream::ENGINE_CCS));
|
||||
|
||||
executionEnvironment->decRefInternal();
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DeviceTests, GivenDebuggingEnabledWhenDeviceIsInitializedThenL0DebuggerIsCreated) {
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
EXPECT_NE(nullptr, device->getL0Debugger());
|
||||
}
|
||||
|
||||
extern bool forceCreateNullptrDebugger;
|
||||
|
||||
TEST_F(DeviceTests, givenDebuggerRequestedByUserAndNotAvailableWhenDeviceIsInitializedThenErrorIsPrintedButNotReturned) {
|
||||
VariableBackup backupForceCreateNullptrDebugger{&forceCreateNullptrDebugger, true};
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
|
||||
NEO::debugManager.flags.PrintDebugMessages.set(1);
|
||||
::testing::internal::CaptureStderr();
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0u));
|
||||
auto output = testing::internal::GetCapturedStderr();
|
||||
|
||||
EXPECT_EQ(std::string("Debug mode is not enabled in the system.\n"), output);
|
||||
EXPECT_EQ(nullptr, device->getL0Debugger());
|
||||
}
|
||||
|
|
|
@ -532,6 +532,15 @@ TEST(ExecutionEnvironment, givenIncorrectZeAffinityMaskWhenExposeSubDevicesAsApi
|
|||
EXPECT_TRUE(executionEnvironment.mapOfSubDeviceIndices.empty());
|
||||
}
|
||||
|
||||
TEST(ExecutionEnvironment, givenBuiltinsSetWhenRootDeviceEnvironmentIsReleasedThenBuiltinsIsReset) {
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
MockExecutionEnvironment executionEnvironment(&hwInfo);
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->builtins.reset(new BuiltIns);
|
||||
executionEnvironment.releaseRootDeviceEnvironmentResources(executionEnvironment.rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[0]->builtins);
|
||||
}
|
||||
|
||||
TEST(ExecutionEnvironmentWithAILTests, whenAILConfigurationIsNullptrAndEnableAILFlagIsTrueWhenInitializingAILThenReturnFalse) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableAIL.set(true);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -223,6 +223,9 @@ TEST_F(DeferrableAllocationDeletionTest, givenAllocationUsedByUnregisteredEngine
|
|||
DeferrableAllocationDeletion deletion{*memoryManager, *allocation};
|
||||
|
||||
device.reset();
|
||||
for (const auto &rootDeviceEnvironment : executionEnvironment->rootDeviceEnvironments) {
|
||||
executionEnvironment->releaseRootDeviceEnvironmentResources(rootDeviceEnvironment.get());
|
||||
}
|
||||
executionEnvironment->rootDeviceEnvironments.clear();
|
||||
EXPECT_EQ(0u, memoryManager->getRegisteredEngines(rootDeviceIndex).size());
|
||||
EXPECT_TRUE(allocation->isUsed());
|
||||
|
|
|
@ -62,17 +62,16 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDebugFlagSetWhenSubmittingThenCall
|
|||
uint32_t expectedExitCounter = 13;
|
||||
|
||||
debugManager.flags.ExitOnSubmissionNumber.set(expectedExitCounter);
|
||||
debugManager.flags.ForcePreemptionMode.set(PreemptionMode::Disabled);
|
||||
|
||||
csr->initializeTagAllocation();
|
||||
|
||||
auto &cs = csr->getCS();
|
||||
IndirectHeap ih(cs.getGraphicsAllocation());
|
||||
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
|
||||
dispatchFlags.preemptionMode = PreemptionMode::Disabled;
|
||||
|
||||
executionEnvironment.incRefInternal();
|
||||
std::unique_ptr<MockDevice> device(MockDevice::create<MockDevice>(&executionEnvironment, 0));
|
||||
device->setPreemptionMode(PreemptionMode::Disabled);
|
||||
|
||||
bool bcsSupported = false;
|
||||
for (auto &engine : csr->getGfxCoreHelper().getGpgpuEngineInstances(device->getRootDeviceEnvironment())) {
|
||||
|
@ -582,7 +581,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSe
|
|||
|
||||
EXPECT_EQ(testedCsr->commandStream.getGraphicsAllocation(), recordedCmdBuffer->batchBuffer.commandBufferAllocation);
|
||||
|
||||
int ioctlUserPtrCnt = (device->getPreemptionMode() == PreemptionMode::MidThread) ? 4 : 3;
|
||||
int ioctlUserPtrCnt = 3;
|
||||
ioctlUserPtrCnt += testedCsr->clearColorAllocation ? 1 : 0;
|
||||
|
||||
EXPECT_EQ(ioctlUserPtrCnt, this->mock->ioctlCnt.total);
|
||||
|
@ -662,7 +661,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhen
|
|||
}
|
||||
|
||||
int ioctlExecCnt = 1;
|
||||
int ioctlUserPtrCnt = (device->getPreemptionMode() == PreemptionMode::MidThread) ? 3 : 2;
|
||||
int ioctlUserPtrCnt = 2;
|
||||
ioctlUserPtrCnt += testedCsr->clearColorAllocation ? 1 : 0;
|
||||
EXPECT_EQ(ioctlExecCnt, this->mock->ioctlCnt.execbuffer2);
|
||||
EXPECT_EQ(ioctlUserPtrCnt, this->mock->ioctlCnt.gemUserptr);
|
||||
|
|
Loading…
Reference in New Issue