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.

4790k Affinity mask

Featured Replies

I have the 4790K with no OC set and use AffinityMask=84. Locked steady on 30fps no lag or stutters.

  • Replies 54
  • Views 13.3k
  • Created
  • Last Reply

Top Posters In This Topic

  • Commercial Member

84 is cool.

 

OK well to recap, if we look at the 4790k in HT mode we have 4 cores operating as 8 Logical processors. We know that each core is virtualised as two LPs. This means that the core looks like two, but in fact it is just a trick the hardware plays.

 

We have extra circuitry an each core that enables it to run two threads more efficiently than switching two threads on a regular core, and we get double the number of processors to play with, but not to compute with, we still only have four.

 

If we mask off to the sim one of a pair of LPs sharing a core, that core is acting more or less as a single processor (to the sim). Other processes can still target the LPs on that core.

 

 

The Affinity Mask we must choose, because we have HT=On, it's important to the sim and how addons interact with the sim.

 

84 = 01,01,01,00 - from the right we have 00 applied to core 0, which is LP0 and LP1, then the next core hosts the main sim thread on LP2, and we have LP3 masked so the next sim thread starting will not start there and contaminate the core, it finds an LP on the next core.

 

Generally we mask off the first core to the sim, so it's left spare for other processes to target. In the end it may not matter which core is left off, the least used cores are targeted.

 

Our mask also provides for one LP on a core to itself which is the first processor that the sim finds and runs the main thread. So we avoid sharing the core with another busy thread in the sim.

 

Other threads feed this thread with information by means of synchronization, and momentarily stop the sim. None the less we best have at least two of them. We mask off the other LP on this core because we want these other threads to start on another core, so as not to disrupt the LP on the core with the main thread.

 

Next our AM provides for the secondary threads, we want at least two so we use the mask to allow access to one LP on each of the other two cores we have left in this case.

 

The main point if HT=On is to be sure we don't load up another busy thread from the sim on the same core as the primary thread, we want to ensure the primary thread gets an uninterrupted LP.

 

 

We can pair up the secondary threads of the sim on each pair of LPs on some cores, to be sure to work those cores and they'll be sure to have data for the main sim thread when it needs it.

 

244 = 11,11,01,00 - Trouble is there's downsides, we have doubled the threads synchronizing with the main thread, but it's not too bad and we are pushing those cores with the two pairs running. We also have more chance of new tasks targeting cores 0 and 1, 1 having our main thread.

 

So we have to try it out, most setups will do well to follow these rules.

 

I tried to show in the image, that with the current hardware it's probably not so good to increase the number of cores or LPs available above 5 since the main thread is interrupted more often.

 

 

Similarly to 84 and 244 we can use 168, and 248. They allow the sim to choose LPs with the same set of rules and have the exact same performance. However they may result in other processes running on a different set of LPs and should be considered for testing.

 

 

We apply the same rules if we have 6 or 8 cores which yield 12 or 16 LPs. With these we can apply an AM that provides 5 threads with cores all to themselves. With a good overclock we may get benefit from more threads.

Steve Waite: Engineer at codelegend.com

Steve, PieEater  and All who helped me. :yahoo:

 

I gave  FIVE STAR to all of you. Finally after three months  fighting with horrible many bottle necks, stutters and  very low FPS  you guys gave me the best AM settings.  KEWR-KDEN flight PMDG 777 flew like a DREAM.  Enjoyed  40-60 FPS during the flight. Approach/landing FPS Outside view remained 40FPS, VC was around 25-35FPS. There was no a single bottle neck.

 

The winner  AM settings is : 43648  (All cores were open) :Party:

Thank you All.

 

P.S.I made typing error ,Yesterday's my two test flights AM settings were 244 and 21824 not 43648.

Ahmet Sanal

 

"Time you enjoyed wasting, was not wasted"

  • Commercial Member

Good work Ahmet.

 

43648 = 10,10,10,10,10,00,00,00 - 5 cores assigned one LP from each - perfect for an 8core HT=on.

Steve Waite: Engineer at codelegend.com

  • Commercial Member

...Interesting that 43648 (10,10,10,10,10,00,00,00) is favoured over 21824 (01,01,01,01,01,00,00,00), since they represent the same bandwidth. But like I said, and it's not easy to understand how, the layout can alter the way other processes are assigned to the cores.

 

 

Also it's not following PieEater's idea that the second LP of each core is somehow less performance. But don't worry, there's no difference in performance between the two LPs of an HT core; the differences are with the other processes already running before the sim starts, and processes that start after the sim.

Steve Waite: Engineer at codelegend.com

Also it's not following PieEater's idea that the second LP of each core is somehow less performance. But don't worry, there's no difference in performance between the two LPs of an HT core; the differences are with the other processes already running before the sim starts, and processes that start after the sim.

 

Yes I need to apologize for that, I was mistaken in my understanding of how hyperthreading works and can confirm that you have been correct all along - there is effectively no difference in performance between either logical processor on each core. I took my own advice and went away and did some testing in FSXMark.

 

Affinity Mask 84   (01010100) 35.36 FPS

Affinity Mask 168 (10101000) 35.45 FPS

 

This confirms that there is little to no difference when selecting the 1st Logical Processors (84) over the 2nd (168).

 

For continuity I also tested my preferred mask of 244 (11110100) and although this gave a slight drop in FPS (34.25) to my eye the rendering of textures and autogen seemed noticeably smoother, this was the same conclusion I reached last time and I remain happy to trade off a slight drop in speed for a smoother experience. Unfortunately I'm unable to test the performance using more cores but maybe someone else could pick up this batten.

 

Apologies again Steve and to anyone else for the confusion.

  • Commercial Member

Apologies again Steve and to anyone else for the confusion.

You are a gentleman, sir.

Steve Waite: Engineer at codelegend.com

  • 2 weeks later...

Some additional information from my side: I used to have AF=84 for all the time with my i7 and HT=on. Due to this thread here I now switched to AF=244 for some flights and yes, it is somehow a little more fluent. BUT a big thing let me switch back to AF=84 now: flying around in the A2A Cherokee around KORS resulted in very bad errors regarding the loading of sky textures. Each time I was changing the direction of view, big pale blue patches appeared in the sky and it took about 1 to 2 seconds for loading the proper sky texture in this view direction. This is specially annoying if you use TrackIR or similar tools, as your view direction basically changes all the time. Back to AF=84, this "effect" is gone, changing view directions does no longer result in delayed loading of the sky textures.

 

So, again this seems to be something you have to optimize for each and every setup individually. As so many other "tweaks"...

Greetings, Chris

AMD Ryzen 7 9800X3D, 2x32GB DDR5 6000MT/s RAM, MSI RTX 4090 Ventus 3X, Windows 11 Home, MSFS2024

  • Commercial Member

switched to AF=244

Yes, with 244 you have 5 threads, but 2 cores each have 2 competing threads, leading to contention. It is usually better to use just 3 threads, or get a CPU with more cores to run more threads on separate cores.

Steve Waite: Engineer at codelegend.com

That sounds reasonable, thanks for the heads up!

Greetings, Chris

AMD Ryzen 7 9800X3D, 2x32GB DDR5 6000MT/s RAM, MSI RTX 4090 Ventus 3X, Windows 11 Home, MSFS2024

Create an account or sign in to comment

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.