Skip to content

Missing explicit LZCNT support via ABM? #253

Closed

Description

@mqudsi

Intel and AMD advertise the presence of LZCNT via (the reuse of?) AMD's old ABM flag and not via BMI1/BMI2.

I think it's safe with a worst case scenario of testing for LZCNT via BMI1 giving you a false negative because I don't think any cpu advertising BMI1 or BMI2 doesn't implement LZCNT. You'll miss older (pre-Excavator, I think) AMD CPUs with ABM but no BMI1/BMI2, but I'm presuming that's fine.

Sorry if this is intentional to avoid any issues with the reuse of ABM - I couldn't find anything in the docs or the code.

Activity

  1. toor1245 commented on Jul 20, 2022

    @toor1245
    Contributor

    Hi @mqudsi, thanks for the issue. As I understand correctly, you are concerned that we don't have the support of LZCNT explicitly and developers should check LZCNT via BMI1/BMI2. I found old processors that don't support BMI1. since leaf 0x07 is empty AuthenticAMD0600F12_K15_Zambezi8C_CPUID and there is the support of ABM. I think it is a good point and we should handle this case. Hence, according to Intel architecture-instruction-set-extensions-programming-reference.pdf P-40, we can get this info via CPUID Fn8000_0001_ECX[5](LZCNT), and according for AMD AMD Cpuid Specification P-20 CPUID Fn8000_0001_ECX[5](ABM) as well.

  2. mqudsi commented on Jul 21, 2022

    @mqudsi
    Author

    Yup. Thanks for the fast response and the primary sources.

    The first link you shared seems to be broken, though?

  3. toor1245 commented on Jul 21, 2022

    @toor1245
    Contributor

    Nope, it works, probably because this link is not safe
    I'll send cpuid dump here:

    ------[ CPU Info ]------
    
    CPU Type          : OctalCore AMD FX-8150, 4200 MHz (21 x 200)
    CPU Alias         : Zambezi
    CPU Platform      : Socket AM3+
    CPU Stepping      : OR-B2
    Instruction Set   : x86, x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, XOP, AVX, FMA4, AES
    CPUID Manufacturer: AuthenticAMD
    CPUID CPU Name    : AMD FX(tm)-8150 Eight-Core Processor
    CPUID Revision    : 00600F12h
    Platform ID       : C6h  (Socket AM3+)
    HTT / CMP Units   : 0 / 8
    Max. NUMA Node    : 0
    
    Tjmax Temperature    : 0 Celsius
    HTC Temperature Limit: 90 Celsius
    CPU TDP              : 124.8 W
    
    ------[ Motherboard Info ]------
    
    Motherboard ID      : 63-0100-000001-00101111-102010-Chipset$0AAAA000_BIOS DATE: 10/20/10 09:47:36 VER: 08.00.10
    Motherboard Model   : Asus M5A97
    Motherboard Chipset : AMD 970, AMD K15
    
    DMI MB Manufacturer : ASUSTeK COMPUTER INC.
    DMI MB Product      : M5A97
    DMI MB Version      : Rev 1.xx
    DMI MB Serial       : 110680510000263
    DMI SYS Manufacturer: To be filled by O.E.M.
    DMI SYS Product     : To be filled by O.E.M.
    DMI SYS Version     : To be filled by O.E.M.
    DMI SYS Serial      : To be filled by O.E.M.
    DMI BIOS Version    : 1605
    
    
    ------[ Logical CPU #0 ]------
    
    allcpu: Package 0 / Core 0 / Thread 0: Valid
    
    CPUID 00000000: 0000000D-68747541-444D4163-69746E65 [AuthenticAMD]
    CPUID 00000001: 00600F12-00080800-1E98220B-178BFBFF
    CPUID 00000002: 00000000-00000000-00000000-00000000
    CPUID 00000003: 00000000-00000000-00000000-00000000
    CPUID 00000005: 00000040-00000040-00000003-00000000
    CPUID 00000006: 00000000-00000000-00000001-00000000
    CPUID 00000007: 00000000-00000000-00000000-00000000
    CPUID 00000008: 00000000-00000000-00000000-00000000
    CPUID 00000009: 00000000-00000000-00000000-00000000
    CPUID 0000000A: 00000000-00000000-00000000-00000000
    CPUID 0000000C: 00000000-00000000-00000000-00000000
    CPUID 0000000D: 00000007-00000340-000003C0-40000000 [SL 00] [x87]
    CPUID 0000000D: 00000000-00000000-00000000-00000000 [SL 01] [SSE]
    CPUID 0000000D: 00000100-00000240-00000000-00000000 [SL 02] [AVX]
    CPUID 0000000D: 00000080-00000340-00000000-00000000 [SL 3E]
    CPUID 80000000: 8000001E-68747541-444D4163-69746E65 [AuthenticAMD]
    CPUID 80000001: 00600F12-10000000-01C9BFFF-2FD3FBFF
    CPUID 80000002: 20444D41-74285846-382D296D-20303531 [AMD FX(tm)-8150 ]
    CPUID 80000003: 68676945-6F432D74-50206572-65636F72 [Eight-Core Proce]
    CPUID 80000004: 726F7373-20202020-20202020-00202020 [ssor           ]
    CPUID 80000005: FF20FF18-FF20FF30-10040140-40020140
    CPUID 80000006: 64000000-64004200-08008140-0040C140
    CPUID 80000007: 00000000-00000000-00000000-000003D9
    CPUID 80000008: 00003030-00000000-00004007-00000000
    CPUID 80000009: 00000000-00000000-00000000-00000000
    CPUID 8000000A: 00000001-00010000-00000000-000014FF
    CPUID 8000000B: 00000000-00000000-00000000-00000000
    CPUID 8000000C: 00000000-00000000-00000000-00000000
    CPUID 8000000D: 00000000-00000000-00000000-00000000
    CPUID 8000000E: 00000000-00000000-00000000-00000000
    CPUID 8000000F: 00000000-00000000-00000000-00000000
    CPUID 80000010: 00000000-00000000-00000000-00000000
    CPUID 80000011: 00000000-00000000-00000000-00000000
    CPUID 80000012: 00000000-00000000-00000000-00000000
    CPUID 80000013: 00000000-00000000-00000000-00000000
    CPUID 80000014: 00000000-00000000-00000000-00000000
    CPUID 80000015: 00000000-00000000-00000000-00000000
    CPUID 80000016: 00000000-00000000-00000000-00000000
    CPUID 80000017: 00000000-00000000-00000000-00000000
    CPUID 80000018: 00000000-00000000-00000000-00000000
    CPUID 80000019: F020F018-64000000-00000000-00000000
    CPUID 8000001A: 00000003-00000000-00000000-00000000
    CPUID 8000001B: 000000FF-00000000-00000000-00000000
    CPUID 8000001C: 00000000-80032013-00010200-8000000F
    CPUID 8000001D: 00000121-00C0003F-0000003F-00000000 [SL 00]
    CPUID 8000001D: 00004122-0040003F-000001FF-00000000 [SL 01]
    CPUID 8000001D: 00004143-03C0003F-000007FF-00000001 [SL 02]
    CPUID 8000001D: 0001C163-0FC0003F-000007FF-00000001 [SL 03]
    CPUID 8000001E: 00000010-00000100-00000000-00000000
    CPUID 8FFFFFFF: 00000000-00000000-00000000-00000000
    
  4. mqudsi commented on Jul 21, 2022

    @mqudsi
    Author

    Thanks. It is indeed a proxy/firewall issue.

  5. mqudsi commented on Jul 28, 2022

    @mqudsi
    Author

    Thanks, @gchatelet. I'm glad you named it LZCNT and not ABM, as ABM can be confusing!

  6. added
    enhancement
    on Apr 27, 2023
  7. added this to the v0.8.0 milestone on Apr 27, 2023
  8. added a commit that references this issue on Feb 18, 2024
    601471d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions