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:
parent
966aa460f7
commit
a17df8fa86
|
@ -58,10 +58,10 @@ struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
|
|||
gfxAllocation.updateResidencyTaskCount(1, osContext->getContextId());
|
||||
}
|
||||
|
||||
bool processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override {
|
||||
SubmissionStatus processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override {
|
||||
processResidencyParameterization.wasCalled = true;
|
||||
processResidencyParameterization.receivedAllocationsForResidency = &allocationsForResidency;
|
||||
return true;
|
||||
return SubmissionStatus::SUCCESS;
|
||||
}
|
||||
|
||||
void makeNonResident(GraphicsAllocation &gfxAllocation) override {
|
||||
|
|
|
@ -42,7 +42,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
|||
|
||||
SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
||||
|
||||
bool processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
||||
SubmissionStatus processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
||||
|
||||
void makeResidentExternal(AllocationView &allocationView);
|
||||
void makeNonResidentExternal(uint64_t gpuAddress);
|
||||
|
|
|
@ -742,10 +742,10 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::expectMemory(const void *gfxAddress,
|
|||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool AUBCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {
|
||||
SubmissionStatus AUBCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {
|
||||
if (subCaptureManager->isSubCaptureMode()) {
|
||||
if (!subCaptureManager->isSubCaptureEnabled()) {
|
||||
return true;
|
||||
return SubmissionStatus::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -767,7 +767,7 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyCont
|
|||
}
|
||||
|
||||
dumpAubNonWritable = false;
|
||||
return true;
|
||||
return SubmissionStatus::SUCCESS;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
|
|
@ -98,7 +98,7 @@ class CommandStreamReceiver {
|
|||
MOCKABLE_VIRTUAL void makeResident(GraphicsAllocation &gfxAllocation);
|
||||
virtual void makeNonResident(GraphicsAllocation &gfxAllocation);
|
||||
MOCKABLE_VIRTUAL void makeSurfacePackNonResident(ResidencyContainer &allocationsForResidency, bool clearAllocations);
|
||||
virtual bool processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) { return true; }
|
||||
virtual SubmissionStatus processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) { return SubmissionStatus::SUCCESS; }
|
||||
virtual void processEviction();
|
||||
void makeResidentHostPtrAllocation(GraphicsAllocation *gfxAllocation);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
|||
void downloadAllocationTbx(GraphicsAllocation &gfxAllocation);
|
||||
|
||||
void processEviction() override;
|
||||
bool processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
||||
SubmissionStatus processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
||||
void writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits) override;
|
||||
bool writeMemory(GraphicsAllocation &gfxAllocation) override;
|
||||
void writeMMIO(uint32_t offset, uint32_t value) override;
|
||||
|
|
|
@ -515,7 +515,7 @@ void TbxCommandStreamReceiverHw<GfxFamily>::processEviction() {
|
|||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool TbxCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {
|
||||
SubmissionStatus TbxCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {
|
||||
for (auto &gfxAllocation : allocationsForResidency) {
|
||||
if (dumpTbxNonWritable) {
|
||||
this->setTbxWritable(true, *gfxAllocation);
|
||||
|
@ -528,7 +528,7 @@ bool TbxCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyCont
|
|||
}
|
||||
|
||||
dumpTbxNonWritable = false;
|
||||
return true;
|
||||
return SubmissionStatus::SUCCESS;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
|
|
@ -45,7 +45,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
|
|||
~DrmCommandStreamReceiver() override;
|
||||
|
||||
SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
||||
bool processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
||||
SubmissionStatus processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
||||
void makeNonResident(GraphicsAllocation &gfxAllocation) override;
|
||||
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
|
||||
bool isKmdWaitModeActive() override;
|
||||
|
|
|
@ -247,9 +247,9 @@ int DrmCommandStreamReceiver<GfxFamily>::exec(const BatchBuffer &batchBuffer, ui
|
|||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool DrmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) {
|
||||
SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) {
|
||||
if (drm->isVmBindAvailable()) {
|
||||
return true;
|
||||
return SubmissionStatus::SUCCESS;
|
||||
}
|
||||
int ret = 0;
|
||||
for (auto &alloc : inputAllocationsForResidency) {
|
||||
|
@ -260,7 +260,7 @@ bool DrmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContai
|
|||
}
|
||||
}
|
||||
|
||||
return ret == 0;
|
||||
return Drm::getSubmissionStatusFromReturnCode(ret);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace NEO {
|
|||
|
||||
template <typename GfxFamily>
|
||||
SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency) {
|
||||
bool processResidencySuccess = this->processResidency(allocationsForResidency, 0u);
|
||||
if (processResidencySuccess == false) {
|
||||
return SubmissionStatus::OUT_OF_MEMORY;
|
||||
auto processResidencySuccess = this->processResidency(allocationsForResidency, 0u);
|
||||
if (processResidencySuccess != SubmissionStatus::SUCCESS) {
|
||||
return processResidencySuccess;
|
||||
}
|
||||
|
||||
int ret = this->exec(batchBuffer, 0u, static_cast<const OsContextLinux *>(osContext)->getDrmContextIds()[0], 0);
|
||||
|
|
|
@ -28,9 +28,9 @@ SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchB
|
|||
tileIterator = contextIndex = DebugManager.flags.ForceExecutionTile.get();
|
||||
}
|
||||
|
||||
bool processResidencySuccess = this->processResidency(allocationsForResidency, tileIterator);
|
||||
if (processResidencySuccess == false) {
|
||||
return SubmissionStatus::OUT_OF_MEMORY;
|
||||
auto processResidencySuccess = this->processResidency(allocationsForResidency, tileIterator);
|
||||
if (processResidencySuccess != SubmissionStatus::SUCCESS) {
|
||||
return processResidencySuccess;
|
||||
}
|
||||
|
||||
if (DebugManager.flags.PrintDeviceAndEngineIdOnSubmission.get()) {
|
||||
|
|
|
@ -26,7 +26,7 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
|
|||
~WddmCommandStreamReceiver() override;
|
||||
|
||||
SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
||||
bool processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
||||
SubmissionStatus processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
|
||||
void processEviction() override;
|
||||
bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
|
||||
|
||||
|
|
|
@ -77,19 +77,19 @@ SubmissionStatus WddmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchB
|
|||
batchBuffer.commandBufferAllocation->updateResidencyTaskCount(this->taskCount, this->osContext->getContextId());
|
||||
perfLogResidencyVariadicLog(wddm->getResidencyLogger(), "Wddm CSR processing residency set: %zu\n", allocationsForResidency.size());
|
||||
|
||||
bool ret = this->processResidency(allocationsForResidency, 0u);
|
||||
if (ret == false) {
|
||||
return SubmissionStatus::OUT_OF_MEMORY;
|
||||
auto submissionStatus = this->processResidency(allocationsForResidency, 0u);
|
||||
if (submissionStatus != SubmissionStatus::SUCCESS) {
|
||||
return submissionStatus;
|
||||
}
|
||||
if (this->directSubmission.get()) {
|
||||
ret = this->directSubmission->dispatchCommandBuffer(batchBuffer, *(this->flushStamp.get()));
|
||||
auto ret = this->directSubmission->dispatchCommandBuffer(batchBuffer, *(this->flushStamp.get()));
|
||||
if (ret == false) {
|
||||
return SubmissionStatus::FAILED;
|
||||
}
|
||||
return SubmissionStatus::SUCCESS;
|
||||
}
|
||||
if (this->blitterDirectSubmission.get()) {
|
||||
ret = this->blitterDirectSubmission->dispatchCommandBuffer(batchBuffer, *(this->flushStamp.get()));
|
||||
auto ret = this->blitterDirectSubmission->dispatchCommandBuffer(batchBuffer, *(this->flushStamp.get()));
|
||||
if (ret == false) {
|
||||
return SubmissionStatus::FAILED;
|
||||
}
|
||||
|
@ -133,8 +133,8 @@ SubmissionStatus WddmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchB
|
|||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool WddmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {
|
||||
return static_cast<OsContextWin *>(this->osContext)->getResidencyController().makeResidentResidencyAllocations(allocationsForResidency);
|
||||
SubmissionStatus WddmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {
|
||||
return static_cast<OsContextWin *>(this->osContext)->getResidencyController().makeResidentResidencyAllocations(allocationsForResidency) ? SubmissionStatus::SUCCESS : SubmissionStatus::OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
|
|
@ -77,7 +77,7 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
|
|||
return this->submissionAggregator.get();
|
||||
}
|
||||
|
||||
ADDMETHOD(processResidency, bool, true, true, (const ResidencyContainer &allocationsForResidency, uint32_t handleId), (allocationsForResidency, handleId));
|
||||
ADDMETHOD(processResidency, SubmissionStatus, true, SubmissionStatus::SUCCESS, (const ResidencyContainer &allocationsForResidency, uint32_t handleId), (allocationsForResidency, handleId));
|
||||
|
||||
ADDMETHOD(exec, int, true, 0, (const BatchBuffer &batchBuffer, uint32_t vmHandleId, uint32_t drmContextId, uint32_t index), (batchBuffer, vmHandleId, drmContextId, index));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue