Add missing download allocation calls

Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Jobczyk, Lukasz
2022-03-29 15:31:51 +00:00
committed by Compute-Runtime-Automation
parent 01e76998d4
commit a285712cc4
7 changed files with 59 additions and 15 deletions

View File

@@ -128,6 +128,12 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
const DeviceBitfield deviceBitfield)
: BaseClass(executionEnvironment, rootDeviceIndex, deviceBitfield), recursiveLockCounter(0),
recordedDispatchFlags(DispatchFlagsHelper::createDefaultDispatchFlags()) {
this->downloadAllocationImpl = [this](GraphicsAllocation &graphicsAllocation) {
this->downloadAllocationUlt(graphicsAllocation);
};
}
~UltCommandStreamReceiver() {
this->downloadAllocationImpl = nullptr;
}
static CommandStreamReceiver *create(bool withAubDump,
ExecutionEnvironment &executionEnvironment,
@@ -171,7 +177,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
downloadAllocationCalled = true;
}
void downloadAllocation(GraphicsAllocation &gfxAllocation) override {
void downloadAllocationUlt(GraphicsAllocation &gfxAllocation) {
downloadAllocationCalled = true;
}
@@ -339,7 +345,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
bool recordFlusheBatchBuffer = false;
bool checkAndActivateAubSubCaptureCalled = false;
bool addAubCommentCalled = false;
bool downloadAllocationCalled = false;
std::atomic_bool downloadAllocationCalled = false;
bool flushBatchedSubmissionsCalled = false;
bool initProgrammingFlagsCalled = false;
bool multiOsContextCapable = false;

View File

@@ -25,7 +25,14 @@ class MockTbxCsr : public TbxCommandStreamReceiverHw<GfxFamily> {
using TbxCommandStreamReceiverHw<GfxFamily>::writeMemory;
using TbxCommandStreamReceiverHw<GfxFamily>::allocationsForDownload;
MockTbxCsr(ExecutionEnvironment &executionEnvironment, const DeviceBitfield deviceBitfield)
: TbxCommandStreamReceiverHw<GfxFamily>(executionEnvironment, 0, deviceBitfield) {}
: TbxCommandStreamReceiverHw<GfxFamily>(executionEnvironment, 0, deviceBitfield) {
this->downloadAllocationImpl = [this](GraphicsAllocation &gfxAllocation) {
this->downloadAllocationTbxMock(gfxAllocation);
};
}
~MockTbxCsr() {
this->downloadAllocationImpl = nullptr;
}
void initializeEngine() override {
TbxCommandStreamReceiverHw<GfxFamily>::initializeEngine();
@@ -50,8 +57,8 @@ class MockTbxCsr : public TbxCommandStreamReceiverHw<GfxFamily> {
TbxCommandStreamReceiverHw<GfxFamily>::pollForCompletion();
pollForCompletionCalled = true;
}
void downloadAllocation(GraphicsAllocation &gfxAllocation) override {
TbxCommandStreamReceiverHw<GfxFamily>::downloadAllocation(gfxAllocation);
void downloadAllocationTbxMock(GraphicsAllocation &gfxAllocation) {
TbxCommandStreamReceiverHw<GfxFamily>::downloadAllocationTbx(gfxAllocation);
makeCoherentCalled = true;
}
void dumpAllocation(GraphicsAllocation &gfxAllocation) override {
@@ -74,9 +81,18 @@ template <typename GfxFamily>
struct MockTbxCsrRegisterDownloadedAllocations : TbxCommandStreamReceiverHw<GfxFamily> {
using CommandStreamReceiver::latestFlushedTaskCount;
using CommandStreamReceiver::tagsMultiAllocation;
using TbxCommandStreamReceiverHw<GfxFamily>::TbxCommandStreamReceiverHw;
using TbxCommandStreamReceiverHw<GfxFamily>::flushSubmissionsAndDownloadAllocations;
void downloadAllocation(GraphicsAllocation &gfxAllocation) override {
MockTbxCsrRegisterDownloadedAllocations(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, const DeviceBitfield deviceBitfield)
: TbxCommandStreamReceiverHw<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield) {
this->downloadAllocationImpl = [this](GraphicsAllocation &gfxAllocation) {
this->downloadAllocationTbxMock(gfxAllocation);
};
}
~MockTbxCsrRegisterDownloadedAllocations() {
this->downloadAllocationImpl = nullptr;
}
void downloadAllocationTbxMock(GraphicsAllocation &gfxAllocation) {
*reinterpret_cast<uint32_t *>(CommandStreamReceiver::getTagAllocation()->getUnderlyingBuffer()) = this->latestFlushedTaskCount;
downloadedAllocations.insert(&gfxAllocation);
}

View File

@@ -301,6 +301,7 @@ HWTEST_F(CommandStreamReceiverTest, givenGpuHangWhenWaititingForTaskCountThenGpu
constexpr auto taskCountToWait = 1;
const auto waitStatus = csr.waitForTaskCount(taskCountToWait);
EXPECT_EQ(WaitStatus::GpuHang, waitStatus);
EXPECT_TRUE(csr.downloadAllocationCalled);
}
HWTEST_F(CommandStreamReceiverTest, givenGpuHangAndNonEmptyAllocationsListWhenCallingWaitForTaskCountAndCleanAllocationListThenWaitIsCalledAndGpuHangIsReturned) {