Apply timerResolution mod for L0 V1.1

Signed-off-by: John Falkowski <john.falkowski@intel.com>
This commit is contained in:
John Falkowski
2021-03-24 13:57:46 -04:00
committed by Compute-Runtime-Automation
parent 85f93cd51b
commit 218387dd47
17 changed files with 107 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -155,6 +155,22 @@ double OSTimeLinux::getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo)
return OSTime::getDeviceTimerResolution(hwInfo);
}
uint64_t OSTimeLinux::getDynamicDeviceTimerClock(HardwareInfo const &hwInfo) const {
if (pDrm) {
drm_i915_getparam_t getParam = {};
int frequency = 0;
getParam.param = I915_PARAM_CS_TIMESTAMP_FREQUENCY;
getParam.value = &frequency;
auto error = pDrm->ioctl(DRM_IOCTL_I915_GETPARAM, &getParam);
if (!error) {
return static_cast<uint64_t>(frequency);
}
}
return static_cast<uint64_t>(1000000000.0 / OSTime::getDeviceTimerResolution(hwInfo));
}
uint64_t OSTimeLinux::getCpuRawTimestamp() {
uint64_t timesInNsec = 0;
uint64_t ticksInNsec = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -30,6 +30,7 @@ class OSTimeLinux : public OSTime {
bool getGpuTimeSplitted(uint64_t *timestamp);
double getHostTimerResolution() const override;
double getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo) const override;
uint64_t getDynamicDeviceTimerClock(HardwareInfo const &hwInfo) const override;
uint64_t getCpuRawTimestamp() override;
protected:

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,6 +29,7 @@ class OSTime {
virtual bool getCpuGpuTime(TimeStampData *pGpuCpuTime) = 0;
virtual double getHostTimerResolution() const = 0;
virtual double getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo) const = 0;
virtual uint64_t getDynamicDeviceTimerClock(HardwareInfo const &hwInfo) const = 0;
virtual uint64_t getCpuRawTimestamp() = 0;
OSInterface *getOSInterface() const {
return osInterface;

View File

@@ -107,6 +107,15 @@ double OSTimeWin::getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo) co
return retVal;
}
uint64_t OSTimeWin::getDynamicDeviceTimerClock(HardwareInfo const &hwInfo) const {
uint64_t retVal = 0u;
if (wddm) {
retVal = static_cast<uint64_t>(wddm->getTimestampFrequency());
}
return retVal;
}
uint64_t OSTimeWin::getCpuRawTimestamp() {
LARGE_INTEGER cpuRawTimestamp = {};
this->QueryPerfomanceCounterFnc(&cpuRawTimestamp);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -22,6 +22,7 @@ class OSTimeWin : public OSTime {
bool getCpuGpuTime(TimeStampData *pGpuCpuTime) override;
double getHostTimerResolution() const override;
double getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo) const override;
uint64_t getDynamicDeviceTimerClock(HardwareInfo const &hwInfo) const override;
uint64_t getCpuRawTimestamp() override;
protected: