cancel
Showing results for 
Search instead for 
Did you mean: 

PC Processors

johne53
Journeyman III

Ryzen ThreadRipper and timers

I'm a C++ programmer working on various projects which run under Windows but which require accurate timing.

Traditionally these have tended to run better on Intel CPU's (because for a multi-core device, Intel CPU's tend to use a single high-precision timer which gets shared by all the cores). AMD CPU's on the other hand have traditionally used different timers for each core (and AFAIK they're not synchronised). Therefore when the OS switches a task onto a different core, the timing can go utterly haywire (which defeats the object of it being "high precision")..

Is that still the case with the latest AMD processors (e.g. ThreadRipper)? Or do the different cores finally share a common, high-precision timer?

0 Likes
3 Replies
misterj
Big Boss

johne53, I cannot help you and it may be difficult to find another User here who can.  I suggest you open an AMD Online Support Ticket and ask them.  Enjoy, John.

0 Likes

Found this from Microsoft concerning using Windows for "Acquiring High Resolution Time Stamps".  I believe this has to do with using the CPU Core timers even when they are not synchronized.: Acquiring high-resolution time stamps - Windows applications | Microsoft Docs .

Your question I believe needs to be answered by a AMD Engineer. As mentioned by MisterJ, Open an AMD EMAIL SUPPORT online and see what they say from here: Online Service Request | AMD

Here are some questions from link from FAQ that might apply to your question:

Should I use QPC or call the RDTSC /RDTSCP instructions directly?

To avoid incorrectness and portability issues, we strongly encourage you to use QPC instead of using the TSC register or the RDTSC or RDTSCP processor instructions.

Is QPC accuracy affected by processor frequency changes caused by power management or Turbo Boost technology?

No. If the processor has an invariant TSC, the QPC is not affected by these sort of changes. If the processor doesn't have an invariant TSC, QPC will revert to a platform hardware timer that won't be affected by processor frequency changes or Turbo Boost technology.

FAQ about programming with QPC and TSChttps://docs.microsoft.com/en-us/windows/desktop/sysinfo/acquiring-high-resolution-time-stamps#faq-a...

Here are answers to frequently-asked questions about programming with QPC and TSCs.

I need to convert the QPC output to milliseconds. How can I avoid loss of precision with converting to double or float?

There are several things to keep in mind when performing calculations on integer performance counters:

  • Integer division will lose the remainder. This can cause loss of precision in some cases.
  • Conversion between 64 bit integers and floating point (double) can cause loss of precision because the floating point mantissa can't represent all possible integral values.
  • Multiplication of 64 bit integers can result in integer overflow.

As a general principle, delay these computations and conversions as long as possible to avoid compounding the errors introduced.

As you can tell I am not qualified to answer your question. But seems like Windows can use the Processor's Timers. So you need to program using Windows API for CPU Timers.

0 Likes

Yes, it's looking like an online support request might be the best way forward. Many thanks guys.

John

0 Likes