Cpuid C++-APIs - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English
X86Cpu(CpuidUtils *cUtils, CpuNumT num)#

Constructor from CpuidUtils object.

Warning

This API is used only for testing, does not serve any other purpose.

Parameters:
  • cUtils[in] CpuidUtils object to use for fetching CPUID info.

  • num[in] CPU number to fetch info from.

X86Cpu(CpuNumT num = UINT32_MAX)#

Default constructor.

This constructor sets the CPU number to info from.

Note

Default behaviour is invoked by passing AU_CURRENT_CPU_NUM, In default behaviour the thread is not pinned to any core, cpuid fetches the current CPU thread on which the code is running.

Warning

If num is not “AU_CURRENT_CPU_NUM”, then calling this constructor will result in thread migration to the selected core.

Parameters:

num[in] Any valid core number starting from 0.

~X86Cpu()#

Destructor.

bool isAMD() const#

Check if vendor is AMD.

This function will work on all AMD processors.

AOCL 5.2

isAMD()

Skylake

False

Bulldozer

True

Zen1/1+

True

Zen2

True

Zen3

True

Zen4

True

Zen[X>4]

True

Returns:

true if ‘num’ was an AMD x86-64, false otherwise

bool isX86_64v2() const#

Checks if processor is x86_64-v2 compliant.

Based on GCC following flags account for x86_64-v2 (in addition to x86_64 [sse, sse2])

cx16 lahf_lm popcnt sse4_1 sse4_2 ssse3

Output of this API will be same as hasFlag(ECpuidFlag::sse) && hasFlag(ECpuidFlag::sse2) && hasFlag(ECpuidFlag::cx16) && hasFlag(ECpuidFlag::lahf_lm)&& hasFlag(ECpuidFlag::popcnt)&& hasFlag(ECpuidFlag::sse4_1) && hasFlag(ECpuidFlag::sse4_2)&& hasFlag(ECpuidFlag::ssse3)

AOCL 5.2

isX86_64v2()

Sandybridge

True

Broadwell

True

Skylake

True

Bulldozer

True

Zen1/1+

True

Zen2

True

Zen3

True

Zen4

True

Zen5

True

Zen[X>5]

True

Parameters:

none

Returns:

true if cpu supports all features above, false otherwise

bool isX86_64v3() const#

Checks if processor is x86_64-v3 compliant.

Based on GCC following flags account for x86_64-v3 (in addition to x86_64-v2)

avx avx2 bmi1 bmi2 f16c fma abm movbe xsave

Output of this API will be same as isX86_64v2() && hasFlag(ECpuidFlag::avx) && hasFlag(ECpuidFlag::avx2) && hasFlag(ECpuidFlag::bmi1) && hasFlag(ECpuidFlag::bmi2) && hasFlag(ECpuidFlag::f16c) && hasFlag(ECpuidFlag::fma) && hasFlag(ECpuidFlag::abm) && hasFlag(ECpuidFlag::movbe)&& hasFlag(ECpuidFlag::xsave)

AOCL 5.2

isX86_64v3()

Sandybridge

False

Broadwell

True

Skylake

True

Bulldozer

True

Zen1/1+

True

Zen2

True

Zen3

True

Zen4

True

Zen5

True

Zen[X>5]

True

Parameters:

none

Returns:

true if cpu supports all features above, false otherwise

bool isX86_64v4() const#

Checks if processor is x86_64-v4 compliant.

Based on GCC following flags account for x86_64-v4 (in addition to x86_64-v2 + x86_64-v3)

avx512f avx512bw avx512cd avx512dq avx512vl

Output of this API will be same as isX86_64v3() && hasFlag(ECpuidFlag::avx512f) && hasFlag(ECpuidFlag::avx512bw) && hasFlag(ECpuidFlag::avx512cd) && hasFlag(ECpuidFlag::avx512dq) && hasFlag(ECpuidFlag::avx512vl)

AOCL 5.2

isX86_64v4()

Sandybridge

False

Broadwell

False

Skylake

True

Bulldozer

True

Zen1/1+

True

Zen2

True

Zen3

True

Zen4

True

Zen5

True

Zen[X>5]

True

Parameters:

none

Returns:

true if cpu supports all features above, false otherwise

bool isIntel() const#

Check if vendor is Intel.

This function will work on all Intel processors.

AOCL 5.2

isIntel()

Skylake

True

