Skip to content

Repository files navigation

Intel Core Ultra 5 125H Hardware Optimization Suite

This project is a low-level, system-tuning suite designed to bridge the gap between a generic Linux/Windows laptop and a tightly integrated, Unix-based Apple Silicon system (like the M2 or M3). By actively tuning the kernel, scheduler, and compiler, this suite treats the Intel Core Ultra 5 125H (Meteor Lake) like a first-class compute engine.

🚀 The 4 Layers of Optimization

1. Core Scheduling (Thread Pinning)

  • The Problem: The default Linux scheduler blindly bounces threads between P-Cores and E-Cores to save power, resulting in latency spikes and micro-stutters.
  • The Solution: We dynamically map the /sys/devices/system/cpu/ topology and build isolated Rayon thread pools exclusively for the 4 P-Cores (8 threads).
  • Benchmark: 1.5x Speedup on heavy workloads by bypassing the E-Core penalty and guaranteeing 4.5 GHz execution.

2. Compiler Tuning & SIMD Vectorization

  • The Problem: Rust compiles for generic x86 CPUs by default (processing 1 float per instruction).
  • The Solution: Compiled with target-cpu=native, unleashing AVX2 and FMA (Fused Multiply-Add).
  • Benchmark: AVX2 utilizes 256-bit registers (processing 8 floats per clock cycle), resulting in a 2.65x Speedup in our 10-million element dot-product benchmark compared to scalar math.

3. Memory Architecture

  • The Problem: Linux defaults to high swappiness (60), kicking idle memory to disk and causing jitter.
  • The Solution: Reduced swappiness to 10. Implemented PinnedBuffer (using mlock to pin compute arrays to physical RAM) and HugePageBuffer (using MADV_HUGEPAGE for 2MB pages to slash TLB misses).
  • Benchmark: Zero swap latency and highly predictable read/write speeds for large matrices.

4. AI & Compute Offloading

  • The Problem: AI models run on the CPU, causing high thermal load and lower throughput.
  • The Solution: Integrated Intel OpenVINO to dynamically route inference to the Arc Graphics (Xe-Cores) and AI Boost (NPU). This mimics the Apple Neural Engine (ANE) for battery-efficient AI processing.

📊 Tuned Intel vs. Apple Silicon (M-Series) Parity

By implementing this suite, we've matched Apple's architectural advantages on Intel hardware:

Feature Apple Silicon (M2/M3) Intel Core Ultra 5 125H (Tuned)
Hybrid Routing macOS Grand Central Dispatch Rayon pools + explicit core_affinity
Unified Memory (UMA) Native hardware UMA wgpu MAPPABLE_PRIMARY_BUFFERS + mlock
Vector Math (SIMD) 128-bit ARM NEON (4 floats) 256-bit AVX2 (8 floats per cycle)
AI Inference Apple Neural Engine (ANE) OpenVINO -> Arc GPU & AI Boost NPU

🛠 Installation & Usage

1. Build and Run the Benchmarks

To see the hardware detection and benchmarks in action:

cargo build --release
./target/release/intel-mac-parity

2. Auto-Run Optimizations on Startup

Because Linux resets kernel parameters on reboot (like CPU governor, swappiness, and P-State limits), we've included a script to lock your system into "Performance Mode" automatically on boot.

Run the installation script to create the systemd service:

sudo bash install_startup.sh

What the service does:

  1. Sets all CPU governors to performance.
  2. Locks Intel P-State minimum performance to 100% (eliminates frequency ramp-up latency).
  3. Reduces vm.swappiness to 10.
  4. Enables transparent hugepages (always).
  5. Disables sched_energy_aware to prevent the kernel from overriding our P-Core pinning.
  6. (Level 2) Automatically overrides the hardware PL1 limits to 45W for sustained performance.

🏆 Final Results

For a deep dive into exactly how much performance we unlocked, read the Final Benchmark Comparison Report. It details the precise latency, thread jitter, and sustained thermal parity achieved against an Apple M2/M3 target.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages