News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

My version of a CPU identification utility

Started by Mark44, February 22, 2014, 04:08:06 AM

Previous topic - Next topic

TWell

Processor name: AMD Athlon(tm) II X2 220 Processor
Extended + family ID: 1f
Extended + model ID: 06
Stepping: 3
Microarchitecture: Unknown
CPU has FP unit.
CPU supports MMX.
CPU supports SSE.
CPU supports SSE2.
CPU supports SSE3.
CPU does not support SSE 4.1.
CPU does not support SSE 4.2.
CPU does not support AVX.
CPU and OS do not support AVX2.

MichaelW

Dave,

Have you tried executing any SSE3 instructions?
Well Microsoft, here's another nice mess you've gotten us into.

dedndave

SSE3, yes
SSSE3, no - not supported on my processor

fearless

Any way to get the correct amount of physical cores?

I had tried using the following code, but for my i5 3570K it returns too many for logical cores 16 and physical cores 8. Im not sure if this is some issue with hyperthreading or some other issue i havent identified. Im assuming if it is hyperthreading, then logical should be 8 and physical should be 4.

        mov eax, 1
        xor ebx, ebx
        xor ecx, ecx
        xor edx, edx
        cpuid
        and ebx, 000FF0000h
        shr ebx, 16
        mov LogicalCores, ebx


         mov eax, 4
        xor ebx, ebx
        xor ecx, ecx
        xor edx, edx
        cpuid
        and eax, 0FC000000h; 11111100000000000000000000000000b  ; bits 26-31
        shr eax, 26
        inc eax
        mov PhysicalCores, eax

dedndave

easiest way.....

use GetProcessAffinityMask and count bits
it's only fully valid for machines with 32 cores or less   ::)
as far as i know - the most made so far is 24 cores

    INVOKE  GetModuleHandle,NULL
    push    eax
    mov     ecx,esp
    push    eax
    mov     edx,esp
    INVOKE  GetProcessAffinityMask,eax,edx,ecx
    pop     ecx
    pop     edx
    bsr     eax,edx
    inc     eax


dedndave

oh - that returns the number of logical cores
to get the number of physical cores....
for AMD processors, physical count = logical count
for Intel processors, divide by 2 if HTT bit is set

Mark44

timppa,
Try this version on your AMD Athlon machine... I added a small amount of code to test for SSSE3.

Dave,
That bsr in your code threw me for a minute. I thought it was Branch to Subroutine, which if memory serves, is a Motorola 68x00 instruction. I had to look it up to find out that it's bit scan reverse.

Mark

dedndave


TWell

Quote from: Mark44 on February 26, 2014, 12:49:07 PM
timppa,
Try this version on your AMD Athlon machine... I added a small amount of code to test for
Processor name: AMD Athlon(tm) II X2 220 Processor
Extended + family ID: 1f
Extended + model ID: 06
Stepping: 3
Microarchitecture: Unknown
CPU has FP unit.
CPU supports MMX.
CPU supports SSE.
CPU supports SSE2.
CPU supports SSE3.
CPU does not support SSSE3.
CPU does not support SSE 4.1.
CPU does not support SSE 4.2.
CPU does not support AVX.
CPU and OS do not support AVX2.

jj2007

Processor name: AMD Athlon(tm) Dual Core Processor 4450B
Extended + family ID: 0f
Extended + model ID: 6b
Stepping: 2
Microarchitecture: Unknown
CPU has FP unit.
CPU supports MMX.
CPU supports SSE.
CPU supports SSE2.
CPU supports SSE3.
CPU does not support SSSE3.
CPU does not support SSE 4.1.
CPU does not support SSE 4.2.
CPU does not support AVX.
CPU and OS do not support AVX2.