Fix to make globalFenceAllocation resident before submission via flushSmallTask

Signed-off-by: Vinod Tipparaju <vinod.tipparaju@intel.com>
This commit is contained in:
Vinod Tipparaju
2021-05-13 01:50:22 +05:30
committed by Compute-Runtime-Automation
parent 129f4c6045
commit ed9290e650
3 changed files with 46 additions and 0 deletions

View File

@ -465,6 +465,40 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenc
EXPECT_TRUE(commandStreamReceiver->isMadeNonResident(globalFenceAllocation));
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenceAllocationIsRequiredAndCreatedThenItIsMadeResidentDuringFlushSmallTask) {
RAIIHwHelperFactory<MockHwHelperWithFenceAllocation<FamilyType>> hwHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily};
MockCsrHw<FamilyType> csr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
csr.setupContext(*pDevice->getDefaultEngine().osContext);
EXPECT_EQ(nullptr, csr.globalFenceAllocation);
EXPECT_TRUE(csr.createGlobalFenceAllocation());
EXPECT_FALSE(csr.isMadeResident(csr.globalFenceAllocation));
EXPECT_FALSE(csr.isMadeNonResident(csr.globalFenceAllocation));
flushSmallTask(csr);
EXPECT_TRUE(csr.isMadeResident(csr.globalFenceAllocation));
EXPECT_TRUE(csr.isMadeNonResident(csr.globalFenceAllocation));
ASSERT_NE(nullptr, csr.globalFenceAllocation);
EXPECT_EQ(GraphicsAllocation::AllocationType::GLOBAL_FENCE, csr.globalFenceAllocation->getAllocationType());
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenceAllocationIsRequiredButNotCreatedThenItIsNotMadeResidentDuringFlushSmallTask) {
RAIIHwHelperFactory<MockHwHelperWithFenceAllocation<FamilyType>> hwHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily};
MockCsrHw<FamilyType> csr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
csr.setupContext(*pDevice->getDefaultEngine().osContext);
EXPECT_EQ(nullptr, csr.globalFenceAllocation);
flushSmallTask(csr);
ASSERT_EQ(nullptr, csr.globalFenceAllocation);
}
struct MockScratchController : public ScratchSpaceController {
using ScratchSpaceController::privateScratchAllocation;
using ScratchSpaceController::scratchAllocation;