Add getGpuTimeStampInNS helper

Change-Id: I9170c773d1424ad69523d9a5c3b733299774c194
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2020-04-21 12:51:00 +02:00
parent 2c93f0dc99
commit d7f137ef47
3 changed files with 12 additions and 2 deletions

View File

@@ -288,8 +288,11 @@ void Event::calculateProfilingDataInternal(uint64_t contextStartTS, uint64_t con
uint64_t gpuCompleteDuration = 0;
uint64_t cpuCompleteDuration = 0;
double frequency = cmdQueue->getDevice().getDeviceInfo().profilingTimerResolution;
int64_t c0 = queueTimeStamp.CPUTimeinNS - static_cast<uint64_t>(queueTimeStamp.GPUTimeStamp * frequency);
auto &hwHelper = HwHelper::get(this->cmdQueue->getDevice().getHardwareInfo().platform.eRenderCoreFamily);
auto frequency = cmdQueue->getDevice().getDeviceInfo().profilingTimerResolution;
auto gpuTimeStamp = queueTimeStamp.GPUTimeStamp;
int64_t c0 = queueTimeStamp.CPUTimeinNS - hwHelper.getGpuTimeStampInNS(gpuTimeStamp, frequency);
/* calculation based on equation
CpuTime = GpuTime * scalar + const( == c0)
scalar = DeltaCpu( == dCpu) / DeltaGpu( == dGpu)

View File

@@ -85,6 +85,7 @@ class HwHelper {
virtual bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) const = 0;
virtual bool isFusedEuDispatchEnabled(const HardwareInfo &hwInfo) const = 0;
virtual bool isIndependentForwardProgressSupported() = 0;
virtual uint64_t getGpuTimeStampInNS(uint64_t timeStamp, double frequency) const = 0;
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
@@ -220,6 +221,8 @@ class HwHelperHw : public HwHelper {
bool isIndependentForwardProgressSupported() override;
uint64_t getGpuTimeStampInNS(uint64_t timeStamp, double frequency) const override;
protected:
static const AuxTranslationMode defaultAuxTranslationMode;
HwHelperHw() = default;

View File

@@ -70,6 +70,10 @@ template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isIndependentForwardProgressSupported() {
return true;
}
template <typename GfxFamily>
uint64_t HwHelperHw<GfxFamily>::getGpuTimeStampInNS(uint64_t timeStamp, double frequency) const {
return static_cast<uint64_t>(timeStamp * frequency);
}
template <typename GfxFamily>
void MemorySynchronizationCommands<GfxFamily>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {