Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Affinity mask: word not allowed's guide

Featured Replies

7 hours ago, G MIDY said:

This tweak controls which CPU cores Prepar3D can use. However, Prepar3D cannot utilize multiple cores for a task and so it executes code in a singular way across single cores. A more modern approach would be to perform a single task across multiple cores so that the load is spread. You can see this in the task manager, if you load up Prepar3D and have a lot of AI, autogen etc then one of the cores will likely be getting hit 100%, the others however will barely be doing anything.

If you set an AM then Prepar3D will only be able to execute code on certain cores based upon that setting but the fundamental behaviour is still the same. Think of it as this, if you set AM to use 6 CPU cores then you have 6 people available to do any particular job. However, it still remains a problem that you cannot ask 2 people to help each other to do the same job so in reality the tweak will make no difference at all.

The default behaviour is that Prepar3D has all cores available so you are most likely to get maximum performance by leaving the tweak out. The only benefit I can see is setting an AM may help stability if you have lots of other things running in the background. For example you may wish to prevent Prepar3D from using a core to enable other applications to use that core.

The P3D Affinity Mask controls which logical processors P3D can use, not which cores per se--a "core" is a physical processor, and on intel CPUs with hyperthreading enabled (or AMD CPUs with SMT) each physical core supports two virtual, or "logical" processors that are separately considered when applying the AM mask.  Second, P3D does split off a considerable amount of its work into separate processes, called threads.  Those threads can, in turn, be assigned to any free LP by the OS (provided it's not masked out by the AM).  The main thread...the "heartbeat' of the simulation that directs everything else, runs in one big and very busy thread on the first LP available to the program.

In a CPU with HT or SMT enabled, each pair of LPs share a physical processing core and its L3 cache memory.  If you run with HT/SMT enabled, it's important to at least mask off one of the two LPs on the core that runs the main thread (P3D loads the main thread onto the first LP available to it), because you don't want that main thread competing for resources (processing time or available L3 cache) with other P3D threads that could be assigned by the OS to that core's shared LP.  If HT/SMT is disabled, an LP is synonymous with a physical core...and to make matters even more complex, on 10th/11th gen intel CPUs you can selectively turn HT on/off for individual cores.

Also, it's possible to have "too many cooks in the kitchen" where having threads assigned across too many LPs starts causing issues with thread scheduling and synchronization.  My experience suggests that 10 LPs is something of a sweet spot, or point of diminishing returns for P3D at present...so with a 10-core CPU I leave HT off and don't assign an AM, allowing the program to use all 10 physical cores.  When I ran P3D on a quad-core i7-7700K, however, HT on worked better--but only with an AM that blocked one LP on core 0 to prevent a lot of microstuttering.  In that use case, the tweak made a clear difference in performance.

 

 

Bob Scott | President and CEO, AVSIM Inc
ATP Gulfstream II-III-IV-V

Sys1 (MSFS20+24/XPlane12+11): AMD 9800X3D, water 2x240mm, MSI MPG X670E Carbon, 64GB GSkill 6000/30, nVidia RTX4090FE
Alienware AW3821DW 38" 21:9 GSync, 2x4TB Crucial T705 PCIe5 + 2x2TB Samsung 990 SSD, EVGA 1000P2 PSU, 12.9" iPad Pro
Thrustmaster TCA Boeing Yoke, TCA Airbus Sidestick, Twin TCA Airbus Throttle quads, PFC Cirrus Pedals, Coolermaster HAF932 case

Sys2 (P3Dv5/v4): i9-13900KS, water 2x360mm, ASUS Z790 Hero, 32GB GSkill 7800MHz CAS36, ASUS RTX4090
Samsung 55" JS8500 4K TV@60Hz,
3x 2TB WD SN850X 1x 4TB Crucial P3 M.2 NVME SSD, EVGA 1600T2 PSU
Fiber link to Yamaha RX-V467 Home Theater Receiver, Polk/Klipsch 6" bookshelf speakers, Polk 12" subwoofer, 12.9" iPad Pro
PFC yoke/throttle quad/pedals with custom Hall sensor retrofit, Thermaltake View 71 case, Stream Deck XL button box

Sys3 (DCS/P3Dv4/ATS/ETS): AMD 7800X3D, MSI MPG X870E Carbon, Noctua NH-D15S, 64GB GSkill 6000/30, EVGA RTX3090
Alienware AW3420DW 34" 21:9 GSync, Corsair HX1000i PSU, 4TB Crucial T705 PCIe5 + 2TB Samsung 970Evo Plus,
TM TCA Officer Pack
, Saitek combat pedals, TM Warthog, TM RS300 FF wheel/pedals, Coolermaster HAF XB case

  • Replies 33
  • Views 5.9k
  • Created
  • Last Reply
49 minutes ago, w6kd said:

When I ran P3D on a quad-core i7-7700K, however, HT on worked better--but only with an AM that blocked one LP on core 0 to prevent a lot of microstuttering.  In that use case, the tweak made a clear difference in performance.

I think this is a key element for people who aren't using AffinityMask to consider:

Considering the sim uses LP0 much more than any other LP, it's important to (at the very least) get the sim off of LP1 (the second LP of core 0). You don't want to be potentially taking resources from LP0 which for most people is the bottleneck to performance. 

Every binary AM setting used in P3D should end with 01. After that, we can debate HT/noHT for the other cores all day long. 

And from my experience (at least in 4.5), leaving out LP0 in any way completely breaks the sim. It performs great as long as you fly, but nothing will ever load beyond the initial loading phase, resulting in severe blurries. 

7 minutes ago, DChockey08 said:

Every binary AM setting used in P3D should end with 01. After that, we can debate HT/noHT for the other cores all day long.

If you have 8 or 10 cores yes, less than that you may need to double one or two up, especially if you need to keep cores free for 3rd party apps.

Kevin Firth - AMD 9800X3D; Asus Prime X670E; 64Gb Cas30 6000 DDR5; RTX5090; AutoFPS

25 minutes ago, kevinfirth said:

If you have 8 or 10 cores yes, less than that you may need to double one or two up, especially if you need to keep cores free for 3rd party apps.

Agreed, but to be clear I was referring only to core 0, which comes at the end of the binary string - so LP0 on and LP1 off.

What settings should be used on other cores depends on many things. But anyone with at least a quad-core HT-enabled CPU should be turning off LP1. 

So, based on 

7 hours ago, w6kd said:

When I ran P3D on a quad-core i7-7700K, however, HT on worked better--but only with an AM that blocked one LP on core 0 to prevent a lot of microstuttering.  In that use case, the tweak made a clear difference in performance.

what would be the affinity mask entry for an Intel Core i7-8700K CPU (6 cores with 12 LPs) with HT on?

In the Prepar3D.cfg file, I would have...

[JOBSCHEDULER]
AffinityMask=???

dv

Win 10 Pro || i7-8700K ||  32GB || ASUS Z370-P MB || NVIDIA GeForce GTX 1080 Ti 11Gb || 2 960 PRO 1TB, 840 EVO

My Files in the AVSIM Library

11 hours ago, kevinfirth said:

How can you be sure that the main thread stays on core 2 for the duration?

Check the screen pics, see core #3 and that big gap between the red (kernal code) and green (user code), that's the main thread at work and it's always on #3 because that is where the affinity mask placed it. 

And then all we are then doing is saying - hey also use Core 0 & 1.

Check, check and away we go.

Cheers

Ryzen 5800X clocked to 4.7 Ghz (SMT off), 32 GB ram, Samsung 1 x 1 TB NVMe 970, 2 x 1 TB SSD 850 Pro raided, Asus Tuf 3080Ti

P3D 4.5.14, Orbx Global, Vector and more, lotsa planes too.

Catch my vids on Oz Sim Pilot, catch my screen pics @ Screenshots and Prepar3D

28 minutes ago, David Vega said:

what would be the affinity mask entry for an Intel Core i7-8700K CPU (6 cores with 12 LPs) with HT on?

In the Prepar3D.cfg file, I would have...

[JOBSCHEDULER]
AffinityMask=???

Check the link provided in this post

The cacluator will generate the value based on the boxes you've ticked.

Couldn't be any easier, HT/SMT on or off or just straight cores with no HT/SMT.

You'd probably want to put P3D on the cores and not the threads.

But hey it's only a few lines of text in the Prepar3d.cfg - do feel free to experiment for what would work best for yourself.

Cheers

Ryzen 5800X clocked to 4.7 Ghz (SMT off), 32 GB ram, Samsung 1 x 1 TB NVMe 970, 2 x 1 TB SSD 850 Pro raided, Asus Tuf 3080Ti

P3D 4.5.14, Orbx Global, Vector and more, lotsa planes too.

Catch my vids on Oz Sim Pilot, catch my screen pics @ Screenshots and Prepar3D

On clean install of W11 Insider preview with P3D 5.2. AffinityMask is redundant. OS spreads the load over more cores by default. Running on 11900k. Not sure what Ryzen or 10th Gen down would look like.

Edited by 40track
Word now allowed fixed

On 8/27/2021 at 9:30 PM, 40track said:

On clean install of W11 Insider preview with P3D 5.2. AffinityMask is redundant. OS spreads the load over more cores by default. Running on 11900k. Not sure what Ryzen or 10th Gen down would look like.

I think you have a misconception of what AM is supposed to do--its purpose is to *limit* the LPs to which P3D threads can be assigned, not to improve tasking across the available LPs.

Bob Scott | President and CEO, AVSIM Inc
ATP Gulfstream II-III-IV-V

Sys1 (MSFS20+24/XPlane12+11): AMD 9800X3D, water 2x240mm, MSI MPG X670E Carbon, 64GB GSkill 6000/30, nVidia RTX4090FE
Alienware AW3821DW 38" 21:9 GSync, 2x4TB Crucial T705 PCIe5 + 2x2TB Samsung 990 SSD, EVGA 1000P2 PSU, 12.9" iPad Pro
Thrustmaster TCA Boeing Yoke, TCA Airbus Sidestick, Twin TCA Airbus Throttle quads, PFC Cirrus Pedals, Coolermaster HAF932 case

Sys2 (P3Dv5/v4): i9-13900KS, water 2x360mm, ASUS Z790 Hero, 32GB GSkill 7800MHz CAS36, ASUS RTX4090
Samsung 55" JS8500 4K TV@60Hz,
3x 2TB WD SN850X 1x 4TB Crucial P3 M.2 NVME SSD, EVGA 1600T2 PSU
Fiber link to Yamaha RX-V467 Home Theater Receiver, Polk/Klipsch 6" bookshelf speakers, Polk 12" subwoofer, 12.9" iPad Pro
PFC yoke/throttle quad/pedals with custom Hall sensor retrofit, Thermaltake View 71 case, Stream Deck XL button box

Sys3 (DCS/P3Dv4/ATS/ETS): AMD 7800X3D, MSI MPG X870E Carbon, Noctua NH-D15S, 64GB GSkill 6000/30, EVGA RTX3090
Alienware AW3420DW 34" 21:9 GSync, Corsair HX1000i PSU, 4TB Crucial T705 PCIe5 + 2TB Samsung 970Evo Plus,
TM TCA Officer Pack
, Saitek combat pedals, TM Warthog, TM RS300 FF wheel/pedals, Coolermaster HAF XB case

2 hours ago, w6kd said:

I think you have a misconception of what AM is supposed to do--its purpose is to *limit* the LPs to which P3D threads can be assigned, not to improve tasking across the available LPs.

Yes was thinking wrong about it. Good call.

Edited by 40track

On 8/27/2021 at 1:29 PM, kevinfirth said:

I have found through trial and error that my system works best with HT on (so 20 virtual cores), and an AM set of 00000101010101010101.

Kevin, did you play with something like 00001111111101010101?

1111010101010101 seemed to work a tad better on my i9 9900K  or it was something else  ))

