Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

CPU Feature Inspector

A collection of small C++17 command-line tools that query x86 processor capabilities directly through the CPUID instruction and demonstrate how a 128-bit integer SIMD register can be interpreted at different element widths.

What it inspects

Executable Source Purpose
cpu_identity cpu_identity.cpp Reads the processor brand string and CPUID frequency leaf when available.
cpu_topology cpu_topology.cpp Uses CPUID leaf 0x0B to report threads per core, logical threads, and derived physical-core count.
cache_hierarchy cache_hierarchy.cpp Enumerates deterministic cache parameters from leaf 0x04, including level, type, size, line size, ways, and sets.
simd_features simd_features.cpp Detects MMX, SSE generations, AES-NI, AVX, AVX2, and SHA feature bits.
simd_register_view simd_register_view.cpp Prints the same __m128i value as signed and unsigned 8-, 16-, 32-, and 64-bit lanes.

Implementation notes

The tools use GCC/Clang's <cpuid.h> helpers. Cache size is derived from CPUID's line-size, partition, associativity, and set fields. Feature detection reports hardware CPUID bits; it does not verify operating-system support for saving extended AVX state.

Build

Requirements:

  • an x86 or x86-64 processor;
  • GCC or Clang with <cpuid.h> and SIMD intrinsic headers;
  • CMake 3.16 or newer.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Each source is also standalone. For example:

g++ -std=c++17 -O2 src/cpu_identity.cpp -o cpu_identity
g++ -std=c++17 -O2 src/simd_register_view.cpp -o simd_register_view

Run the generated executables individually. Their output depends on the current processor and firmware configuration.

Limitations

  • CPUID leaves are not checked uniformly in every small tool; unsupported or differently structured leaves can produce incomplete results.
  • Topology leaf 0x0B is Intel-oriented and may not be the preferred topology interface on every x86 processor.
  • Frequency leaf 0x16 is optional and does not represent instantaneous clock speed.
  • The feature checker reports hardware flags only and should not be used alone to decide whether AVX instructions are safe to execute.
  • The original report is not included because its screenshots expose local paths, participant identifiers, and machine-specific details. The source code is self-contained.

About

Portable C++ utility for inspecting x86 CPU vendor, brand, and supported instruction-set features through CPUID.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages