Skip to content

Commit 7abd1c9

Browse files
Debug flag to override profiling timer resolution
Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent 1dcbbfa commit 7abd1c9

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

opencl/test/unit_test/device/device_caps_tests.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,17 @@ TEST_F(DeviceGetCapsTest, givenDontForcePreemptionModeDebugVariableWhenCreateDev
306306
}
307307
}
308308

309+
TEST_F(DeviceGetCapsTest, givenDebugFlagSetWhenCreatingDeviceInfoThenOverrideProfilingTimerResolution) {
310+
DebugManagerStateRestore dbgRestorer;
311+
312+
DebugManager.flags.OverrideProfilingTimerResolution.set(123);
313+
314+
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
315+
316+
EXPECT_EQ(double(123), device->getDeviceInfo().profilingTimerResolution);
317+
EXPECT_EQ(123u, device->getDeviceInfo().outProfilingTimerResolution);
318+
}
319+
309320
TEST_F(DeviceGetCapsTest, givenForcePreemptionModeDebugVariableWhenCreateDeviceThenSetForcedMode) {
310321
DebugManagerStateRestore dbgRestorer;
311322
{

opencl/test/unit_test/test_files/igdrcl.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,5 @@ PrintBlitDispatchDetails = 0
207207
EnableMockSourceLevelDebugger = 0
208208
EnableHostPointerImport = -1
209209
EnableHostUsmSupport = -1
210-
ForceBtpPrefetchMode = -1
210+
ForceBtpPrefetchMode = -1
211+
OverrideProfilingTimerResolution = -1

shared/source/debug_settings/debug_variables_base.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, MediaVfeStateMaxSubSlices, -1, ">=0: Programs Me
8585
DECLARE_DEBUG_VARIABLE(int32_t, EnableMockSourceLevelDebugger, 0, "Switches driver to mode with active debugger. Active modes: 1: opt-disabled, 2: opt-enabled")
8686
DECLARE_DEBUG_VARIABLE(int32_t, ForceBtpPrefetchMode, -1, "-1: default, 0: disable, 1: enable, Enables Btp prefetching")
8787
DECLARE_DEBUG_VARIABLE(int32_t, EnableHostPointerImport, -1, "-1: default - disabled, 0: disabled, 1: enabled, Experimental implementation to import Host Pointer into L0")
88+
DECLARE_DEBUG_VARIABLE(int32_t, OverrideProfilingTimerResolution, -1, "-1: default - disabled, 0<=: Override deviceInfo.profilingTimerResolution")
8889

8990
/*LOGGING FLAGS*/
9091
DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagnostics messages to standard output, value corresponds to hint level")

shared/source/device/device_caps.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ void Device::initializeCaps() {
6969
deviceInfo.maxMemAllocSize = std::min(std::max(deviceInfo.maxMemAllocSize / 2, static_cast<uint64_t>(128llu * MB)), this->hardwareCapabilities.maxMemAllocSize);
7070

7171
deviceInfo.profilingTimerResolution = getProfilingTimerResolution();
72+
if (DebugManager.flags.OverrideProfilingTimerResolution.get() != -1) {
73+
deviceInfo.profilingTimerResolution = static_cast<double>(DebugManager.flags.OverrideProfilingTimerResolution.get());
74+
}
75+
7276
deviceInfo.outProfilingTimerResolution = static_cast<size_t>(deviceInfo.profilingTimerResolution);
7377

7478
constexpr uint64_t maxPixelSize = 16;

0 commit comments

Comments
 (0)