Return SubmissionStatus from processResidency method

it allows to return non-binary status to API layer

Related-To: NEO-7412
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-11-15 10:04:19 +00:00
committed by Compute-Runtime-Automation
parent 966aa460f7
commit a17df8fa86
15 changed files with 61 additions and 39 deletions

View File

@@ -601,7 +601,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenRecordedCommandBufferWhen
mm->freeGraphicsMemory(commandBuffer);
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingProcessResidencyWhenFlushingThenFlushReturnsOutOfMemory) {
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenProcessResidencyFailingOnOutOfMemoryWhenFlushingThenFlushReturnsOutOfMemory) {
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
LinearStream cs(commandBuffer);
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
@@ -613,7 +613,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingProcessResidencyWhe
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
testedCsr->processResidencyCallBase = false;
testedCsr->processResidencyResult = false;
testedCsr->processResidencyResult = SubmissionStatus::OUT_OF_MEMORY;
SubmissionStatus ret = csr->flush(batchBuffer, csr->getResidencyAllocations());
EXPECT_EQ(SubmissionStatus::OUT_OF_MEMORY, ret);
@@ -623,6 +623,28 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingProcessResidencyWhe
mm->freeGraphicsMemory(commandBuffer);
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenProcessResidencyFailingOnOutOfHostMemoryWhenFlushingThenFlushReturnsOutOfHostMemory) {
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
LinearStream cs(commandBuffer);
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
EncodeNoop<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1));
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
testedCsr->processResidencyCallBase = false;
testedCsr->processResidencyResult = SubmissionStatus::OUT_OF_HOST_MEMORY;
SubmissionStatus ret = csr->flush(batchBuffer, csr->getResidencyAllocations());
EXPECT_EQ(SubmissionStatus::OUT_OF_HOST_MEMORY, ret);
EXPECT_EQ(testedCsr->flushInternalCalled, 1u);
EXPECT_EQ(testedCsr->processResidencyCalled, 1u);
mm->freeGraphicsMemory(allocation);
mm->freeGraphicsMemory(commandBuffer);
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingExecWhenFlushingThenFlushReturnsFailed) {
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
LinearStream cs(commandBuffer);
@@ -635,7 +657,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingExecWhenFlushingThe
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
testedCsr->processResidencyCallBase = true;
testedCsr->processResidencyResult = true;
testedCsr->processResidencyResult = SubmissionStatus::SUCCESS;
testedCsr->execCallBase = false;
testedCsr->execResult = -1;

View File

@@ -275,7 +275,7 @@ class DrmCommandStreamForceTileTest : public ::testing::Test {
: DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield, mode), expectedHandleId(inputHandleId) {
}
bool processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override {
SubmissionStatus processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override {
EXPECT_EQ(handleId, expectedHandleId);
return DrmCommandStreamReceiver<GfxFamily>::processResidency(allocationsForResidency, handleId);
}
@@ -587,11 +587,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenUseSingle
execCalled++;
return 0;
}
bool processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) override {
SubmissionStatus processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) override {
EXPECT_EQ(0u, processResidencyCalled);
EXPECT_EQ(0u, handleId);
processResidencyCalled++;
return true;
return SubmissionStatus::SUCCESS;
}
uint32_t execCalled = 0;
@@ -628,11 +628,11 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenDisabledI
execCalled++;
return 0;
}
bool processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) override {
SubmissionStatus processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) override {
EXPECT_EQ(0u, processResidencyCalled);
EXPECT_EQ(0u, handleId);
processResidencyCalled++;
return true;
return SubmissionStatus::SUCCESS;
}
uint32_t execCalled = 0;
@@ -665,9 +665,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenMultiTile
execCalled++;
return 0;
}
bool processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) override {
SubmissionStatus processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) override {
EXPECT_EQ(execCalled, handleId);
return true;
return SubmissionStatus::SUCCESS;
}
uint32_t execCalled = 0;