Jump to content
Sign in to follow this  
FSXCYYZEGLL

Affinity Mask, value needed

Recommended Posts

Renaming the dll.xml file temporarily to for example dll.xml.sav is what we might do to quickly test to see that there's no big problems coming from those loaded dlls, we can do the same for exes. If your AM changes are making a difference then there could be some kind of problem with where other apps run on the CPU. With the sim on four straight cores (AM=85 or 170) you'll get the best result but you need to move your exe apps up onto the last two cores. Otherwise reserve the first core for apps by the use of AM=116.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
Share on other sites

Renaming the dll.xml file temporarily to for example dll.xml.sav is what we might do to quickly test to see that there's no big problems coming from those loaded dlls, we can do the same for exes. If your AM changes are making a difference then there could be some kind of problem with where other apps run on the CPU. With the sim on four straight cores (AM=85 or 170) you'll get the best result but you need to move your exe apps up onto the last two cores. Otherwise reserve the first core for apps by the use of AM=116.

 

How can I move my exe apps unto the last 2 cores? By just manual input?

 

Signed Jon

Share this post


Link to post
Share on other sites

Renaming the dll.xml file temporarily to for example dll.xml.sav is what we might do to quickly test to see that there's no big problems coming from those loaded dlls, we can do the same for exes. If your AM changes are making a difference then there could be some kind of problem with where other apps run on the CPU. With the sim on four straight cores (AM=85 or 170) you'll get the best result but you need to move your exe apps up onto the last two cores. Otherwise reserve the first core for apps by the use of AM=116.

ASN recommends using 3 cores top, I looked up the affinity mask calculator and it said an affinity mask of 16. so would 16 only make me use 3 cores and only physical cores? Also does AM=116 just mean core 0 is being used for apps and everything else is on for simulator.

 

Signed Jon.

Share this post


Link to post
Share on other sites

How can I move my exe apps unto the last 2 cores? By just manual input?

 

Signed Jon

Batch file, FSUIPC, Process Lasso...

 

ASN recommends using 3 cores top, I looked up the affinity mask calculator and it said an affinity mask of 16. so would 16 only make me use 3 cores and only physical cores? Also does AM=116 just mean core 0 is being used for apps and everything else is on for simulator.

 

Signed Jon.

I think you misinterpreted their intent, I think they are talking about a four core and reserving one for ASN. Yes 116=01,11,01,00 means the sim utilises three cores (cores 2, 3 on the left) but four LPs, the two LPs on the same core (core 2, LPs 4, 5) generally don't max out together during the regular running of the sim, combining any other two LPs reduces performance. Four straight cores yeilds slightly better performance and loads the scenario faster but inevitably you'll have your addon exe processes mixing with those. At least with 116 you leave one core free for ASN (core 0, LPs 0, 1) but you need to keep all your exe addons there.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
Share on other sites

my understanding is that hyperthreading should be turned off for best results and an affinity mask of 15 should be used (binary 1110).


Ryzen 5800X3D, Nvidia 3080 - 32 Gig DDR4 RAM, 1TB & 2 TB NVME drives - Windows 11 64 bit MSFS 2020 Premium Deluxe Edition Resolution 2560 x 1440 (32 inch curved monitor)

Share this post


Link to post
Share on other sites

You need to carry out your own tests and investigate the theory. AM=15 thats binary 1111. If you have a Hyperthreading CPU then turning off your HT is a bit of a howler to be honest. Better to run a four core+HT with HT enabled and AM 85 or 170, or reserve core zero and AM=116.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
Share on other sites

my understanding is that hyperthreading should be turned off for best results and an affinity mask of 15 should be used (binary 1110).

1110 is actually 14, not 15


Bert

Share this post


Link to post
Share on other sites

sorry Bert, slip of the pen (finger). I meant 14.


Ryzen 5800X3D, Nvidia 3080 - 32 Gig DDR4 RAM, 1TB & 2 TB NVME drives - Windows 11 64 bit MSFS 2020 Premium Deluxe Edition Resolution 2560 x 1440 (32 inch curved monitor)

Share this post


Link to post
Share on other sites

