fix: create preemption allocation for Root Csr

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz 2024-02-29 10:11:37 +00:00 committed by Compute-Runtime-Automation
parent 7d2bed17d9
commit 00964275fb
6 changed files with 29 additions and 52 deletions

View File

@ -356,9 +356,6 @@ HWTEST2_F(MultiTileCommandQueueSynchronizeTest, givenMultiplePartitionCountWhenC
ze_result_t returnValue;
auto csr = reinterpret_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(neoDevice->getDefaultEngine().commandStreamReceiver);
if (device->getNEODevice()->getPreemptionMode() == PreemptionMode::MidThread) {
csr->createPreemptionAllocation();
}
EXPECT_NE(0u, csr->getImmWritePostSyncWriteOffset());
volatile TagAddressType *tagAddress = csr->getTagAddress();
for (uint32_t i = 0; i < 2; i++) {
@ -399,9 +396,7 @@ HWTEST2_F(MultiTileCommandQueueSynchronizeTest, givenCsrHasMultipleActivePartiti
ze_result_t returnValue;
auto csr = reinterpret_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(neoDevice->getDefaultEngine().commandStreamReceiver);
if (device->getNEODevice()->getPreemptionMode() == PreemptionMode::MidThread) {
csr->createPreemptionAllocation();
}
EXPECT_NE(0u, csr->getImmWritePostSyncWriteOffset());
volatile TagAddressType *tagAddress = csr->getTagAddress();
for (uint32_t i = 0; i < 2; i++) {

View File

@ -1122,11 +1122,6 @@ HWTEST2_F(MultiDeviceCommandQueueExecuteCommandLists, givenMultiplePartitionCoun
EXPECT_EQ(2u, commandQueue->partitionCount);
ASSERT_NE(nullptr, commandQueue);
auto &commandStreamReceiver = device->getNEODevice()->getDefaultEngine().commandStreamReceiver;
if (neoDevice->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver->createPreemptionAllocation();
}
ze_fence_desc_t fenceDesc{};
auto fence = whiteboxCast(Fence::create(commandQueue, &fenceDesc));
ASSERT_NE(nullptr, fence);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -1523,9 +1523,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTestDynamicPartition
size_t gws[] = {128, 1, 1};
size_t lws[] = {8, 1, 1};
auto &commandStreamReceiver = cmdQ->getUltCommandStreamReceiver();
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
EXPECT_EQ(1u, commandStreamReceiver.activePartitions);
cmdQ->enqueueKernel(kernel->mockKernel, 1, nullptr, gws, lws, 0, nullptr, nullptr);
EXPECT_EQ(1u, commandStreamReceiver.activePartitions);
@ -1559,9 +1557,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTestStaticPartition,
size_t gws[] = {128, 1, 1};
size_t lws[] = {8, 1, 1};
auto &commandStreamReceiver = cmdQ->getUltCommandStreamReceiver();
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
EXPECT_EQ(2u, commandStreamReceiver.activePartitions);
cmdQ->enqueueKernel(kernel->mockKernel, 1, nullptr, gws, lws, 0, nullptr, nullptr);
EXPECT_EQ(2u, commandStreamReceiver.activePartitions);
@ -1585,9 +1581,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTestStaticPartition,
size_t gws[] = {129, 1, 1};
size_t lws[] = {8, 1, 1};
auto &commandStreamReceiver = cmdQ->getUltCommandStreamReceiver();
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
EXPECT_EQ(2u, commandStreamReceiver.activePartitions);
kernel->mockProgram->allowNonUniform = true;
cmdQ->enqueueKernel(kernel->mockKernel, 1, nullptr, gws, lws, 0, nullptr, nullptr);
@ -1936,10 +1930,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerTestMultiTileDevice, give
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
size_t gws[] = {2, 1, 1};
size_t lws[] = {1, 1, 1};
auto &commandStreamReceiver = cmdQ->getUltCommandStreamReceiver();
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
KernelWithSingleSubdevicePreferences subdeviceKernel(kernel->mockProgram, kernel->kernelInfo, *device);
subdeviceKernel.singleSubdevicePreferred = true;
cmdQ->enqueueKernel(&subdeviceKernel, 1, nullptr, gws, lws, 0, nullptr, nullptr);
@ -1960,10 +1951,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerTestMultiTileDevice, give
auto cmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context.get(), device.get(), nullptr);
size_t gws[] = {2, 1, 1};
size_t lws[] = {1, 1, 1};
auto &commandStreamReceiver = cmdQ->getUltCommandStreamReceiver();
if (device->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
KernelWithSingleSubdevicePreferences subdeviceKernel(kernel->mockProgram, kernel->kernelInfo, *device);
subdeviceKernel.singleSubdevicePreferred = false;
cmdQ->enqueueKernel(&subdeviceKernel, 1, nullptr, gws, lws, 0, nullptr, nullptr);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -774,9 +774,7 @@ struct CommandStreamReceiverFlushTaskXeHPAndLaterMultiTileTests : public Command
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTileTests,
givenMultipleStaticActivePartitionsWhenFlushingTaskThenExpectTagUpdatePipeControlWithPartitionFlagOnAndActivePartitionConfig) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
EXPECT_EQ(1u, commandStreamReceiver.activePartitionsConfig);
commandStreamReceiver.activePartitions = 2;
commandStreamReceiver.taskCount = 3;
@ -797,9 +795,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTile
debugManager.flags.UpdateTaskCountFromWait.set(3);
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
EXPECT_EQ(1u, commandStreamReceiver.activePartitionsConfig);
commandStreamReceiver.activePartitions = 2;
commandStreamReceiver.taskCount = 3;
@ -815,9 +811,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTile
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTileTests,
givenSingleStaticActivePartitionWhenFlushingTaskThenExpectTagUpdatePipeControlWithoutPartitionFlagOnAndNoActivePartitionConfig) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
commandStreamReceiver.activePartitions = 1;
commandStreamReceiver.taskCount = 3;
flushTask(commandStreamReceiver, true);
@ -838,9 +832,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTile
debugManager.flags.UpdateTaskCountFromWait.set(3);
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
EXPECT_EQ(1u, commandStreamReceiver.activePartitionsConfig);
commandStreamReceiver.activePartitions = 2;
commandStreamReceiver.taskCount = 3;
@ -869,9 +861,6 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTile
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTileTests,
givenMultipleDynamicActivePartitionsWhenFlushingTaskTwiceThenExpectTagUpdatePipeControlWithoutPartitionFlagAndPartitionRegisters) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
commandStreamReceiver.activePartitions = 2;
commandStreamReceiver.taskCount = 3;
@ -892,9 +881,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTile
debugManager.flags.UpdateTaskCountFromWait.set(1);
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
commandStreamReceiver.activePartitions = 2;
commandStreamReceiver.taskCount = 3;
commandStreamReceiver.staticWorkPartitioningEnabled = false;
@ -907,9 +894,6 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTile
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterMultiTileTests,
givenMultipleStaticActivePartitionsAndDirectSubmissionActiveWhenFlushingTaskThenExpectTagUpdatePipeControlWithPartitionFlagOnAndNoActivePartitionConfig) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
commandStreamReceiver.createPreemptionAllocation();
}
commandStreamReceiver.directSubmission = std::make_unique<MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>>(commandStreamReceiver);
commandStreamReceiver.directSubmissionAvailable = true;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2023 Intel Corporation
* Copyright (C) 2019-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -70,6 +70,9 @@ void RootDevice::initializeRootCommandStreamReceiver() {
rootCommandStreamReceiver->initializeTagAllocation();
rootCommandStreamReceiver->createGlobalFenceAllocation();
rootCommandStreamReceiver->createWorkPartitionAllocation(*this);
if (preemptionMode == PreemptionMode::MidThread) {
rootCommandStreamReceiver->createPreemptionAllocation();
}
commandStreamReceivers.push_back(std::move(rootCommandStreamReceiver));
EngineControl engine{commandStreamReceivers.back().get(), osContext};

View File

@ -596,6 +596,18 @@ TEST_F(DeviceTests, givenDispatchGlobalsAllocationFailsOnSecondSubDeviceThenRtDi
EXPECT_EQ(nullptr, rtDispatchGlobalsInfo);
}
TEST_F(DeviceTests, givenMtPreemptionEnabledWhenCreatingRootCsrThenCreatePreemptionAllocation) {
DebugManagerStateRestore restorer;
debugManager.flags.CreateMultipleSubDevices.set(2);
debugManager.flags.ForcePreemptionMode.set(4);
UltDeviceFactory deviceFactory{1, 2};
EXPECT_TRUE(deviceFactory.rootDevices[0]->getDefaultEngine().osContext->isRootDevice());
EXPECT_NE(nullptr, deviceFactory.rootDevices[0]->getDefaultEngine().commandStreamReceiver->getPreemptionAllocation());
}
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZexNumberOfCssEnvVariableDefinedWhenDeviceIsCreatedThenCreateDevicesWithProperCcsCount) {
VariableBackup<UltHwConfig> backup(&ultHwConfig);
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;