Stuttering, finally solved

This finding comes in time to match my new pc build guide with Skylake builds. Nice!

As some of you may know iRacing staff has been dealing with stuttering problems since last December. Graphics features included in the Xmas build were affecting to the overall performance of the frame rate and people was having problems with many different architectures, characteristics and graphic cards. Nobody hasn’t any clue about what was happening until this week.

Scott Boham is the man, read carefully:

So I’ve been playing about with GPUview from Microsoft to log system performance whilst iRacing is running. I fired up the ring and bingo! within about 10 seconds I got a medium-ish stutter. The results are quite interesting, what *I think* it is showing is that for some reason the iRacing process is just going idle, and this causes the stutter.

Some explanations for the attachment:
– X-axis is time, the blue vertical lines are vsync events (I’m on gsync here, so they’re uneven, but here they are about 15ms / 67 fps)
– The first row (Hardware queue) is work the GPU is doing, blue boxes are bits of work, when they stack vertically it means one is waiting whilst the bottom one executes
– “Device context” is the work iRacing has told the GPU to do getting queued up (it goes from here to the top row), orange boxes are the “present” commands that tell the GPU to show the frame at the end of the other GPU commands. So you can see the delay between each orange “present” and the vsync (about 7ms).
– The rows at the bottom are the CPU threads running within the iRacing process. The boxes are when each thread is doing work, the colour of the box is which CPU core it’s running on.

This is running flat out on my system, and you can see it is looking CPU limited (the GPU often has nothing to do, but those two threads are pretty much full.

Now do you spot the stutter? Instead of presenting every 15ms, suddenly there is a frame which takes 47ms to show (or 21 fps). And what causes that? I don’t know, iRacing CPU usage just stops. The idle thread goes up to replace the drop in CPU usage from iRacing, so it’s not that some other high-priority CPU-intensive process is stealing cycles or anything.

Well it didn’t help me solve my problem (I was hoping some other process was causing the stutter), but it seems like either iRacing is causing the stutter itself for some reason, or there’s something else hidden on my system causing iRacing to pause?

It seems that the iRacing main thread is fixed to only run on core zero of your CPU. If any other thread within iRacing, or other task, gets scheduled to run on core zero for any length of time then this will essentially pause the iRacing process and result in a stutter.

Solution (for me)-> After iRacing has loaded, go to task manager and change the affinity to *not* use core zero. This then forces the iRacing main thread to use all other cores instead of being locked to just one core. It got rid of 99% of my stutters and actually gave a 2-5 fps improvement too. If you don’t know how to do that, then Dayne made a utility to do it automatically: forum post

GPUview iRacing

Dave Kraemmer confirmed this:

“It was the particle effects–that code was setting the thread affinity to 1, so the graphics code was stuck on one processor. We have a fix in the works and hope to include it in the patch rollout this week. After that, should be no need to diddle with your Windows settings. A huge thanks to Scott for noticing that. Let’s hope this gets everyone back to “smooth(er)” racing.”

And the Oscar goes to…

“Well, Scott certainly deserves some pizza, and probably even a Guinness, but from across the pond that could prove difficult. So instead, 500 iRacing credits will have to do (we’ll get that credited to your account asap, Scott). Really appreciate when you all help us find issues with the sim. It really helps to make this whole adventure possible. Another thing: looks like this led us to discover that the effects code was changing the thread priorities in a possibly bad way, so this was doubly good to find. Thanks again, Scott–from all of us!”

Thank you Scott!

Leave a Reply