Thread overview
[Issue 19861] core.cpuid reports the wrong number of threads
May 16, 2019
Seb
May 25, 2019
Rainer Schuetze
May 28, 2019
Rainer Schuetze
May 30, 2019
Dlang Bot
Jun 28, 2019
Dlang Bot
May 17, 2020
Dlang Bot
May 16, 2019
https://issues.dlang.org/show_bug.cgi?id=19861

Seb <greeenify@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greeenify@gmail.com

--- Comment #1 from Seb <greeenify@gmail.com> ---
That's why people are using mir-cpuid these days :/

--
May 19, 2019
https://issues.dlang.org/show_bug.cgi?id=19861

Илья Ярошенко <ilyayaroshenko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ilyayaroshenko@gmail.com

--- Comment #2 from Илья Ярошенко <ilyayaroshenko@gmail.com> ---
You can try `dub --single report.d`
from the mir-cpuid project [1]

Does it work for your CPU?

[1] https://github.com/libmir/mir-cpuid

--
May 25, 2019
https://issues.dlang.org/show_bug.cgi?id=19861

Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de

--- Comment #3 from Rainer Schuetze <r.sagitario@gmx.de> ---
I shortly tried it on an AMD Ryzen 8-core, and it failed, too (reported 16 cores, but 1 thread). Debugging it a bit showed that there is probably incomplete support for CPUID#8000_0008: https://www.amd.com/system/files/TechDocs/54945_PPR_Family_17h_Models_00h-0Fh.pdf or https://wiki.osdev.org/Detecting_CPU_Topology_(80x86)#AMD:_CPUID_eax.3D0x80000008

I didn't try mir-cpuid, but looking at the source code now, I don't see any use of that CPUID function, so it probably won't work, too.

--
May 27, 2019
https://issues.dlang.org/show_bug.cgi?id=19861

--- Comment #4 from Илья Ярошенко <ilyayaroshenko@gmail.com> ---
Rainer Schuetze, yes thanks. Will add AMD leaf 8 information. https://github.com/libmir/mir-cpuid/issues/40

--
May 27, 2019
https://issues.dlang.org/show_bug.cgi?id=19861

--- Comment #5 from Илья Ярошенко <ilyayaroshenko@gmail.com> ---
(In reply to Rainer Schuetze from comment #3)
> I shortly tried it on an AMD Ryzen 8-core, and it failed, too (reported 16 cores, but 1 thread). Debugging it a bit showed that there is probably incomplete support for CPUID#8000_0008: https://www.amd.com/system/files/TechDocs/54945_PPR_Family_17h_Models_00h- 0Fh.pdf or https://wiki.osdev.org/Detecting_CPU_Topology_(80x86)#AMD:_CPUID_eax. 3D0x80000008
> 
> I didn't try mir-cpuid, but looking at the source code now, I don't see any use of that CPUID function, so it probably won't work, too.

CPUID#8000_0008 has been added. https://github.com/libmir/mir-cpuid/pull/41

Rainer Schuetze, could you please check if it works now.

--
May 28, 2019
https://issues.dlang.org/show_bug.cgi?id=19861

--- Comment #6 from Rainer Schuetze <r.sagitario@gmx.de> ---
I tried the latest version of mir-cpuid from github, it reports 16 cores and 16 threads for the 8-core Ryzen. That's no change from earlier versions, but at least slightly better than what core.cpuid does.

--
May 28, 2019
https://issues.dlang.org/show_bug.cgi?id=19861

--- Comment #7 from Илья Ярошенко <ilyayaroshenko@gmail.com> ---
(In reply to Rainer Schuetze from comment #6)
> I tried the latest version of mir-cpuid from github, it reports 16 cores and 16 threads for the 8-core Ryzen. That's no change from earlier versions, but at least slightly better than what core.cpuid does.

Thank you.
I added another one fix that uses 1E extended leaf information to retrieve the
number of threads per core.

https://github.com/libmir/mir-cpuid/pull/42

Please check with recent the mir-cpuid master.

--
May 30, 2019
https://issues.dlang.org/show_bug.cgi?id=19861

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #8 from Dlang Bot <dlang-bot@dlang.rocks> ---
@rainers created dlang/druntime pull request #2620 "fix Issue 19861 - core.cpuid reports the wrong number of threads" fixing this issue:

- fix Issue 19861 - core.cpuid reports the wrong number of threads

  do not use i7 detection on AMD processors
  use cpuid 0x8000_001E to detect the number of threads per core

https://github.com/dlang/druntime/pull/2620

--
June 28, 2019
https://issues.dlang.org/show_bug.cgi?id=19861

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/druntime pull request #2620 "fix Issue 19861 - core.cpuid reports the wrong number of threads" was merged into stable:

- 0723a38a858aaaae83a9c5c0d43a0400571ef2a0 by Rainer Schuetze:
  fix Issue 19861 - core.cpuid reports the wrong number of threads

  do not use i7 detection on AMD processors
  use cpuid 0x8000_001E to detect the number of threads per core

https://github.com/dlang/druntime/pull/2620

--
May 17, 2020
https://issues.dlang.org/show_bug.cgi?id=19861

--- Comment #10 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/druntime pull request #3107 "[dmd-cxx] fix Issue 19861 - core.cpuid reports the wrong number of threads" was merged into dmd-cxx:

- d989df32ae1645203ceb24ccfa62ddfd46f078d4 by Rainer Schuetze:
  fix Issue 19861 - core.cpuid reports the wrong number of threads

  do not use i7 detection on AMD processors
  use cpuid 0x8000_001E to detect the number of threads per core

https://github.com/dlang/druntime/pull/3107

--