mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 14:33:04 +08:00
Add environment variable to select L0 timer resolution
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
9cbfbd1d53
commit
40ecee5733
@@ -392,7 +392,11 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
|
|||||||
|
|
||||||
pDeviceProperties->numSlices = hardwareInfo.gtSystemInfo.SliceCount * ((this->numSubDevices > 0) ? this->numSubDevices : 1);
|
pDeviceProperties->numSlices = hardwareInfo.gtSystemInfo.SliceCount * ((this->numSubDevices > 0) ? this->numSubDevices : 1);
|
||||||
|
|
||||||
pDeviceProperties->timerResolution = this->neoDevice->getDeviceInfo().outProfilingTimerClock;
|
if (NEO::DebugManager.flags.UseCyclesPerSecondTimer.get() == 0) {
|
||||||
|
pDeviceProperties->timerResolution = this->neoDevice->getDeviceInfo().outProfilingTimerResolution;
|
||||||
|
} else {
|
||||||
|
pDeviceProperties->timerResolution = this->neoDevice->getDeviceInfo().outProfilingTimerClock;
|
||||||
|
}
|
||||||
|
|
||||||
pDeviceProperties->timestampValidBits = hardwareInfo.capabilityTable.timestampValidBits;
|
pDeviceProperties->timestampValidBits = hardwareInfo.capabilityTable.timestampValidBits;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
#include "level_zero/core/source/cmdqueue/cmdqueue_imp.h"
|
#include "level_zero/core/source/cmdqueue/cmdqueue_imp.h"
|
||||||
|
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
||||||
#include "level_zero/core/source/driver/host_pointer_manager.h"
|
#include "level_zero/core/source/driver/host_pointer_manager.h"
|
||||||
#include "level_zero/core/test/unit_tests/mocks/mock_driver_handle.h"
|
#include "level_zero/core/test/unit_tests/mocks/mock_driver_handle.h"
|
||||||
|
|
||||||
@@ -455,6 +456,41 @@ TEST_F(GlobalTimestampTest, whenGetProfilingTimerClockandProfilingTimerResolutio
|
|||||||
EXPECT_EQ(timerClock, static_cast<uint64_t>(1000000000.0 / timerResolution));
|
EXPECT_EQ(timerClock, static_cast<uint64_t>(1000000000.0 / timerResolution));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(GlobalTimestampTest, whenQueryingForTimerResolutionThenDefaultTimerResolutionInNanoSecondsIsReturned) {
|
||||||
|
neoDevice->setOSTime(new FalseCpuGpuTime());
|
||||||
|
NEO::DeviceVector devices;
|
||||||
|
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
|
||||||
|
std::unique_ptr<L0::DriverHandleImp> driverHandle = std::make_unique<L0::DriverHandleImp>();
|
||||||
|
driverHandle->initialize(std::move(devices));
|
||||||
|
|
||||||
|
double timerResolution = neoDevice->getProfilingTimerResolution();
|
||||||
|
EXPECT_NE(timerResolution, 0.0);
|
||||||
|
|
||||||
|
ze_device_properties_t deviceProps = {};
|
||||||
|
ze_result_t res = driverHandle.get()->devices[0]->getProperties(&deviceProps);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||||
|
EXPECT_EQ(deviceProps.timerResolution, static_cast<uint64_t>(timerResolution));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(GlobalTimestampTest, whenQueryingForTimerResolutionWithUseCyclesPerSecondTimerSetThenTimerResolutionInCyclesPerSecondsIsReturned) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
DebugManager.flags.UseCyclesPerSecondTimer.set(1u);
|
||||||
|
|
||||||
|
neoDevice->setOSTime(new FalseCpuGpuTime());
|
||||||
|
NEO::DeviceVector devices;
|
||||||
|
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
|
||||||
|
std::unique_ptr<L0::DriverHandleImp> driverHandle = std::make_unique<L0::DriverHandleImp>();
|
||||||
|
driverHandle->initialize(std::move(devices));
|
||||||
|
|
||||||
|
uint64_t timerClock = neoDevice->getProfilingTimerClock();
|
||||||
|
EXPECT_NE(timerClock, 0u);
|
||||||
|
|
||||||
|
ze_device_properties_t deviceProps = {};
|
||||||
|
ze_result_t res = driverHandle.get()->devices[0]->getProperties(&deviceProps);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||||
|
EXPECT_EQ(deviceProps.timerResolution, timerClock);
|
||||||
|
}
|
||||||
|
|
||||||
class FalseCpuTime : public NEO::OSTime {
|
class FalseCpuTime : public NEO::OSTime {
|
||||||
public:
|
public:
|
||||||
bool getCpuGpuTime(TimeStampData *pGpuCpuTime) override {
|
bool getCpuGpuTime(TimeStampData *pGpuCpuTime) override {
|
||||||
|
|||||||
@@ -225,3 +225,4 @@ GpuScratchRegWriteRegisterOffset = 0
|
|||||||
UseBindlessDebugSip = 0
|
UseBindlessDebugSip = 0
|
||||||
OverrideSlmAllocationSize = -1
|
OverrideSlmAllocationSize = -1
|
||||||
OverrideSlmSize = -1
|
OverrideSlmSize = -1
|
||||||
|
UseCyclesPerSecondTimer = 0
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, ForcePipeSupport, -1, "-1: default, 0: disabled,
|
|||||||
DECLARE_DEBUG_VARIABLE(int32_t, UseAsyncDrmExec, -1, "-1: default, 0: Disabled 1: Enabled. If enabled, pass EXEC_OBJECT_ASYNC to exec ioctl.")
|
DECLARE_DEBUG_VARIABLE(int32_t, UseAsyncDrmExec, -1, "-1: default, 0: Disabled 1: Enabled. If enabled, pass EXEC_OBJECT_ASYNC to exec ioctl.")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, UseBindlessMode, -1, "Use precompiled builtins in bindless mode, -1: api dependent, 0: disabled, 1: enabled")
|
DECLARE_DEBUG_VARIABLE(int32_t, UseBindlessMode, -1, "Use precompiled builtins in bindless mode, -1: api dependent, 0: disabled, 1: enabled")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideSlmSize, -1, "Force different slm size than default in kB")
|
DECLARE_DEBUG_VARIABLE(int32_t, OverrideSlmSize, -1, "Force different slm size than default in kB")
|
||||||
|
DECLARE_DEBUG_VARIABLE(int32_t, UseCyclesPerSecondTimer, 0, "0: default behavior, 0: disabled: Report L0 timer in nanosecond units, 1: enabled: Report L0 timer in cycles per second")
|
||||||
|
|
||||||
/*DRIVER TOGGLES*/
|
/*DRIVER TOGGLES*/
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceOCLVersion, 0, "Force specific OpenCL API version")
|
DECLARE_DEBUG_VARIABLE(int32_t, ForceOCLVersion, 0, "Force specific OpenCL API version")
|
||||||
|
|||||||
Reference in New Issue
Block a user