Skip to content

feat(scripts): Add custom hybrid-architecture thermal-tune & fan control suite (P/E-cores)#196

Open
lavacano wants to merge 4 commits into
PXDiv:mainfrom
lavacano:feature/thermal-tune-addition
Open

feat(scripts): Add custom hybrid-architecture thermal-tune & fan control suite (P/E-cores)#196
lavacano wants to merge 4 commits into
PXDiv:mainfrom
lavacano:feature/thermal-tune-addition

Conversation

@lavacano
Copy link
Copy Markdown

@lavacano lavacano commented May 23, 2026

Overview

This pull request introduces a highly optimized, modular thermal tuning and fan control suite under the /scripts/thermal-tune/ directory.

Designed specifically for hybrid-architecture Intel systems (e.g., P-cores + E-cores on the i7-13700HX) and integrated alongside the DAMX daemon, this suite addresses the unique thermal-throttling and latency challenges of running modern gaming laptops on Linux.


Key Features Included:

1. Dual-Mode Fan Control Daemon (fan-curve-daemon.py)

Provides an advanced two-mode cooling mechanism for shared-heatpipe laptop architectures:

  • Independent Mode (Temps < 82°C): CPU and GPU fans track their respective component temperatures independently to minimize noise.
  • Coupled Mode (Temps ≥ 82°C): Fans lock together at the max(CPU_temp, GPU_temp) target to balance shared copper heatpipes and avoid one-sided heat saturation.
  • EMA Temperature Smoothing: Implements a continuous-time Exponential Moving Average filter ($\tau = 4.0\text{s}$) to smooth out rapid temperature spikes from transient PL2 turbo boosts, eliminating zero-RPM fan bounce.
  • Dynamic Polling & Sleep Rates: Scales the polling frequency dynamically based on thermals: 0.5s when hot ($\ge 80^\circ\text{C}$) to protect the silicon from hitting TjMax PROCHOT, and 2.0s under cooler states to save idle power.

2. Advanced Velocity-Form PI Power Governor

Rather than waiting for the CPU to hit hard thermal throttling (TJMax) under load, the governor monitors temperatures in real-time using a continuous-time feedback loop:

  • Velocity-Form PI Controller: Uses a Proportional-Integral feedback loop to continuously regulate CPU PL1 based on target convergence ($84^\circ\text{C}$).
  • Derivative Damping (Brake): Features a Proportional gain on error velocity ($3.5\text{W}$ per $^\circ\text{C}$ change) acting as an active "damping brake" to counter fast thermal climbs.
  • Slew-Rate Limiting: Restricts the maximum change in power limits per poll (e.g., 5W drop/sec, 2.5W recovery/sec) to ensure smooth, stable power transitions.

3. Dynamic EPP Scheduler Asymmetry

Maintains quiet, energy-efficient idle operation without sacrificing responsiveness:

  • Under active loads, all cores are set to performance.
  • During system idle (CPU < 12%, GPU < 12W for 15s), the daemon prioritizes E-cores by setting P-cores to power (aggressive low-latency sleep) and E-cores to balance_power. This naturally guides the Linux scheduler to run background OS tasks on E-cores first.

4. Hardware Interrupt Affinity Isolation

Freezes out interrupt-induced context switches on gaming threads. In combination with irqbalance, it guides users to ban P-cores (0-15) from interrupt handling, routing major hardware interrupts (GPU, Wi-Fi queues, USB controllers) strictly to E-cores (16-23).

5. Telemetry Web Dashboard (fan-dashboard.html)

A single-file, highly responsive web dashboard using Chart.js to visualize the /var/log/acer_fan_telemetry.csv logs. It highlights coupled zones, power-capped zones, fan speeds, active power limits, and temperature curves in real-time.

6. Hysteresis Auto-Tuner (hysteresis-analyzer.py)

A post-processing diagnostics utility that reads /var/log/acer_fan_telemetry.csv, calculates real-world cooling rates ($^\circ\text{C}/\text{s}$), idle fan bouncing events, and active fan oscillations per hour, and automatically recommends or hot-applies optimized floor/ceiling constraints, zero-RPM silent zone temperatures, and hysteresis parameters to the daemon.


Folder Structure Added:

scripts/thermal-tune/
├── fan-curve-daemon.py         # Thermal/fan governor daemon (EMA & Velocity PI)
├── hysteresis-analyzer.py      # Telemetry diagnostics & auto-tuner
├── acer-thermal-tune.sh        # RAPL boot script
├── acer-thermal-tune.service   # RAPL systemd unit
├── acer-fan-curve.service      # Daemon systemd unit
├── fan-dashboard.html          # Chart.js telemetry panel
├── 99-custom.rules             # Ananicy rules for P/E-core mapping
├── gaming-thermal.conf         # Vulkan/DXVK performance variables
└── README.md                   # Installation & setup guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant