performance: Reuse GPU timestamps by default on Windows

Related-To: NEO-10615

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2024-05-28 11:12:18 +00:00
committed by Compute-Runtime-Automation
parent ad155da67a
commit 5e92d530de
11 changed files with 87 additions and 62 deletions

View File

@@ -7,6 +7,7 @@
#include "shared/source/os_interface/linux/device_time_drm.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/register_offsets.h"
#include "shared/source/os_interface/linux/drm_neo.h"
#include "shared/source/os_interface/linux/drm_wrappers.h"
@@ -50,4 +51,12 @@ uint64_t DeviceTimeDrm::getDynamicDeviceTimerClock(HardwareInfo const &hwInfo) c
return static_cast<uint64_t>(nanosecondsPerSecond / OSTime::getDeviceTimerResolution(hwInfo));
}
} // namespace NEO
bool DeviceTimeDrm::isTimestampsRefreshEnabled() const {
bool timestampsRefreshEnabled = false;
if (debugManager.flags.EnableReusingGpuTimestamps.get() != -1) {
timestampsRefreshEnabled = debugManager.flags.EnableReusingGpuTimestamps.get();
}
return timestampsRefreshEnabled;
}
} // namespace NEO

View File

@@ -17,6 +17,7 @@ class DeviceTimeDrm : public DeviceTime {
bool getGpuCpuTimeImpl(TimeStampData *pGpuCpuTime, OSTime *osTime) override;
double getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo) const override;
uint64_t getDynamicDeviceTimerClock(HardwareInfo const &hwInfo) const override;
bool isTimestampsRefreshEnabled() const override;
protected:
Drm *pDrm = nullptr;

View File

@@ -19,13 +19,6 @@ double OSTime::getDeviceTimerResolution(HardwareInfo const &hwInfo) {
return hwInfo.capabilityTable.defaultProfilingTimerResolution;
};
DeviceTime::DeviceTime() {
reusingTimestampsEnabled = debugManager.flags.EnableReusingGpuTimestamps.get();
if (reusingTimestampsEnabled) {
timestampRefreshTimeoutNS = NSEC_PER_MSEC * 100; // 100ms
}
}
bool DeviceTime::getGpuCpuTimeImpl(TimeStampData *pGpuCpuTime, OSTime *osTime) {
pGpuCpuTime->cpuTimeinNS = 0;
pGpuCpuTime->gpuTimeStamp = 0;
@@ -47,6 +40,14 @@ void DeviceTime::setDeviceTimerResolution(HardwareInfo const &hwInfo) {
}
}
bool DeviceTime::isTimestampsRefreshEnabled() const {
bool timestampsRefreshEnabled = true;
if (debugManager.flags.EnableReusingGpuTimestamps.get() != -1) {
timestampsRefreshEnabled = debugManager.flags.EnableReusingGpuTimestamps.get();
}
return timestampsRefreshEnabled;
}
/**
* @brief If this method is called within interval, GPU timestamp
* will be calculated based on CPU timestamp and previous GPU ticks
@@ -63,7 +64,7 @@ bool DeviceTime::getGpuCpuTimestamps(TimeStampData *timeStamp, OSTime *osTime, b
if (forceKmdCall || cpuTimeDiffInNS >= timestampRefreshTimeoutNS) {
refreshTimestamps = true;
}
bool reusingTimestampsEnabled = isTimestampsRefreshEnabled();
if (!reusingTimestampsEnabled || refreshTimestamps) {
if (!getGpuCpuTimeImpl(timeStamp, osTime)) {
return false;

View File

@@ -25,12 +25,12 @@ class OSTime;
class DeviceTime {
public:
DeviceTime();
virtual ~DeviceTime() = default;
bool getGpuCpuTime(TimeStampData *pGpuCpuTime, OSTime *osTime, bool forceKmdCall);
virtual bool getGpuCpuTimeImpl(TimeStampData *pGpuCpuTime, OSTime *osTime);
virtual double getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo) const;
virtual uint64_t getDynamicDeviceTimerClock(HardwareInfo const &hwInfo) const;
virtual bool isTimestampsRefreshEnabled() const;
bool getGpuCpuTimestamps(TimeStampData *timeStamp, OSTime *osTime, bool forceKmdCall);
void setDeviceTimerResolution(HardwareInfo const &hwInfo);
void setRefreshTimestampsFlag() {
@@ -47,9 +47,8 @@ class DeviceTime {
double deviceTimerResolution = 0;
const uint64_t timestampRefreshMinTimeoutNS = NSEC_PER_MSEC; // 1ms
const uint64_t timestampRefreshMaxTimeoutNS = NSEC_PER_SEC; // 1s
uint64_t timestampRefreshTimeoutNS = 0;
uint64_t timestampRefreshTimeoutNS = NSEC_PER_MSEC * 100; // 100ms
bool refreshTimestamps = true;
bool reusingTimestampsEnabled = false;
TimeStampData fetchedTimestamps{};
};