Bulldozer

False

Zen1/1+

False

Zen2

False

Zen3

False

Zen4

False

Zen[X>4]

False

Parameters:

none

Returns:

true if ‘num’ was an Intel x86-64, false otherwise

bool hasFlag(ECpuidFlag const &eflag) const#

Check if the flag is suppored by the CPU ideintified by num.

List of supported flags: sse3, pclmulqdq, dtes64, monitor, dscpl, vmx, smx, est, tm2, ssse3, cid, fma, cx16, xtpr, pdcm, pcid, dca, sse4_1, sse4_2, x2apic, movbe, popcnt, tsc_deadline, aes, xsave, osxsave, avx, f16c, rdrand, hypervisor, fpu, vme, de, pse, tsc, msr, pae, mce, cx8, apic, sep, mtrr, pge, mca, cmov, pat, pse36, pn, clflush, ds, acpi, mmx, fxsr, sse, sse2, ss, ht, tm, ia64, pbe, arat, fsgsbase, tsc_adjust, bmi1, hle, avx2, smep, bmi2, erms, invpcid, rtm, mpx, avx512f, avx512dq, rdseed, adx, smap, avx512ifma, pcommit, clflushopt, clwb, avx512pf, avx512er, avx512cd, sha_ni, avx512bw, avx512vl, avx512vbmi, umip, pku, ospke, avx512_vpopcntdq, la57, rdpid, avx512_4vnniw, avx512_4fmaps, avx512_bf16, avxvnni, xsaveopt, xsavec, xgetbv1, xsaves, lahf_lm, cmp_legacy, svm, extapic, cr8legacy, abm, sse4a, misalignsse, _3dnowprefetch, osvw, ibs, xop, skinit, wdt, lwp, fma4, tce, nodeid_msr, tbm, topoext, perfctr_core, perfctr_nb, syscall, nxxd, mmxext, fxsr_opt, pdpe1gb, rdtscp, lmi64, _3dnowext, _3dnow, invtsc, npt, lbrv, svm_lock, nrip_save, tsc_scale, vmcb_clean, flushbyasid, decodeassists, pause_filter, pfthreshold, xstore, xstore_en, xcrypt, xcrypt_en, ace2, ace2_en, phe, phe_en, pmm, pmm_en, vaes, vpclmulqdq, avx512_vnni, avx512_bitalg, avx512vbmi2, movdiri, movdir64b, avx512_vpintersect, x2avic

Parameters:

eflag[in] ECpuidFlag that needs to be checked

Returns:

true if eflag is present in the availableflags and usable flags, false otherwise

bool hasFlags(Au::Memory::BufferView<ECpuidFlag> const &eflags, HasFlagsMode const &mode = HasFlagsMode::Any) const#

Check if the flag is suppored by the CPU ideintified by num. This function is used to check any of the flags are available.

List of supported flags: sse3, pclmulqdq, dtes64, monitor, dscpl, vmx, smx, est, tm2, ssse3, cid, fma, cx16, xtpr, pdcm, pcid, dca, sse4_1, sse4_2, x2apic, movbe, popcnt, tsc_deadline, aes, xsave, osxsave, avx, f16c, rdrand, hypervisor, fpu, vme, de, pse, tsc, msr, pae, mce, cx8, apic, sep, mtrr, pge, mca, cmov, pat, pse36, pn, clflush, ds, acpi, mmx, fxsr, sse, sse2, ss, ht, tm, ia64, pbe, arat, fsgsbase, tsc_adjust, bmi1, hle, avx2, smep, bmi2, erms, invpcid, rtm, mpx, avx512f, avx512dq, rdseed, adx, smap, avx512ifma, pcommit, clflushopt, clwb, avx512pf, avx512er, avx512cd, sha_ni, avx512bw, avx512vl, avx512vbmi, umip, pku, ospke, avx512_vpopcntdq, la57, rdpid, avx512_4vnniw, avx512_4fmaps, avx512_bf16, avxvnni, xsaveopt, xsavec, xgetbv1, xsaves, lahf_lm, cmp_legacy, svm, extapic, cr8legacy, abm, sse4a, misalignsse, _3dnowprefetch, osvw, ibs, xop, skinit, wdt, lwp, fma4, tce, nodeid_msr, tbm, topoext, perfctr_core, perfctr_nb, syscall, nxxd, mmxext, fxsr_opt, pdpe1gb, rdtscp, lmi64, _3dnowext, _3dnow, invtsc, npt, lbrv, svm_lock, nrip_save, tsc_scale, vmcb_clean, flushbyasid, decodeassists, pause_filter, pfthreshold, xstore, xstore_en, xcrypt, xcrypt_en, ace2, ace2_en, phe, phe_en, pmm, pmm_en, vaes, vpclmulqdq, avx512_vnni, avx512_bitalg, avx512vbmi2, movdiri, movdir64b, avx512_vpintersect, x2avic

