llvm
f33c1a4a - [UR][L0] Query timer resolution in cycles/sec for accurate timestamp (#21279)

Commit
1 day ago
[UR][L0] Query timer resolution in cycles/sec for accurate timestamp (#21279) According to [Level Zero spec](https://oneapi-src.github.io/level-zero-spec/level-zero/latest/core/api.html#_CPPv4N22ze_device_properties_t15timerResolutionE) 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.
Author
Committer
Parents
Loading