Personal computing discussed

Moderators: mac_h8r1, Nemesis

 
synthtel2
Gold subscriber
Gerbil Elite
Topic Author
Posts: 830
Joined: Mon Nov 16, 2015 10:30 am

Memory access priority?

Thu Oct 18, 2018 6:26 pm

As far as I know, there's no such thing, but I'm getting some results that are tough to explain without something like that.

I noticed a while back that if running a game and a bandwidth-intensive task at the same time in Win10, the game's framerate would vary a lot depending on which window was focused, despite there being plenty of CPU cores and threads to go around. I don't remember details, but it might be worth trying to recreate this situation.

What I'm doing now is running four processes (one thread each) of a random throughput test. Each process does pipelined random reads from a 1GB allocation. In Linux, each process spends most of its time at 46-50 Mops/s regardless of how long the run is, as expected. In Win10, one process always wins to the tune of being 50% faster than the other three, even if I let the whole thing run for 5 minutes. It is usually, but not always, the one that launches first (there's no more than a half second between launches). Which window is focused doesn't seem to have anything to do with it.

Does anyone have any idea what I might be looking at here?

In case any of it helps, it's an R7 1700 stock-clocked, that never boosts for an unknown reason, locked to 2.7 GHz minimum in Win10 because if I let it throttle down further than that (only in Windows) it'll lose performance even when in the highest-performance state as far as the OS can tell. RAM is 2666 CL14 with a very low tFAW.
 
just brew it!
Gold subscriber
Administrator
Posts: 51834
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: Memory access priority?

Thu Oct 18, 2018 7:06 pm

Could be a bad interaction between Windows' CPU scheduler and AMD's implementation of SMT. Try disabling SMT and see if the discrepancy goes away.
Nostalgia isn't what it used to be.
 
dragontamer5788
Gerbil First Class
Posts: 158
Joined: Mon May 06, 2013 8:39 am

Re: Memory access priority?

Thu Oct 18, 2018 7:35 pm

synthtel2 wrote:
I noticed a while back that if running a game and a bandwidth-intensive task at the same time in Win10, the game's framerate would vary a lot depending on which window was focused, despite there being plenty of CPU cores and threads to go around. I don't remember details, but it might be worth trying to recreate this situation.


Windows does two things to focused windows:

1. Give a focused window priority boost. This means that a a focused window will get more CPU time than others (not relevant in the case of "plenty of CPU cores to go around", because all tasks will execute as long as cores are available)

2. Give the focused window 6-epocs per task switch, instead of 2-epocs per task switch. Focused windows have fewer context switches. Normal tasks switch every 30ms, while focused windows only switch every 120ms. This ought to improve framerate slightly, especially now that context-switches are way heavier (thank you Spectre, which still affects AMD)

What I'm doing now is running four processes (one thread each) of a random throughput test. Each process does pipelined random reads from a 1GB allocation. In Linux, each process spends most of its time at 46-50 Mops/s regardless of how long the run is, as expected. In Win10, one process always wins to the tune of being 50% faster than the other three, even if I let the whole thing run for 5 minutes. It is usually, but not always, the one that launches first (there's no more than a half second between launches). Which window is focused doesn't seem to have anything to do with it.

Does anyone have any idea what I might be looking at here?

Unfortunately not. I was just grabbing the easy question you posted, not the hard one. Lol. I've noticed that "Memory-Testers" launched simultaneously seem to perform greatly differently on my Threadripper box, but I never thought about questioning why it does that. So I think I've personally seen some evidence for the behavior you're describing.

I just don't know why Windows would be doing that.
 
dragontamer5788
Gerbil First Class
Posts: 158
Joined: Mon May 06, 2013 8:39 am

Re: Memory access priority?

Thu Oct 18, 2018 7:53 pm

Have you thought of using Hardware-Performance-Counter based instrumentation?

https://developer.amd.com/amd-uprof/

This should get you Cache Hits / Cache misses / TLB Hits / branch prediction misses / branch prediction hits / etc. etc. Basically, data that's more detailed than just time.
 
synthtel2
Gold subscriber
Gerbil Elite
Topic Author
Posts: 830
Joined: Mon Nov 16, 2015 10:30 am

Re: Memory access priority?

Thu Oct 18, 2018 8:13 pm

just brew it! wrote:
Could be a bad interaction between Windows' CPU scheduler and AMD's implementation of SMT. Try disabling SMT and see if the discrepancy goes away.

Got it in one! All four are now oddly slow and bimodal though (that 80 at 99% is about right for any of them running solo, so no mystery there). Here are the percentile results I'm seeing:

 1%: 30
20%: 35
40%: 36
60%: 50
80%: 51
99%: 80

... As compared to mostly 47-49 from 20% to 80% in Linux. Hm.

I wonder how the scheduler went that far off the rails. With half as many threads running as cores, keeping the threads from sharing cores shouldn't be a tall order. I'll keep running 8C8T for a while and see how it goes.

dragontamer5788 wrote:
Windows does two things to focused windows:

1. Give a focused window priority boost. This means that a a focused window will get more CPU time than others (not relevant in the case of "plenty of CPU cores to go around", because all tasks will execute as long as cores are available)

2. Give the focused window 6-epocs per task switch, instead of 2-epocs per task switch. Focused windows have fewer context switches. Normal tasks switch every 30ms, while focused windows only switch every 120ms. This ought to improve framerate slightly, especially now that context-switches are way heavier (thank you Spectre, which still affects AMD)

Were it a slight change in framerate, that would cover it, but it was more like a factor of 1.8 to 2. Maybe the priority changes interacted with this scheduling problem or something.

dragontamer5788 wrote:
Have you thought of using Hardware-Performance-Counter based instrumentation?

https://developer.amd.com/amd-uprof/

This should get you Cache Hits / Cache misses / TLB Hits / branch prediction misses / branch prediction hits / etc. etc. Basically, data that's more detailed than just time.

I'll check it out, but unless it covers some things perf doesn't, this workload is pretty simple and predictable on those metrics (it causes all the cache misses on purpose and spends the vast majority of its time waiting on them).
 
synthtel2
Gold subscriber
Gerbil Elite
Topic Author
Posts: 830
Joined: Mon Nov 16, 2015 10:30 am

Re: Memory access priority?

Thu Oct 18, 2018 8:47 pm

There are some interesting things in uProf, thanks for the tip. My favorite is that it looks like a way to get a real temperature reading for Zen on Linux. All looks as expected on this workload, though.
 
Ryu Connor
Gold subscriber
Global Moderator
Posts: 4321
Joined: Thu Dec 27, 2001 7:00 pm
Location: Marietta, GA
Contact:

Re: Memory access priority?

Thu Oct 18, 2018 8:49 pm

Windows Key + I > System > About

Look on the right side of the menu where it says "Related settings" and click "System info"

Look on the left side of the new menu and click "Advanced system settings"

Look at the top where it says "Performance" and click "Settings..."

Click the "Advanced" tab and find "Processor scheduling" and set it from "Programs" to "Background services".
All of my written content here on TR does not represent or reflect the views of my employer or any reasonable human being. All content and actions are my own.
 
synthtel2
Gold subscriber
Gerbil Elite
Topic Author
Posts: 830
Joined: Mon Nov 16, 2015 10:30 am

Re: Memory access priority?

Thu Oct 18, 2018 9:04 pm

No change in the present issues. That would presumably do something about the scenario with the game.

Who is online

Users browsing this forum: Google [Bot], just brew it! and 5 guests