test: ensure thread safety when capturing input params for wait function

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2025-05-08 08:46:47 +00:00 committed by Compute-Runtime-Automation
parent f6796c7384
commit adc40934ae
2 changed files with 8 additions and 1 deletions

View File

@ -6805,6 +6805,7 @@ HWTEST_F(DeviceSimpleTests, givenNoGpuHangWhenSynchronizingDeviceThenCallWaitFor
csr->latestFlushedTaskCount = 0u;
csr->taskCount = taskCountToWait++;
csr->flushStamp->setStamp(flushStampToWait++);
csr->captureWaitForTaskCountWithKmdNotifyInputParams = true;
csr->waitForTaskCountWithKmdNotifyFallbackReturnValue = WaitStatus::ready;
}
@ -6815,6 +6816,7 @@ HWTEST_F(DeviceSimpleTests, givenNoGpuHangWhenSynchronizingDeviceThenCallWaitFor
csr->latestFlushedTaskCount = 0u;
csr->taskCount = taskCountToWait++;
csr->flushStamp->setStamp(flushStampToWait++);
csr->captureWaitForTaskCountWithKmdNotifyInputParams = true;
csr->waitForTaskCountWithKmdNotifyFallbackReturnValue = WaitStatus::ready;
}

View File

@ -330,7 +330,11 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
}
WaitStatus waitForTaskCountWithKmdNotifyFallback(TaskCountType taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, QueueThrottle throttle) override {
waitForTaskCountWithKmdNotifyInputParams.push_back({taskCountToWait, flushStampToWait, useQuickKmdSleep, throttle});
if (captureWaitForTaskCountWithKmdNotifyInputParams) {
static std::mutex waitForTaskCountWithKmdNotifyInputParamsMtx;
std::unique_lock<std::mutex> lock(waitForTaskCountWithKmdNotifyInputParamsMtx);
waitForTaskCountWithKmdNotifyInputParams.push_back({taskCountToWait, flushStampToWait, useQuickKmdSleep, throttle});
}
if (waitForTaskCountWithKmdNotifyFallbackReturnValue.has_value()) {
return *waitForTaskCountWithKmdNotifyFallbackReturnValue;
}
@ -667,6 +671,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
bool isUserFenceWaitSupported = false;
bool isAnyDirectSubmissionEnabledCallBase = true;
bool isAnyDirectSubmissionEnabledResult = true;
std::atomic_bool captureWaitForTaskCountWithKmdNotifyInputParams = false;
};
} // namespace NEO