mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
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:
committed by
sys_ocldev
parent
10ada58bd6
commit
87f8f735f9
@@ -85,8 +85,6 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
virtual void programVFEState(LinearStream &csr, DispatchFlags &dispatchFlags);
|
||||
virtual void initPageTableManagerRegisters(LinearStream &csr){};
|
||||
|
||||
virtual int64_t computeTimeoutMultiplier(bool useQuickKmdSleep, uint32_t taskCountToWait) const { return 1u; };
|
||||
|
||||
void addPipeControlWA(LinearStream &commandStream, bool flushDC);
|
||||
void addDcFlushToPipeControl(typename GfxFamily::PIPE_CONTROL *pCmd, bool flushDC);
|
||||
PIPE_CONTROL *addPipeControlCmd(LinearStream &commandStream);
|
||||
|
||||
@@ -569,12 +569,12 @@ inline void CommandStreamReceiverHw<GfxFamily>::emitNoop(LinearStream &commandSt
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) {
|
||||
const auto &kmdNotifyProperties = this->hwInfo.capabilityTable.kmdNotifyProperties;
|
||||
useQuickKmdSleep |= kmdNotifyProperties.applyQuickKmdSleepForSporadicWait(lastWaitForCompletionTimestamp);
|
||||
|
||||
int64_t kmdNotifyDelay = kmdNotifyProperties.selectDelay(useQuickKmdSleep) * computeTimeoutMultiplier(useQuickKmdSleep, taskCountToWait);
|
||||
int64_t waitTimeout = kmdNotifyProperties.pickTimeoutValue(lastWaitForCompletionTimestamp, useQuickKmdSleep, *getTagAddress(), taskCountToWait);
|
||||
|
||||
auto status = waitForCompletionWithTimeout(kmdNotifyProperties.enableKmdNotify && flushStampToWait != 0,
|
||||
kmdNotifyDelay, taskCountToWait);
|
||||
auto status = waitForCompletionWithTimeout(kmdNotifyProperties.timeoutEnabled(flushStampToWait),
|
||||
waitTimeout,
|
||||
taskCountToWait);
|
||||
if (!status) {
|
||||
waitForFlushStamp(flushStampToWait);
|
||||
//now call blocking wait, this is to ensure that task count is reached
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/helpers/completion_stamp.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
|
||||
@@ -36,9 +38,12 @@ struct KmdNotifyProperties {
|
||||
bool enableQuickKmdSleepForSporadicWaits;
|
||||
int64_t delayQuickKmdSleepForSporadicWaitsMicroseconds;
|
||||
|
||||
bool applyQuickKmdSleepForSporadicWait(std::chrono::high_resolution_clock::time_point &lastWaitTimestamp) const;
|
||||
bool timeoutEnabled(FlushStamp flushStampToWait) const;
|
||||
|
||||
const int64_t &selectDelay(bool useQuickKmdSleep) const;
|
||||
int64_t pickTimeoutValue(std::chrono::high_resolution_clock::time_point &lastWaitTimestamp,
|
||||
bool quickKmdSleepRequest, uint32_t currentHwTag, uint32_t taskCountToWait) const;
|
||||
|
||||
bool applyQuickKmdSleepForSporadicWait(std::chrono::high_resolution_clock::time_point &lastWaitTimestamp) const;
|
||||
|
||||
static void overrideFromDebugVariable(int32_t debugVariableValue, int64_t &destination);
|
||||
static void overrideFromDebugVariable(int32_t debugVariableValue, bool &destination);
|
||||
|
||||
@@ -67,7 +67,6 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
|
||||
protected:
|
||||
void makeResident(BufferObject *bo);
|
||||
void programVFEState(LinearStream &csr, DispatchFlags &dispatchFlags) override;
|
||||
int64_t computeTimeoutMultiplier(bool useQuickKmdSleep, uint32_t taskCountToWait) const override;
|
||||
|
||||
std::vector<BufferObject *> residency;
|
||||
std::vector<drm_i915_gem_exec_object2> execObjectsStorage;
|
||||
|
||||
@@ -191,12 +191,4 @@ inline void DrmCommandStreamReceiver<GfxFamily>::programVFEState(LinearStream &c
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline int64_t DrmCommandStreamReceiver<GfxFamily>::computeTimeoutMultiplier(bool useQuickKmdSleep, uint32_t taskCountToWait) const {
|
||||
auto currentHwTag = *getTagAddress();
|
||||
if (currentHwTag >= taskCountToWait || useQuickKmdSleep) {
|
||||
return 1u;
|
||||
}
|
||||
return static_cast<int64_t>(taskCountToWait - currentHwTag);
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
||||
Reference in New Issue
Block a user