The MASM Forum

Miscellaneous => The Orphanage => Topic started by: Magnum on August 29, 2018, 11:44:45 AM

Title: Hyperthreading
Post by: Magnum on August 29, 2018, 11:44:45 AM
Is there a way to know if my cpu is  actually using hyperthreading?

My cpu has the ht flag set. It has 4 cores.

Thanks.

Title: Re: Hyperthreading
Post by: felipe on August 29, 2018, 11:48:00 AM
You can get an idea checking in the bios setup menu if that technology is enabled/disabled...:idea:
Title: Re: Hyperthreading
Post by: hutch-- on August 29, 2018, 12:34:57 PM
Andy,

Identify your processor then go to the Intel site to get all of the specs. If its a "core" series, you only have the cores, not the hyper threading.
Title: Re: Hyperthreading
Post by: Magnum on August 29, 2018, 01:07:48 PM
I have an AMD A8-7600 Radeon R7, 10 Compute Cores 4C+6G.

I will check their site.

Simultaneous Multi-Threading is AMDs version.

I don't think my chip has it.

Title: Re: Hyperthreading
Post by: aw27 on August 29, 2018, 03:07:31 PM
The best True Masm (TM) approach is to use the cpuid instruction. Details left as an exercise.
Hint: HT bit -> Number of Logical Cores -> Number of Physical Cores
Title: Re: Hyperthreading
Post by: LiaoMi on August 29, 2018, 08:13:24 PM
GetLogicalProcessorInformation https://msdn.microsoft.com/en-us/library/ms683194%28VS.85%29.aspx (https://msdn.microsoft.com/en-us/library/ms683194%28VS.85%29.aspx)
Title: Re: Hyperthreading
Post by: HSE on August 29, 2018, 11:15:27 PM
Raistlin "ExtremeID System Profiler" (or Hardware Enumerator [pre-release] (http://masm32.com/board/index.php?topic=5964.0)) show that. In AMD A6-3500 I have "1 thread/core". I think that is not HyperThreading  :eusa_naughty:.
Title: Re: Hyperthreading
Post by: hutch-- on August 30, 2018, 12:32:33 AM
Hector, it must be a historical device if its a single core processor. There are some crude tests by creating 2 threads. On a multi-core machine two threads will be faster than two threads on a single core processor by about 80%. I still have a 3.8 gig PIV that I keep for my scanner and microscope that runs XP but I think it was a hyperthreaded processor.
Title: Re: Hyperthreading
Post by: HSE on August 30, 2018, 02:25:36 AM
Oops !! HyperThreading is an Intel's tecnology. (not posible in this 3 core AMD)

Quote from: hutch-- on August 30, 2018, 12:32:33 AM
There are some crude tests by creating 2 threads.
Yes, I have somewhere the test you make some time ago (not here, obviously it could be in 64bit machine).

Quote from: hutch-- on August 30, 2018, 12:32:33 AM
I still have a 3.8 gig PIV that I keep for my scanner and microscope that runs XP but I think it was a hyperthreaded processor.
Yes it's.

I also have an Intel 2 Core, but not HyperThreading in it.


Title: Re: Hyperthreading
Post by: Siekmanski on August 30, 2018, 02:40:13 AM
As far as I know AMD Ryzen and Threadripper supports simultaneous multithreading (SMT).
Hyper-threading is Intel's proprietary SMT implementation.

The new AMD Threadripper 2990 WX has 32 cores and 64 threads.
Title: Re: Hyperthreading
Post by: daydreamer on August 30, 2018, 06:58:45 AM
Quote from: Siekmanski on August 30, 2018, 02:40:13 AM
As far as I know AMD Ryzen and Threadripper supports simultaneous multithreading (SMT).
Hyper-threading is Intel's proprietary SMT implementation.

The new AMD Threadripper 2990 WX has 32 cores and 64 threads.
if someone has suggestions todo with all these threads or to start with just do something useful with 2 cores,plz let me know
otherwise I will end up using only 100%/64 performance when I get a threadripper
Title: Re: Hyperthreading
Post by: felipe on August 30, 2018, 08:14:08 AM
Quote from: daydreamer on August 30, 2018, 06:58:45 AM
Quote from: Siekmanski on August 30, 2018, 02:40:13 AM
As far as I know AMD Ryzen and Threadripper supports simultaneous multithreading (SMT).
Hyper-threading is Intel's proprietary SMT implementation.

The new AMD Threadripper 2990 WX has 32 cores and 64 threads.
if someone has suggestions todo with all these threads...

Probably for servers?  :idea:
Title: Re: Hyperthreading
Post by: Siekmanski on August 30, 2018, 02:52:53 PM
There are many algorithms that could benefit from multithreading when latency is a big issue.
For example:
- Digital Audio Workstations with 64 audio tracks with realtime effects per track mixed to one stereo track.
- Large FFT IFFTs.
- Moving large memory blocks.
- Rendering of complicated 3D scenes in software.

Now I only have to convince my wife that I need 32 cores......  :biggrin:
Title: Re: Hyperthreading
Post by: Raistlin on August 30, 2018, 03:26:38 PM
AMD CPU detects do use the CPUID - HT/CMPLegacy flags as part of the core/thread detection algorithm.
As such my little app (still in its infancy) correctly reports such. Sorry if this is confusing to some - it's not meant as Intel HT.   

From the AMD manuals :
HTT: hyper-threading technology. Indicates either that there is more than one thread per core or more than one core per processor.
CPUID Fn0000_0001_EBX[LogicalProcessorCount]
CPUID Fn0000_0001_EDX[HTT] (Hyper-Threading Technology)
CPUID Fn8000_0001_ECX[CmpLegacy]
CPUID Fn8000_0008_ECX[NC] (number of cores - 1)
Title: Re: Hyperthreading
Post by: daydreamer on August 30, 2018, 09:49:45 PM
Quote from: Siekmanski on August 30, 2018, 02:52:53 PM
There are many algorithms that could benefit from multithreading when latency is a big issue.
For example:
- Digital Audio Workstations with 64 audio tracks with realtime effects per track mixed to one stereo track.
- Large FFT IFFTs.
- Moving large memory blocks.
- Rendering of complicated 3D scenes in software.

Now I only have to convince my wife that I need 32 cores......  :biggrin:
*run number crunching programs in background*
-"wifey,we have to get a faster computer,look here its extremely slow,I can't even do simple things as surf web,its extremely slow and hangs and crashes alot" :P :badgrin:

64 windows simultanously running 64 different assembly demos!!! :P :lol:
Title: Re: Hyperthreading
Post by: Siekmanski on August 31, 2018, 12:44:49 AM
 :biggrin:
Title: Re: Hyperthreading
Post by: aw27 on August 31, 2018, 03:38:17 AM
Quote from: Raistlin on August 30, 2018, 03:26:38 PM
From the AMD manuals :
HTT: hyper-threading technology. Indicates either that there is more than one thread per core or more than one core per processor.
Exactly! So, these days virtually all CPUs have the HT bit set and we can't rely on that to tell whether Hyperthreading is being used or not because almost all processors are multi-core and many are both multi-core and have Hyperthreading.

I attach code to detect Hyperthreading (the real one), Logical Cores and Physical Cores Information. I have no AMDs, so please anyone with AMD let me know if it tells the truth or not.


Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Hyperthreading 1 Logical Cores 12 Physical Cores 6


Note: There is another way to find the information which digs deeper than this one. May be I will handle it sometime soon.

Title: Re: Hyperthreading
Post by: felipe on August 31, 2018, 04:47:55 AM
That's great aw, thanks for sharing your work.  :icon14: All seems to be correct here, all the information provided in this program is the same provided from microsoft windows and other program too.  :icon14:

But what's supposed to be the hyperthreading number?   :idea: I get a 1 there. In the other programs i don't get any info about hyperthreading. But in the machine is enabled the hyperthreading technology in the bios setup.  And there it say something like:
Quote"when disabled only 1 thread will be enabled from each enabled core."
.  :idea:
Title: Re: Hyperthreading
Post by: felipe on August 31, 2018, 04:51:01 AM
Btw, i think something like this should be in the workshop... :idea:

But it's just a suggestion  :redface:

Title: Re: Hyperthreading
Post by: aw27 on August 31, 2018, 05:13:53 AM
hi felipe,
Thank you for your comments.
hyperthreading can only be TRUE or FALSE. To make a long story shorter I decided  :biggrin: to make TRUE=1 and FALSE=0.
Title: Re: Hyperthreading
Post by: felipe on August 31, 2018, 08:37:45 AM
Ok, i had thought on that, but i wasn't sure. Thanks again.  :icon14:
Title: Re: Hyperthreading
Post by: hutch-- on August 31, 2018, 03:20:24 PM
If you have to find out if the processor is either AMD or Intel, the ID string should do that for you.
Title: Re: Hyperthreading
Post by: aw27 on August 31, 2018, 04:33:14 PM
Quote from: hutch-- on August 31, 2018, 03:20:24 PM
If you have to find out if the processor is either AMD or Intel, the ID string should do that for you.

Yes, but someone whispered into my ears that this cores detection procedure may not work with some AMD models (Ryzen?).
Title: Re: Hyperthreading
Post by: LiaoMi on August 31, 2018, 06:49:00 PM
Quote from: AW on August 31, 2018, 04:33:14 PM
Quote from: hutch-- on August 31, 2018, 03:20:24 PM
If you have to find out if the processor is either AMD or Intel, the ID string should do that for you.

Yes, but someone whispered into my ears that this cores detection procedure may not work with some AMD models (Ryzen?).

Hi AW,

I cant test anymore, I bought a gift Asus Rog Ryzen 7 1700 for my parents, now that they left home, there is no laptop for the test anymore  :biggrin: :(
Title: Re: Hyperthreading
Post by: aw27 on September 01, 2018, 05:07:56 AM
Quote from: LiaoMi on August 31, 2018, 06:49:00 PM
Hi AW,
I cant test anymore, I bought a gift Asus Rog Ryzen 7 1700 for my parents, now that they left home, there is no laptop for the test anymore  :biggrin: :(

Hi LiaiMi,
Too bad  :(, may be you can save the program in a memory card and test when you visit your parents  :idea: .

Just kidding  :biggrin: . Never mind, I am trying someone else to test on a ThreadRipper. Intimately, I believe the software works correctly on all existing AMD as well (may be not on future AMDs). 
Title: Re: Hyperthreading
Post by: Magnum on September 08, 2018, 12:02:02 PM
Quote from: AW on August 31, 2018, 03:38:17 AM
Quote from: Raistlin on August 30, 2018, 03:26:38 PM
From the AMD manuals :
HTT: hyper-threading technology. Indicates either that there is more than one thread per core or more than one core per processor.
Exactly! So, these days virtually all CPUs have the HT bit set and we can't rely on that to tell whether Hyperthreading is being used or not because almost all processors are multi-core and many are both multi-core and have Hyperthreading.

I attach code to detect Hyperthreading (the real one), Logical Cores and Physical Cores Information. I have no AMDs, so please anyone with AMD let me know if it tells the truth or not.


Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Hyperthreading 1 Logical Cores 12 Physical Cores 6


Note: There is another way to find the information which digs deeper than this one. May be I will handle it sometime soon.

I have an AMD. Your code works perfectly.

AMD A8-7600 Radeon R7, 10 Compute Cores 4C+6G 
Hyperthreading 0 Logical Cores 4 Physical Cores 4

Title: Re: Hyperthreading
Post by: aw27 on September 08, 2018, 10:38:33 PM
Quote
I have an AMD. Your code works perfectly.

Thank you for letting me know.  :t
However, it does not report as expected for the family 17 (Ryzen processors). I will experiment with the other approach ASAP.
Title: Re: Hyperthreading
Post by: Magnum on September 08, 2018, 11:15:55 PM
Glad to help.