mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 18:06:32 +08:00
Create structure UsageInfo for task count and residency task count
Change-Id: I0899c88d9e567a09ba46461ae69cf6c80f713e67 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
e599d1503b
commit
0e0a280803
@@ -16,16 +16,11 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenIsCreatedThenTaskCountsA
|
||||
for (auto i = 0u; i < maxOsContextCount; i++) {
|
||||
EXPECT_EQ(ObjectNotUsed, graphicsAllocation1.getTaskCount(i));
|
||||
EXPECT_EQ(ObjectNotUsed, graphicsAllocation2.getTaskCount(i));
|
||||
EXPECT_EQ(ObjectNotResident, graphicsAllocation1.getResidencyTaskCount(i));
|
||||
EXPECT_EQ(ObjectNotResident, graphicsAllocation2.getResidencyTaskCount(i));
|
||||
}
|
||||
}
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenAccessTaskCountForInvalidContextThenAbort) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
EXPECT_THROW(graphicsAllocation.getTaskCount(maxOsContextCount), std::exception);
|
||||
}
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdateTaskCountForInvalidContextThenAbort) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
EXPECT_THROW(graphicsAllocation.updateTaskCount(0u, maxOsContextCount), std::exception);
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedTaskCountThenAllocationWasUsed) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
EXPECT_FALSE(graphicsAllocation.peekWasUsed());
|
||||
@@ -67,3 +62,24 @@ TEST(GraphicsAllocationTest, whenTwoContextsUpdatedTaskCountAndOneOfThemUnregist
|
||||
graphicsAllocation.updateTaskCount(ObjectNotUsed, 1u);
|
||||
EXPECT_FALSE(graphicsAllocation.peekWasUsed());
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedResidencyTaskCountToNonDefaultValueThenAllocationIsResident) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
EXPECT_FALSE(graphicsAllocation.isResident(0u));
|
||||
int residencyTaskCount = 1;
|
||||
graphicsAllocation.updateResidencyTaskCount(residencyTaskCount, 0u);
|
||||
EXPECT_EQ(residencyTaskCount, graphicsAllocation.getResidencyTaskCount(0u));
|
||||
EXPECT_TRUE(graphicsAllocation.isResident(0u));
|
||||
graphicsAllocation.updateResidencyTaskCount(ObjectNotResident, 0u);
|
||||
EXPECT_EQ(ObjectNotResident, graphicsAllocation.getResidencyTaskCount(0u));
|
||||
EXPECT_FALSE(graphicsAllocation.isResident(0u));
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, givenResidentGraphicsAllocationWhenResetResidencyTaskCountThenAllocationIsNotResident) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
graphicsAllocation.updateResidencyTaskCount(1, 0u);
|
||||
EXPECT_TRUE(graphicsAllocation.isResident(0u));
|
||||
|
||||
graphicsAllocation.resetResidencyTaskCount(0u);
|
||||
EXPECT_FALSE(graphicsAllocation.isResident(0u));
|
||||
}
|
||||
|
||||
@@ -1392,13 +1392,6 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation
|
||||
EXPECT_EQ(expectedGpuAddress, graphicsAllocation.getGpuAddress());
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocation, givenGraphicsAllocationCreatedWithDefaultConstructorThenItIsNotResidentInAllContexts) {
|
||||
MockGraphicsAllocation graphicsAllocation(nullptr, 1u);
|
||||
for (uint32_t index = 0u; index < maxOsContextCount; index++) {
|
||||
EXPECT_EQ(ObjectNotResident, graphicsAllocation.residencyTaskCount[index]);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCountIncreases) {
|
||||
auto osContext = new OsContext(nullptr, 0u);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
||||
Reference in New Issue
Block a user