Hyper-threading question
Page 1 of 1
StrEagle




Posts: 14059
Location: Balkans
PostPosted: Wed, 11th Mar 2015 15:07    Post subject: Hyper-threading question
If you have a HT CPU

and run a big multi-threaded executable, say an AAA game
can 2 big threads land on the same core and it's hyper-thread?
is that possible?
will it result in a performance hit, than if the 2 threads land on separate cores?
I was told that this can be avoided by a small thread affection setting by the devs of the .exe, but do most devs do this?


Lutzifer wrote:
and yes, mine is only average
Back to top
paxsali
Banned



Posts: 18352

PostPosted: Wed, 11th Mar 2015 15:44    Post subject:
⁢⁢


Last edited by paxsali on Thu, 4th Jul 2024 21:50; edited 1 time in total
Back to top
BearishSun




Posts: 4484

PostPosted: Wed, 11th Mar 2015 18:47    Post subject: Re: Hyper-threading question
HyperThreading isn't really about registers, they're a part of it, but they're more means to and end. The main advantages of hyperthreading are:
- 1. Modern CPUs spend incredible amount of times waiting for data from memory. This has been becoming extreme during the last few years as the CPUs have been getting faster and memory latency staying the same. CPUs can now execute operations so fast that a naively made applications end up using 25-50% of the provided CPU cycles, and are waiting for memory the rest of the time. HyperThreading allows two threads to run on the same core so that when a thread needs to wait for memory, the CPU can quickly switch to the second thread and execute that (which is why the CPU needs two sets of registers, to allow for the fast thread switch)
- 2. Modern CPUs cores have multiple execution units within them. e.g. a single core can have three floating point units, so it may perform three calculations at once. So even when a single thread isn't waiting for memory, but perhaps isn't making use of all the FP units, other thread can use them (again this requires two sets of registers so two calculations can happen at once).

Technically it can happen that another thread steals resources from another. But Windows thread scheduler is aware that your CPU is hyper threaded and should prevent any obvious issues with it (like assigning two big threads to the same physical core if there's room elsewhere). How the scheduler works internally or how does it deal with HT I do not know. But I do know it's not perfect, it doesn't know what the threads are doing and it makes a lot of estimates to properly distribute the load. I imagine it can make mistakes and in some cases your performance can drop.

I would imagine this being an issue only when your application is running heterogenous threads (like a game) and you are bottlenecked by a single thread (which is commonly the case with the rendering thread in games). In such cases that resource stealing could effect frame rate as the rendering thread will not run as fast as it could otherwise.

However that's just guesswork, I haven't actually noticed or tested this in practice. I've seen some benchmarks and at worst it's a performance drop of a few percent, which seems in line with what I know about it.

Developers should be able to control it using thread affinity, but most engines I've seen don't use thread affinity and leave it to the OS to distribute the threads as it sees fit. They will usually set different thread priorities, but I'm not sure if Windows scheduler takes into account when used with HT.
Back to top
Shoshomiga




Posts: 2378
Location: Bulgaria
PostPosted: Thu, 12th Mar 2015 11:35    Post subject: I have left.
I have left.
Back to top
DV2




Posts: 5234

PostPosted: Thu, 12th Mar 2015 15:29    Post subject:
@paxsali: Wrong user,buddy.


ASUS X570 TUF GAMING PLUS, 32GB DDR4@2666 ,RYZEN 5800X3D (NO OC),GIGABYTE RTX 4070 Super GAMING OC, Western Digital Blue 4TB 5400RPM + SAMSUNG 860 EVO 500+1TB GB SSDs , OEM SATA DVD 22xNoctua NH-D15 Chromax Black, BenQ XL2420T Case: Be Quiet! DARK BASE PRO 901. PSU CORSAIR RM1200 SHIFT
Back to top
paxsali
Banned



Posts: 18352

PostPosted: Thu, 12th Mar 2015 15:31    Post subject:
⁢⁢
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Hardware Zone
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group