Skip to content

[UR][L0] Query timer resolution in cycles/sec for accurate timestamp#21279

Open
againull wants to merge 1 commit intointel:syclfrom
againull:bugfix/timer_resolution
Open

[UR][L0] Query timer resolution in cycles/sec for accurate timestamp#21279
againull wants to merge 1 commit intointel:syclfrom
againull:bugfix/timer_resolution

Conversation

@againull
Copy link
Contributor

@againull againull commented Feb 12, 2026

According to Level Zero spec the meaning of timerResolution depends on stype:

  • ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES -> units are nanoseconds (uint64, already rounded)
  • ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2 -> units are cycles/sec (exact value)

Previously we queried using ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES and used the integer nanosecond value, which introduced rounding error and reduced timestamp accuracy.
Instead, query timerResolution with ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2 (cycles/sec) and compute nanoseconds-per-cycle as a double to preserve precision.

This fix improves the accuracy of timestamp reported from urDeviceGetGlobalTimestamps and others.

According to Level Zero the meaning of timerResolution depends on stype:
- ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES -> units are nanoseconds (uint64, already rounded)
- ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2 -> units are cycles/sec

Previously we queried using ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES and used the
integer nanosecond value, which introduced rounding error and reduced timestamp
accuracy. That could occasionally make the SYCL runtime report submit time > start time.

Instead, query timerResolution with ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2 (cycles/sec)
and compute nanoseconds-per-cycle as a double to preserve precision.
@againull againull force-pushed the bugfix/timer_resolution branch from aa9c7c1 to da455e9 Compare February 18, 2026 15:59
@againull againull marked this pull request as ready for review February 18, 2026 15:59
@againull againull requested a review from a team as a code owner February 18, 2026 15:59
@againull
Copy link
Contributor Author

@intel/unified-runtime-reviewers-level-zero Could you please review.

@github-actions
Copy link
Contributor

@intel/llvm-gatekeepers please consider merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments