mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
Enhance ResidencyData to work with multiple OsContext
- Add new method updateCompletionData to register completion fence and context - remove obsolete methods and fields - for trimming choose default 0 OsContext Change-Id: I0f6c7af9499a454a70ad1c5b0fa2766416eba297
This commit is contained in:
committed by
sys_ocldev
parent
b11e7b961a
commit
ac2a2de3be
@@ -1810,13 +1810,40 @@ TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCo
|
||||
EXPECT_EQ(1, osContext->getRefInternalCount());
|
||||
}
|
||||
|
||||
TEST(ResidencyDataTest, givenOsContextWhenItIsAddedToResidencyThenItCantBeOverwritten) {
|
||||
ResidencyData residency;
|
||||
TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenItIsProperlyUpdated) {
|
||||
struct mockResidencyData : public ResidencyData {
|
||||
using ResidencyData::completionData;
|
||||
};
|
||||
|
||||
mockResidencyData residency;
|
||||
|
||||
OsContext osContext(nullptr);
|
||||
OsContext osContext2(nullptr);
|
||||
EXPECT_EQ(nullptr, residency.osContext);
|
||||
residency.addOsContext(&osContext);
|
||||
EXPECT_EQ(&osContext, residency.osContext);
|
||||
residency.addOsContext(&osContext2);
|
||||
EXPECT_EQ(&osContext, residency.osContext);
|
||||
osContext2.setContextId(1u);
|
||||
|
||||
auto lastFenceValue = 45llu;
|
||||
auto lastFenceValue2 = 23llu;
|
||||
auto lastFenceValue3 = 373llu;
|
||||
|
||||
EXPECT_EQ(0u, residency.completionData.size());
|
||||
|
||||
residency.updateCompletionData(lastFenceValue, &osContext);
|
||||
EXPECT_EQ(1u, residency.completionData.size());
|
||||
EXPECT_EQ(&osContext, residency.completionData[0].osContext);
|
||||
EXPECT_EQ(lastFenceValue, residency.completionData[0].lastFence);
|
||||
EXPECT_EQ(lastFenceValue, residency.getFenceValueForContextId(osContext.getContextId()));
|
||||
EXPECT_EQ(&osContext, residency.getOsContextFromId(0u));
|
||||
|
||||
residency.updateCompletionData(lastFenceValue2, &osContext2);
|
||||
|
||||
EXPECT_EQ(2u, residency.completionData.size());
|
||||
EXPECT_EQ(&osContext2, residency.completionData[1].osContext);
|
||||
EXPECT_EQ(lastFenceValue2, residency.completionData[1].lastFence);
|
||||
EXPECT_EQ(lastFenceValue2, residency.getFenceValueForContextId(osContext2.getContextId()));
|
||||
EXPECT_EQ(&osContext2, residency.getOsContextFromId(1u));
|
||||
|
||||
residency.updateCompletionData(lastFenceValue3, &osContext2);
|
||||
EXPECT_EQ(lastFenceValue3, residency.completionData[1].lastFence);
|
||||
EXPECT_EQ(lastFenceValue3, residency.getFenceValueForContextId(osContext2.getContextId()));
|
||||
EXPECT_EQ(&osContext2, residency.getOsContextFromId(1u));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user