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:
Filip Hazubski
2024-06-20 11:56:15 +00:00
committed by Compute-Runtime-Automation
parent 6ded319b0f
commit 2f6eaf149a
29 changed files with 218 additions and 196 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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());
}

View File

@@ -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);

View File

@@ -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());

View File

@@ -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);