Parameters:

eflags[in] List of ECpuidFlag that needs to be checked

Returns:

true if any eflags are present in the availableflags and usable

bool hasAllFlags(Au::Memory::BufferView<ECpuidFlag> const &eflags) const#

Check if the flag is suppored by the CPU ideintified by num. This function is used to check all of the flags are available.

List of supported flags: sse3, pclmulqdq, dtes64, monitor, dscpl, vmx, smx, est, tm2, ssse3, cid, fma, cx16, xtpr, pdcm, pcid, dca, sse4_1, sse4_2, x2apic, movbe, popcnt, tsc_deadline, aes, xsave, osxsave, avx, f16c, rdrand, hypervisor, fpu, vme, de, pse, tsc, msr, pae, mce, cx8, apic, sep, mtrr, pge, mca, cmov, pat, pse36, pn, clflush, ds, acpi, mmx, fxsr, sse, sse2, ss, ht, tm, ia64, pbe, arat, fsgsbase, tsc_adjust, bmi1, hle, avx2, smep, bmi2, erms, invpcid, rtm, mpx, avx512f, avx512dq, rdseed, adx, smap, avx512ifma, pcommit, clflushopt, clwb, avx512pf, avx512er, avx512cd, sha_ni, avx512bw, avx512vl, avx512vbmi, umip, pku, ospke, avx512_vpopcntdq, la57, rdpid, avx512_4vnniw, avx512_4fmaps, avx512_bf16, avxvnni, xsaveopt, xsavec, xgetbv1, xsaves, lahf_lm, cmp_legacy, svm, extapic, cr8legacy, abm, sse4a, misalignsse, _3dnowprefetch, osvw, ibs, xop, skinit, wdt, lwp, fma4, tce, nodeid_msr, tbm, topoext, perfctr_core, perfctr_nb, syscall, nxxd, mmxext, fxsr_opt, pdpe1gb, rdtscp, lmi64, _3dnowext, _3dnow, invtsc, npt, lbrv, svm_lock, nrip_save, tsc_scale, vmcb_clean, flushbyasid, decodeassists, pause_filter, pfthreshold, xstore, xstore_en, xcrypt, xcrypt_en, ace2, ace2_en, phe, phe_en, pmm, pmm_en, vaes, vpclmulqdq, avx512_vnni, avx512_bitalg, avx512vbmi2, movdiri, movdir64b, avx512_vpintersect, x2avic

Parameters:

eflags[in] List of ECpuidFlag that needs to be checked

Returns:

true if all eflags are present in the availableflags and usable

bool isAvailable(ECpuidFlag const &eflag) const#

Check if the flag is suppored by the CPU ideintified by num.

List of supported flags: sse3, pclmulqdq, dtes64, monitor, dscpl, vmx, smx, est, tm2, ssse3, cid, fma, cx16, xtpr, pdcm, pcid, dca, sse4_1, sse4_2, x2apic, movbe, popcnt, tsc_deadline, aes, xsave, osxsave, avx, f16c, rdrand, hypervisor, fpu, vme, de, pse, tsc, msr, pae, mce, cx8, apic, sep, mtrr, pge, mca, cmov, pat, pse36, pn, clflush, ds, acpi, mmx, fxsr, sse, sse2, ss, ht, tm, ia64, pbe, arat, fsgsbase, tsc_adjust, bmi1, hle, avx2, smep, bmi2, erms, invpcid, rtm, mpx, avx512f, avx512dq, rdseed, adx, smap, avx512ifma, pcommit, clflushopt, clwb, avx512pf, avx512er, avx512cd, sha_ni, avx512bw, avx512vl, avx512vbmi, umip, pku, ospke, avx512_vpopcntdq, la57, rdpid, avx512_4vnniw, avx512_4fmaps, avx512_bf16, avxvnni, xsaveopt, xsavec, xgetbv1, xsaves, lahf_lm, cmp_legacy, svm, extapic, cr8legacy, abm, sse4a, misalignsse, _3dnowprefetch, osvw, ibs, xop, skinit, wdt, lwp, fma4, tce, nodeid_msr, tbm, topoext, perfctr_core, perfctr_nb, syscall, nxxd, mmxext, fxsr_opt, pdpe1gb, rdtscp, lmi64, _3dnowext, _3dnow, invtsc, npt, lbrv, svm_lock, nrip_save, tsc_scale, vmcb_clean, flushbyasid, decodeassists, pause_filter, pfthreshold, xstore, xstore_en, xcrypt, xcrypt_en, ace2, ace2_en, phe, phe_en, pmm, pmm_en, vaes, vpclmulqdq, avx512_vnni, avx512_bitalg, avx512vbmi2, movdiri, movdir64b, avx512_vpintersect, x2avic

       Note: The api is deprecated. Use hasFlag instead.