Thanks.

5 hours ago, Dirk98 said:

Kevin, did you play with something like 00001111111101010101?

1111010101010101 seemed to work a tad better on my i9 9900K  or it was something else  ))

Thanks.

I've found about 8 logical/physical cores appears to be the sweet spot for maximum performance without overloading the main rendering thread.  The 10 core 10850K permits 8 physical cores to be used by P3D, one thread per each, leaving 2 physical/4 virtual cores for other add-ons.  All is peachy for me 🙂

Kevin Firth - AMD 9800X3D; Asus Prime X670E; 64Gb Cas30 6000 DDR5; RTX5090; AutoFPS

I'm wondering how many AM threads do exist in this forum. Since I have a 8 core machine, I keep hyperthreading off and leave AM out of the game. That turned out to be the best for my system and P3D/MSFS experience. YMMV.

- Harry 

9800x3D (Strix x870e-E)  -  64GB RAM (DDR5 6000, CL 30)  -  RTX 5090, 34'' 1440p OLED HDR  -  Windows 11 Pro (1TB M.2)  -  MSFS 2024 (MS Store, 4TB M.2).

2 hours ago, kevinfirth said:

I've found about 8 logical/physical cores appears to be the sweet spot for maximum performance without overloading the main rendering thread.  The 10 core 10850K permits 8 physical cores to be used by P3D, one thread per each, leaving 2 physical/4 virtual cores for other add-ons.  All is peachy for me 🙂

