refactor: reduce TBX download timeout for unit tests

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-09-09 15:31:32 +00:00
committed by Compute-Runtime-Automation
parent eec841b662
commit dd8460beba
3 changed files with 9 additions and 2 deletions

View File

@@ -31,6 +31,9 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
uint32_t getMaskAndValueForPollForCompletion() const;
bool getpollNotEqualValueForPollForCompletion() const;
void flushSubmissionsAndDownloadAllocations(TaskCountType taskCount, bool skipAllocationsDownload);
MOCKABLE_VIRTUAL uint64_t getNonBlockingDownloadTimeoutMs() const {
return 2000; // 2s
}
public:
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::initAdditionalMMIO;

View File

@@ -578,7 +578,6 @@ void TbxCommandStreamReceiverHw<GfxFamily>::downloadAllocationTbx(GraphicsAlloca
template <typename GfxFamily>
void TbxCommandStreamReceiverHw<GfxFamily>::downloadAllocations(bool blockingWait, TaskCountType taskCount) {
volatile TagAddressType *pollAddress = this->getTagAddress();
constexpr uint64_t timeoutMs = 1000 * 2; // 2s
auto waitTaskCount = std::min(taskCount, this->latestFlushedTaskCount.load());
@@ -593,7 +592,7 @@ void TbxCommandStreamReceiverHw<GfxFamily>::downloadAllocations(bool blockingWai
if (!blockingWait) {
// Additional delay to reach PC in case of Event wait
timeDiff = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - startTime).count();
if (timeDiff > timeoutMs) {
if (timeDiff > getNonBlockingDownloadTimeoutMs()) {
return;
}
}

View File

@@ -111,6 +111,11 @@ struct MockTbxCsrRegisterDownloadedAllocations : TbxCommandStreamReceiverHw<GfxF
obtainUniqueOwnershipCalled++;
return TbxCommandStreamReceiverHw<GfxFamily>::obtainUniqueOwnership();
}
uint64_t getNonBlockingDownloadTimeoutMs() const override {
return 1;
}
std::set<GraphicsAllocation *> downloadedAllocations;
bool flushBatchedSubmissionsCalled = false;
bool flushTagCalled = false;