Parameters:

eflag[in] ECpuidFlag that needs to be checked

Returns:

true if eflag is present in the availableflags and usable flags, false otherwise

EUarch getUarch() const#

Get microarchitecture of CPU from CPUID instruction.

The microarchitecture of the CPU can be Zen, Zen2, Zen3, Zen4, Zen5

Will return Unknown if the microarchitecture is not supported (non-AMD CPUs)

AOCL 5.2

getUarch()

Skylake

Unknown

Bulldozer

Unknown

Zen1/1+

Zen

Zen2

Zen2

Zen3

Zen3

Zen4

Zen4

Zen5

Zen5

Zen[X>5]

Zen5

Parameters:

none

Returns:

Returns microarchitecture of CPU.

bool isUarch(EUarch uarch, bool strict = false) const#

Checks microarchitecture from CPUID instruction and compare with input Like Zen, Zen2, Zen3 etc.

Given a microarchitecture, this function will check if the CPU microarchitecture is matched with input.

AOCL 5.2

isUarch(Zen)

isUarch(Zen2)

isUarch(Zen3)

isUarch(Zen4)

isUarch(Zen5)

Skylake

False

False

False

False

False

Bulldozer

False

False

False

False

False

Zen1/1+

True

False

False

False

False

Zen2

True

True

False

False

False

Zen3

True

True

True

False

False

Zen4

True

True

True

True

False

Zen5

True

True

True

True

True

Zen[X>5]

True

True

True

True

True

When given strict as true, it will check for exact match.

AOCL 5.2

isUarch(Zen,1)

isUarch(Zen2,1)

isUarch(Zen3,1)

isUarch(Zen4,1)

isUarch(Zen5,1)

Skylake

False

False

False

False

False

Bulldozer

False

False

False

False

False

Zen1/1+

True

False

False

False

False

Zen2

False

True

False

False

False

Zen3

False

False

True

False

False

Zen4

False

False

False

True

False

Zen5

False

False

False

False

True

Zen[X>5]

False

False

False

False

True

C++-API Behaviour Summary

Parameters:
  • arch[in] Microarchitecture input to check for.

  • strict[in] If true, then exact match is checked.

Returns:

Returns true if CPU microarchitecture is matched with input.

bool isZenFamily() const#

Check if the CPU is Zen family.

This function will check if the CPU is Zen family. Zen family includes Zen, Zen2, Zen3, Zen4, Zen5 microarchitectures.

AOCL 5.2

isZenFamily()

Skylake

False

Bulldozer

False

Zen1/1+

True

Zen2

True

Zen3

True

Zen4

True

Zen5

True

Zen[X>5]

True

Note

This function will return true for Zen family processors only.

Returns:

true if CPU is Zen family, false otherwise

VendorInfo getVendorInfo() const#

Get the VendorInfo object.

This function will return the VendorInfo object which contains the vendor, family, model, stepping and microarchitecture of the CPU.

VendorInfo object contains the following fields:

  1. EVendor m_mfg; // CPU manufacturing vendor.

  2. EFamily m_family; // CPU family ID.

  3. Uint16 m_model; // CPU model number.

  4. Uint16 m_stepping; // CPU stepping.

  5. EUarch m_uarch; // CPU microarchitecture.

Parameters:

none

Returns:

VendorInfo

void update()#

Execute CPUID instruction and update the internal data.

Parameters:

none

Returns:

none

inline virtual EGoverner getGoverner() const override#