Let's put it in a very simplified way; take a CPU core and imagine it has two stages, the first stage shall we say "arranges" the code to be computed, there's a lot going on here branch prediction for example, call it the pre-compute stage, the second stage does the real process of computing all that. So if we imagine an 8 core non HT CPU we have 8 compute stages supplied by 8 pre-compute stages. Now look at the four core+HT with HT enabled, this is 8 pre-compute stages supplying 4 compute stages, 8 logical processors (LP) but only 4 cores. So in effect the doubling of the pre-compute stages can increase the overall performance of the PC by up to 30%. Certain software looks at each LP as a real core and creates a process on each core to run tasks in parallel, it would make 2 processes per core instad of one, which can detract from the performance depending on how those processes communicate their results. So a program (P3D for example) will occupy all 8 LPs even though it really only wants to occupy 4 cores. That's why the AffinityMask (AM) is provided. At first the sim will look at it's AM and decide what to do, as it is started up it will inherit the affinity of the starting process, generally all LPs enabled when started from the desktop icon, it first divides its processes (containing over 50 threads) across the unmasked LPs in the AM and asserts its AM on the system, the jobscheduler only utilises the LPs the sim is working on, and starts all subsequent threads, network clients addon dlls gauges and so on within that affinity. Addon exe apps don't run in the affinity of the sim.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
Share on other sites

 

What of the CPU cache memory? Part of the cache memory (L3) is divided amongst all the cores on the CPU, with the intel core CPUs it's divided amongst all the threads running on that CPU, AMDs may be different. Whether we have HT enabled or not two threads on that CPU will use the same cache. However, if we have apps making two processes per core we doubled the number of processes which will obviously have the effect of thinning out the available cache. The wiki docs suggest that since the core has two pre-compute stages it can sort of run two threads instead of one and in this way the available cache is shared between them. This can be mis-interpreted as the cache effectiveness is reduced with HT enabled, but it's not, you actually have to add more threads to the CPU to do that.

 

...all subsequent threads, network clients addon dlls gauges and so on...

I should add that network clients include addons that invoke SimConnect clients on the sim. Remember that although addon exe apps don't run in the affinity of the sim, their SimConnect clients do, and those clients are there even if we don't have another networked PC on the router, the sim uses the network locally.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
Share on other sites

Seem to have found a sort of manual fix, via windows task manager I tell fsx to use cores 1-3 only and tell asn to use cores 0 only worked on 1 flight, the other flight told it to use 1-4 and froze after about 4 hours but much less often, so starting to make progress. Thanks for the help so far everyone.

 

Signed Jon.

Share this post


Link to post
Share on other sites

I presume you are talking four core HT disabled there. It's possible with only one LP assigned to a network bound addon exe it can contribute to pauses. Another thing, don't be tempted to increase priority on the sim since it relies on other processes that would by definition become lower in priority. When you use task manager and uncheck a core that the sim is using, those threads on that core are moved onto the remaining cores, so it's not working the same as starting the sim with the appropriate affinity. Instead with 4 core HT off start the sim without an AM and run ASN and uncheck cores zero and one on that leaving it on cores 2 and 3.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
Share on other sites

I presume you are talking four core HT disabled there. It's possible with only one LP assigned to a network bound addon exe it can contribute to pauses. Another thing, don't be tempted to increase priority on the sim since it relies on other processes that would by definition become lower in priority. When you use task manager and uncheck a core that the sim is using, those threads on that core are moved onto the remaining cores, so it's not working the same as starting the sim with the appropriate affinity. Instead with 4 core HT off start the sim without an AM and run ASN and uncheck cores zero and one on that leaving it on cores 2 and 3.

Thank you so much I did what you said, to leave fsx on all 8 cores, and unchecked asn on cores 0 and 1, leaving it on 2 and 3. And it flew like a breeze 13 hours flying plus 2 hours getting ready from toronto to delhi in the pmdg 777( with Ultimate traffic 2), not one freeze at all. Hopefully that's the end of it.

 

Signed Jon.

Share this post


Link to post
Share on other sites

It's not perfect but the main thing is you got ASN away from the cores doing the rendering so they keep up the pace when ASN does the preparation of the weather for injection. Good work Jon.

 

...by the way, looking at the CPU usage in task manager and thinking some app only uses 3% why worry about it? It's interrupting the consistent flow no matter how much CPU it's using. CPU use % is not intuitive on a per app basis since it is an averaged value and also looks different on the graph depending on core count and turbo modes.


Steve Waite: Engineer at codelegend.com

Share this post


Link to post
Share on other sites

Renaming the dll.xml file temporarily to for example dll.xml.sav is what we might do to quickly test to see that there's no big problems coming from those loaded dlls, we can do the same for exes. If your AM changes are making a difference then there could be some kind of problem with where other apps run on the CPU. With the sim on four straight cores (AM=85 or 170) you'll get the best result but you need to move your exe apps up onto the last two cores. Otherwise reserve the first core for apps by the use of AM=116.

Well seems like if I keep am=116 and putting asn off core 0,1 the freeze appears to occur only every 16 hours. If i put affinity mask to anything else or get rid of it at all the freezes come immediately back.

 

Signed Jon.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...