Skip to content

Commit 5e43622

Browse files
Pass timestamp resolution to scheduler through event pool.
Related-To: NEO-2491 Change-Id: I7fb42441320b2b8a63b65ebe1d7f1f435809c80e Signed-off-by: Piotr Zdunowski <piotr.zdunowski@intel.com>
1 parent bb7c4d9 commit 5e43622

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

runtime/device_queue/device_queue.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ void DeviceQueue::initDeviceQueue() {
141141

142142
auto igilEventPool = reinterpret_cast<IGIL_EventPool *>(eventPoolBuffer->getUnderlyingBuffer());
143143
memset(eventPoolBuffer->getUnderlyingBuffer(), 0x0, eventPoolBuffer->getUnderlyingBufferSize());
144+
igilEventPool->m_TimestampResolution = static_cast<float>(device->getProfilingTimerResolution());
144145
igilEventPool->m_size = caps.maxOnDeviceEvents;
145146
}
146147

runtime/device_queue/device_queue_hw_base.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void DeviceQueueHw<GfxFamily>::resetDeviceQueue() {
3535
auto igilEventPool = reinterpret_cast<IGIL_EventPool *>(eventPoolBuffer->getUnderlyingBuffer());
3636

3737
memset(eventPoolBuffer->getUnderlyingBuffer(), 0x0, eventPoolBuffer->getUnderlyingBufferSize());
38+
igilEventPool->m_TimestampResolution = static_cast<float>(device->getProfilingTimerResolution());
3839
igilEventPool->m_size = caps.maxOnDeviceEvents;
3940

4041
auto igilCmdQueue = reinterpret_cast<IGIL_CommandQueue *>(queueBuffer->getUnderlyingBuffer());

runtime/scheduler/scheduler.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,9 +2665,9 @@ void UpdateEventsTreeStatusParallel( clk_event_t eventId, __global IGIL_EventPoo
26652665
CLCompleteTransitionTime = PROFILING_MAX_TIMER_VALUE - StartTime + CompleteTime;
26662666
}
26672667
//First value is END - START timestamp
2668-
retValues[ 0 ] = ( ulong )( ( float )CLEndTransitionTime * __intel__getProfilingTimerResolution() );
2668+
retValues[ 0 ] = ( ulong )( ( float )CLEndTransitionTime * eventsPool->m_TimestampResolution );
26692669
//Second value is COMPLETE - START timestamp
2670-
retValues[ 1 ] = ( ulong )( ( float )CLCompleteTransitionTime * __intel__getProfilingTimerResolution() );
2670+
retValues[ 1 ] = ( ulong )( ( float )CLCompleteTransitionTime * eventsPool->m_TimestampResolution );
26712671
}
26722672
}
26732673
//Signal parent because we completed

unit_tests/device_queue/device_queue_hw_tests.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,17 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueHwTest, addLriWithoutArbCheck) {
138138
delete mockDeviceQueueHw;
139139
}
140140

141+
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueHwTest, GivenDeviceQueueHWWhenEventPoolIsCreatedThenTimestampResolutionIsSet) {
142+
auto timestampResolution = static_cast<float>(device->getProfilingTimerResolution());
143+
144+
auto deviceQueue = std::unique_ptr<DeviceQueue>(createQueueObject());
145+
ASSERT_NE(deviceQueue, nullptr);
146+
147+
auto eventPoolBuffer = reinterpret_cast<IGIL_EventPool *>(deviceQueue->getEventPoolBuffer()->getUnderlyingBuffer());
148+
149+
EXPECT_FLOAT_EQ(timestampResolution, eventPoolBuffer->m_TimestampResolution);
150+
}
151+
141152
class DeviceQueueSlb : public DeviceQueueHwTest {
142153
public:
143154
template <typename Cmd>

unit_tests/device_queue/device_queue_tests.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, createDeviceQueuesWhenMultipleDevic
116116
const_cast<DeviceInfo *>(&device->getDeviceInfo())->maxOnDeviceQueues = maxOnDeviceQueues;
117117
}
118118

119+
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueTest, GivenDeviceQueueWhenEventPoolIsCreatedThenTimestampResolutionIsSet) {
120+
auto timestampResolution = static_cast<float>(device->getProfilingTimerResolution());
121+
122+
auto deviceQueue = std::unique_ptr<DeviceQueue>(createQueueObject());
123+
ASSERT_NE(deviceQueue, nullptr);
124+
125+
auto eventPoolBuffer = reinterpret_cast<IGIL_EventPool *>(deviceQueue->getEventPoolBuffer()->getUnderlyingBuffer());
126+
127+
EXPECT_FLOAT_EQ(timestampResolution, eventPoolBuffer->m_TimestampResolution);
128+
}
129+
119130
typedef DeviceQueueTest DeviceQueueBuffer;
120131

121132
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueBuffer, setPreferredSizeWhenNoPropertyGiven) {
@@ -170,6 +181,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueBuffer, initValues) {
170181
IGIL_EventPool expectedIgilEventPool = {0, 0, 0};
171182
expectedIgilEventPool.m_head = 0;
172183
expectedIgilEventPool.m_size = deviceInfo.maxOnDeviceEvents;
184+
expectedIgilEventPool.m_TimestampResolution = static_cast<float>(device->getProfilingTimerResolution());
173185

174186
// initialized header
175187
EXPECT_EQ(0, memcmp(deviceQueue->getQueueBuffer()->getUnderlyingBuffer(),

0 commit comments

Comments
 (0)