Interface to get Freqency scaling governer.

Returns:

EGoverner type

CacheView getCacheView() const#
enum class Au::ECpuidFlag : Uint64#

Flags supported by CPU as features.

Values:

enumerator Min#
enumerator sse3#
enumerator pclmulqdq#
enumerator dtes64#
enumerator monitor#
enumerator dscpl#
enumerator vmx#
enumerator smx#
enumerator est#
enumerator tm2#
enumerator ssse3#
enumerator cid#
enumerator fma#
enumerator cx16#
enumerator xtpr#
enumerator pdcm#
enumerator pcid#
enumerator dca#
enumerator sse4_1#
enumerator sse4_2#
enumerator x2apic#
enumerator movbe#
enumerator popcnt#
enumerator tsc_deadline#
enumerator aes#
enumerator xsave#
enumerator osxsave#
enumerator avx#
enumerator f16c#
enumerator rdrand#
enumerator hypervisor#
enumerator fpu#
enumerator vme#
enumerator de#
enumerator pse#
enumerator tsc#
enumerator msr#
enumerator pae#
enumerator mce#
enumerator cx8#
enumerator apic#
enumerator sep#
enumerator mtrr#
enumerator pge#
enumerator mca#
enumerator cmov#
enumerator pat#
enumerator pse36#
enumerator pn#
enumerator clflush#
enumerator ds#
enumerator acpi#
enumerator mmx#
enumerator fxsr#
enumerator sse#
enumerator sse2#
enumerator ss#
enumerator ht#
enumerator tm#
enumerator ia64#
enumerator pbe#
enumerator arat#
enumerator fsgsbase#
enumerator tsc_adjust#
enumerator bmi1#
enumerator hle#
enumerator avx2#
enumerator smep#
enumerator bmi2#
enumerator erms#
enumerator invpcid#
enumerator rtm#
enumerator mpx#
enumerator avx512f#
enumerator avx512dq#
enumerator rdseed#
enumerator adx#
enumerator smap#
enumerator avx512ifma#
enumerator pcommit#
enumerator clflushopt#
enumerator clwb#
enumerator avx512pf#
enumerator avx512er#
enumerator avx512cd#
enumerator sha_ni#
enumerator avx512bw#
enumerator avx512vl#
enumerator avx512vbmi#
enumerator umip#
enumerator pku#
enumerator ospke#
enumerator avx512_vpopcntdq#
enumerator la57#
enumerator rdpid#
enumerator avx512_4vnniw#
enumerator avx512_4fmaps#
enumerator avx512_bf16#
enumerator avxvnni#
enumerator xsaveopt#
enumerator xsavec#
enumerator xgetbv1#
enumerator xsaves#
enumerator lahf_lm#
enumerator cmp_legacy#
enumerator svm#
enumerator extapic#
enumerator cr8legacy#
enumerator abm#
enumerator sse4a#
enumerator misalignsse#
enumerator _3dnowprefetch#
enumerator osvw#
enumerator ibs#
enumerator xop#
enumerator skinit#
enumerator wdt#
enumerator lwp#
enumerator fma4#
enumerator tce#
enumerator nodeid_msr#
enumerator tbm#
enumerator topoext#
enumerator perfctr_core#
enumerator perfctr_nb#
enumerator syscall#
enumerator nxxd#
enumerator mmxext#
enumerator fxsr_opt#
enumerator pdpe1gb#
enumerator rdtscp#
enumerator lmi64#
enumerator _3dnowext#
enumerator _3dnow#
enumerator invtsc#
enumerator npt#
enumerator lbrv#
enumerator svm_lock#
enumerator nrip_save#
enumerator tsc_scale#
enumerator vmcb_clean#
enumerator flushbyasid#
enumerator decodeassists#
enumerator pause_filter#
enumerator pfthreshold#
enumerator xstore#
enumerator xstore_en#
enumerator xcrypt#
enumerator xcrypt_en#
enumerator ace2#
enumerator ace2_en#
enumerator phe#
enumerator phe_en#
enumerator pmm#
enumerator pmm_en#
enumerator vaes#
enumerator vpclmulqdq#
enumerator avx512_vnni#
enumerator avx512_bitalg#
enumerator avx512vbmi2#
enumerator movdiri#
enumerator movdir64b#
enumerator avx512_vpintersect#
enumerator x2avic#
enumerator clzero#
enumerator Max#