4 first threads (including the main one, of course) per 1 physical core each (0-3) for Prepar3D.exe is common knowleadge. My question question was about mixing further threads on cores 4-7, but never mind.

Do I read you right your 10 core 10850K permits only 8 physical cores to be used by P3D or did I miss something with the latest 10K CPUs? Must be all 10 should you want it (hex 55555 and I know all 10 cores for Prepar3D.exe may work counterproductive).

Edited by Dirk98

6 minutes ago, Dirk98 said:

4 first threads (including the main one, of course) per 1 physical core each (0-3) for Prepar3D.exe is common knowleadge. My question question was about mixing further threads on cores 4-7, but never mind.

Do I read you right your 10 core 10850K permits only 8 physical cores to be used by P3D or did I miss something with the latest 10K CPUs? Must be all 10 should you want it (hex 55555 and I know all 10 cores for Prepar3D.exe may work counterproductive).

Sorry I'll be more specific!

Yes I tried mixing further threads but didn't perceive much if any improvement.

I choose only to use 8 of the 10 cores for P3D, could use all 10, but 8 gives my great performance and leaves 2 cores free for other apps.

Kevin Firth - AMD 9800X3D; Asus Prime X670E; 64Gb Cas30 6000 DDR5; RTX5090; AutoFPS

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.