Fix level zero event synchronization issues for TBX mode

This change has two issues fixed.
First fix assures event must not download all allocations sent to GPU
when event is not ready.
Second fix performs page walk on event allocation before event allocation
can be downloaded, as download before page walk is not supported scenario
in TBX mode.

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2022-12-06 16:15:22 +00:00
committed by Compute-Runtime-Automation
parent b04277ef32
commit 9f8911e9da
6 changed files with 259 additions and 45 deletions

View File

@@ -190,6 +190,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
void downloadAllocations() override {
downloadAllocationCalled = true;
downloadAllocationsCalled = true;
downloadAllocationsCalledCount++;
}
void downloadAllocationUlt(GraphicsAllocation &gfxAllocation) {
@@ -362,14 +363,15 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
BatchBuffer latestFlushedBatchBuffer = {};
std::atomic<uint32_t> recursiveLockCounter;
std::atomic<TaskCountType> latestWaitForCompletionWithTimeoutTaskCount{0};
std::atomic<uint32_t> waitForCompletionWithTimeoutTaskCountCalled{0};
TaskCountType latestSentTaskCountValueDuringFlush = 0;
TaskCountType flushBcsTaskReturnValue{};
LinearStream *lastFlushedCommandStream = nullptr;
std::atomic<uint32_t> recursiveLockCounter;
std::atomic<uint32_t> waitForCompletionWithTimeoutTaskCountCalled{0};
uint32_t makeSurfacePackNonResidentCalled = false;
TaskCountType latestSentTaskCountValueDuringFlush = 0;
uint32_t blitBufferCalled = 0;
uint32_t createPerDssBackedBufferCalled = 0;
uint32_t initDirectSubmissionCalled = 0;
@@ -378,8 +380,13 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
DispatchFlags recordedDispatchFlags;
BlitPropertiesContainer receivedBlitProperties = {};
uint32_t createAllocationForHostSurfaceCalled = 0;
bool cpuCopyForHostPtrSurfaceAllowed = false;
WaitStatus returnWaitForCompletionWithTimeout = WaitStatus::Ready;
std::optional<WaitStatus> waitForTaskCountWithKmdNotifyFallbackReturnValue{};
std::optional<SubmissionStatus> flushReturnValue{};
CommandStreamReceiverType commandStreamReceiverType = CommandStreamReceiverType::CSR_HW;
uint32_t downloadAllocationsCalledCount = 0;
bool cpuCopyForHostPtrSurfaceAllowed = false;
bool createPageTableManagerCalled = false;
bool recordFlusheBatchBuffer = false;
bool checkAndActivateAubSubCaptureCalled = false;
@@ -397,12 +404,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
bool shouldFailFlushBatchedSubmissions = false;
bool shouldFlushBatchedSubmissionsReturnSuccess = false;
bool callBaseFillReusableAllocationsList = false;
WaitStatus returnWaitForCompletionWithTimeout = WaitStatus::Ready;
std::optional<WaitStatus> waitForTaskCountWithKmdNotifyFallbackReturnValue{};
bool callBaseFlushBcsTask{true};
TaskCountType flushBcsTaskReturnValue{};
std::optional<SubmissionStatus> flushReturnValue{};
CommandStreamReceiverType commandStreamReceiverType = CommandStreamReceiverType::CSR_HW;
};
} // namespace NEO

View File

@@ -10,6 +10,8 @@
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/test_macros/mock_method_macros.h"
#include <algorithm>
namespace NEO {
class GraphicsAllocation;
@@ -40,13 +42,35 @@ class MockMemoryOperations : public MemoryOperationsHandler {
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override {
makeResidentCalledCount++;
if (captureGfxAllocationsForMakeResident) {
for (auto &gfxAllocation : gfxAllocations) {
gfxAllocationsForMakeResident.push_back(gfxAllocation);
}
}
return MemoryOperationsStatus::SUCCESS;
}
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override {
evictCalledCount++;
if (captureGfxAllocationsForMakeResident) {
auto allocIterator = std::find(gfxAllocationsForMakeResident.begin(), gfxAllocationsForMakeResident.end(), &gfxAllocation);
if (allocIterator != gfxAllocationsForMakeResident.end()) {
gfxAllocationsForMakeResident.erase(allocIterator);
return MemoryOperationsStatus::SUCCESS;
} else {
return MemoryOperationsStatus::MEMORY_NOT_FOUND;
}
}
return MemoryOperationsStatus::SUCCESS;
}
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override {
isResidentCalledCount++;
if (captureGfxAllocationsForMakeResident) {
if (std::find(gfxAllocationsForMakeResident.begin(), gfxAllocationsForMakeResident.end(), &gfxAllocation) != gfxAllocationsForMakeResident.end()) {
return MemoryOperationsStatus::SUCCESS;
} else {
return MemoryOperationsStatus::MEMORY_NOT_FOUND;
}
}
return MemoryOperationsStatus::SUCCESS;
}
@@ -70,6 +94,7 @@ class MockMemoryOperations : public MemoryOperationsHandler {
std::vector<GraphicsAllocation *> gfxAllocationsForMakeResident{};
int makeResidentCalledCount = 0;
int evictCalledCount = 0;
uint32_t isResidentCalledCount = 0;
uint32_t makeResidentContextId = std::numeric_limits<uint32_t>::max();
bool captureGfxAllocationsForMakeResident = false;
};