mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Command stream receiver: handle flush method failure when flushing BCS task
Related-To: NEO-7412 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
27d042107a
commit
33e1b3a717
@@ -928,4 +928,15 @@ LogicalStateHelper *CommandStreamReceiver::getLogicalStateHelper() const {
|
||||
return logicalStateHelper.get();
|
||||
}
|
||||
|
||||
uint32_t CompletionStamp::getTaskCountFromSubmissionStatusError(SubmissionStatus status) {
|
||||
switch (status) {
|
||||
case SubmissionStatus::OUT_OF_HOST_MEMORY:
|
||||
return CompletionStamp::outOfHostMemory;
|
||||
case SubmissionStatus::OUT_OF_MEMORY:
|
||||
return CompletionStamp::outOfDeviceMemory;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1164,7 +1164,10 @@ uint32_t CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropertiesCo
|
||||
commandStream.getGraphicsAllocation()->updateTaskCount(newTaskCount, this->osContext->getContextId());
|
||||
commandStream.getGraphicsAllocation()->updateResidencyTaskCount(newTaskCount, this->osContext->getContextId());
|
||||
|
||||
flush(batchBuffer, getResidencyAllocations());
|
||||
auto flushSubmissionStatus = flush(batchBuffer, getResidencyAllocations());
|
||||
if (flushSubmissionStatus != SubmissionStatus::SUCCESS) {
|
||||
return CompletionStamp::getTaskCountFromSubmissionStatusError(flushSubmissionStatus);
|
||||
}
|
||||
makeSurfacePackNonResident(getResidencyAllocations(), true);
|
||||
|
||||
if (updateTag) {
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
|
||||
namespace NEO {
|
||||
using FlushStamp = uint64_t;
|
||||
enum class SubmissionStatus : uint32_t;
|
||||
struct CompletionStamp {
|
||||
static uint32_t getTaskCountFromSubmissionStatusError(SubmissionStatus submissionStatus);
|
||||
|
||||
uint32_t taskCount;
|
||||
uint32_t taskLevel;
|
||||
FlushStamp flushStamp;
|
||||
|
||||
@@ -163,6 +163,9 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
}
|
||||
|
||||
NEO::SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override {
|
||||
if (flushReturnValue) {
|
||||
return *flushReturnValue;
|
||||
}
|
||||
if (recordFlusheBatchBuffer) {
|
||||
latestFlushedBatchBuffer = batchBuffer;
|
||||
}
|
||||
@@ -393,6 +396,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
std::optional<WaitStatus> waitForTaskCountWithKmdNotifyFallbackReturnValue{};
|
||||
bool callBaseFlushBcsTask{true};
|
||||
uint32_t flushBcsTaskReturnValue{};
|
||||
std::optional<SubmissionStatus> flushReturnValue{};
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -2321,3 +2321,27 @@ HWTEST_F(CommandStreamReceiverHwTest, givenSshHeapNotProvidedWhenFlushTaskPerfor
|
||||
|
||||
EXPECT_FALSE(scratchController->setRequiredScratchSpaceCalled);
|
||||
}
|
||||
|
||||
TEST(CommandStreamReceiverSimpleTest, whenTranslatingSubmissionStatusToTaskCountValueThenProperValueIsReturned) {
|
||||
EXPECT_EQ(0u, CompletionStamp::getTaskCountFromSubmissionStatusError(SubmissionStatus::SUCCESS));
|
||||
EXPECT_EQ(CompletionStamp::outOfHostMemory, CompletionStamp::getTaskCountFromSubmissionStatusError(SubmissionStatus::OUT_OF_HOST_MEMORY));
|
||||
EXPECT_EQ(CompletionStamp::outOfDeviceMemory, CompletionStamp::getTaskCountFromSubmissionStatusError(SubmissionStatus::OUT_OF_MEMORY));
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverHwTest, givenFailureOnFlushWhenFlushingBcsTaskThenErrorIsPropagated) {
|
||||
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto blitProperties = BlitProperties::constructPropertiesForReadWrite(BlitterConstants::BlitDirection::BufferToHostPtr,
|
||||
commandStreamReceiver, commandStreamReceiver.getTagAllocation(), nullptr,
|
||||
commandStreamReceiver.getTagAllocation()->getUnderlyingBuffer(),
|
||||
commandStreamReceiver.getTagAllocation()->getGpuAddress(), 0,
|
||||
0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
BlitPropertiesContainer container;
|
||||
container.push_back(blitProperties);
|
||||
|
||||
commandStreamReceiver.flushReturnValue = SubmissionStatus::OUT_OF_HOST_MEMORY;
|
||||
EXPECT_EQ(CompletionStamp::outOfHostMemory, commandStreamReceiver.flushBcsTask(container, true, false, *pDevice));
|
||||
commandStreamReceiver.flushReturnValue = SubmissionStatus::OUT_OF_MEMORY;
|
||||
EXPECT_EQ(CompletionStamp::outOfDeviceMemory, commandStreamReceiver.flushBcsTask(container, true, false, *pDevice));
|
||||
}
|
||||
Reference in New Issue
Block a user