You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#81331 added support for a __builtin_readsteadycounter intrinsic which returns a fixed frequency clock counter. It returns 0 on failure.
x86 can use this as a wrapper to read the MPERF counter - on Intel (and default) I think this will need to lower to a libcall, but on AMD znver2 (or later) we can use the RDPRU instruction.
Ideally we need a companion __builtin_readvariablecounter intrinsic which returns the APERF counter to calculate the effective cpu frequency (we can't use __builtin_readcyclecounter as that returns RDTSC which is a different time scale).
The text was updated successfully, but these errors were encountered:
#81331 added support for a `__builtin_readsteadycounter` intrinsic which returns a fixed frequency clock counter. It returns 0 on failure.
x86 can use this as a wrapper to read the MPERF counter - on Intel (and default) I think this will need to lower to a libcall, but on AMD znver2 (or later) we can use the RDPRU instruction.
Ideally we need a companion __builtin_readvariablecounter intrinsic which returns the APERF counter to calculate the effective cpu frequency (we can't use __builtin_readcyclecounter as that returns RDTSC which is a different time scale).
RKSimon
changed the title
[X86] Use __builtin_readsteadycounter to access MPERF counter (and APERF equivalent(
[X86] Use __builtin_readsteadycounter to access MPERF counter (and APERF equivalent)
Feb 29, 2024
#81331 added support for a
__builtin_readsteadycounter
intrinsic which returns a fixed frequency clock counter. It returns 0 on failure.x86 can use this as a wrapper to read the MPERF counter - on Intel (and default) I think this will need to lower to a libcall, but on AMD znver2 (or later) we can use the RDPRU instruction.
Ideally we need a companion
__builtin_readvariablecounter
intrinsic which returns the APERF counter to calculate the effective cpu frequency (we can't use__builtin_readcyclecounter
as that returns RDTSC which is a different time scale).The text was updated successfully, but these errors were encountered: