Move KMD Notify logic from CSR to specialized helper

- Decission about timeout enabling and value moved out of CSR
- Timeout multiplier is no longer Linux specific

Change-Id: I6858fe2f811ef13802b95e0470e310210a9dea8b
This commit is contained in:
Dunajski, Bartosz
2018-04-09 10:05:32 +02:00
committed by sys_ocldev
parent 10ada58bd6
commit 87f8f735f9
10 changed files with 63 additions and 53 deletions

View File

@@ -25,6 +25,23 @@
using namespace OCLRT;
bool KmdNotifyProperties::timeoutEnabled(FlushStamp flushStampToWait) const {
return enableKmdNotify && flushStampToWait != 0;
}
int64_t KmdNotifyProperties::pickTimeoutValue(std::chrono::high_resolution_clock::time_point &lastWaitTimestamp,
bool quickKmdSleepRequest, uint32_t currentHwTag, uint32_t taskCountToWait) const {
quickKmdSleepRequest |= applyQuickKmdSleepForSporadicWait(lastWaitTimestamp);
if (quickKmdSleepRequest && enableQuickKmdSleep) {
return delayQuickKmdSleepMicroseconds;
}
int64_t multiplier = (currentHwTag < taskCountToWait) ? static_cast<int64_t>(taskCountToWait - currentHwTag) : 1;
return delayKmdNotifyMicroseconds * multiplier;
}
bool KmdNotifyProperties::applyQuickKmdSleepForSporadicWait(std::chrono::high_resolution_clock::time_point &lastWaitTimestamp) const {
if (enableQuickKmdSleepForSporadicWaits) {
auto now = std::chrono::high_resolution_clock::now();
@@ -36,11 +53,6 @@ bool KmdNotifyProperties::applyQuickKmdSleepForSporadicWait(std::chrono::high_re
return false;
}
const int64_t &KmdNotifyProperties::selectDelay(bool useQuickKmdSleep) const {
return (useQuickKmdSleep && enableQuickKmdSleep) ? delayQuickKmdSleepMicroseconds
: delayKmdNotifyMicroseconds;
}
void KmdNotifyProperties::overrideFromDebugVariable(int32_t debugVariableValue, int64_t &destination) {
if (debugVariableValue >= 0) {
destination = static_cast<int64_t>(debugVariableValue);