Make work partition allocation resident

Related-To: NEO-5546

Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2021-03-04 12:37:56 +00:00
committed by Compute-Runtime-Automation
parent 9f3218775d
commit c361570fab
2 changed files with 39 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/dispatch_flags_helper.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "opencl/source/helpers/hardware_commands_helper.h"
#include "opencl/source/mem_obj/buffer.h"
@ -1941,3 +1942,37 @@ TEST(MultiRootDeviceCommandStreamReceiverTests, givenMultipleEventInMultiRootDev
EXPECT_EQ(2u, mockCsr3->waitForCompletionWithTimeoutCalled);
}
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenStaticPartitioningEnabledWhenFlushingTaskThenWorkPartitionAllocationIsMadeResident) {
DebugManagerStateRestore restore{};
DebugManager.flags.EnableStaticPartitioning.set(1);
DebugManager.flags.ForcePreemptionMode.set(PreemptionMode::Disabled);
UltDeviceFactory deviceFactory{1, 2};
MockDevice *device = deviceFactory.rootDevices[0];
auto &mockCsr = device->getUltCommandStreamReceiver<FamilyType>();
ASSERT_NE(nullptr, mockCsr.getWorkPartitionAllocation());
auto mockedSubmissionsAggregator = new mockSubmissionsAggregator();
mockCsr.overrideDispatchPolicy(DispatchMode::BatchedDispatch);
mockCsr.submissionAggregator.reset(mockedSubmissionsAggregator);
DispatchFlags dispatchFlags = DispatchFlagsHelper::createDefaultDispatchFlags();
mockCsr.flushTask(commandStream,
0,
dsh,
ioh,
ssh,
taskLevel,
dispatchFlags,
*device);
auto cmdBuffer = mockedSubmissionsAggregator->peekCommandBuffers().peekHead();
bool found = false;
for (auto allocation : cmdBuffer->surfaces) {
if (allocation == mockCsr.getWorkPartitionAllocation()) {
found = true;
break;
}
}
EXPECT_TRUE(found);
}