Skip to content

WorkstationsLatency and performancereference

GPU voltage-frequency curve control without Afterburner

vfctl is a Go CLI that reads and writes NVIDIA GPU voltage-frequency curves directly via NVAPI, replacing MSI Afterburner’s curve editor. Built after Afterburner’s editor repeatedly produced broken curves - notch artifacts at selection boundaries, temperature-stale baselines, and unexpected whole-curve shifts1 - on an RTX 5090 FE.

Curve struct layouts are from the PenguinBurner reverse-engineering effort2, cross-checked against the LACT issue #936 discovery3, the public NVIDIA nvapi header4, and verified via ctypes. Telemetry structs are from nvapi-rs5, nvapi-sys6, and NVIDIA’s official open-source NVAPI reference7. The write path is verified end-to-end on live silicon: a single-point selftest writes +15 MHz, reads it back, and restores. Telemetry (clock, voltage, utilisation, temperature, power) is verified across full gaming sessions. Measured on a single RTX 5090 FE with driver 610.88; the curve interfaces are undocumented and could change between driver releases.

  • Curve write, telemetry, persistence and automated stability search in one static binary, replacing Afterburner for undervolting.
  • Since v0.6 vfctl also sets the memory offset and the power limit through P-states 2.0 (pstates, mem, selftest-mem, power). On the 5090 any P-states 2.0 write zeroes the VF curve, so mem saves the curve first and restores and re-verifies it after.
  • Writes are read-modify-write via ClkVfPointsSetControl, confirmed by selftest on the card.
  • Telemetry covers clock, voltage, utilisation, temperature and live power draw, logged as CSV with a voltage histogram summary.
  • live --chart and live --svg plot stock vs applied curve with the current operating point.
  • A logon task runs vfctl hold, which applies the curve and re-applies it whenever a driver reset wipes the offsets. It reacts to driver events instead of polling.
  • On Blackwell the curve sets the frequency ceiling per voltage, and the DVFS governor picks where the card sits.
  • Since v0.4.0 vfctl also writes the fan curves into the motherboard’s Nuvoton NCT6799D, which then runs them with no software in the loop. That replaced FanControl, whose once-a-second polling cost an 8 kHz mouse dozens of missed polls a minute; most of that cost was the NVAPI GPU temperature read.
JobCommandWhat it replaces
Undervolting a card, with every write read back before it is trustedset to write the curve, persist to install the logon task, hold to re-apply it when the driver reloadsAfterburner’s curve editor, whose notch artifacts at selection boundaries, temperature-stale baselines and whole-curve shifts1 this was built to escape; a logon-only set also cannot see a driver reinstall
Memory offset or power limit on P-states 2.0pstates for the table, mem for the P0 memory delta, selftest-mem for the write path, power for the policy limitAfterburner’s memory slider and power limit controls, with VF curve writes kept separate
Fan curves that run with no software in the loophold writes the fitted curves into the NCT6799D at logon and re-reads them on its safety check; vfctl fan restore undoes itFanControl, whose once-a-second sensor polling cost an 8 kHz mouse 54 missed polls a minute, most of it the NVAPI GPU temperature read
A live plot of stock vs applied curvelive --chart in the terminal, live --svg PATH for a saved plotreading raw offsets and reconstructing the curve by hand
A session’s telemetry, or an automated search for the stability cliffwatch for the CSV and the per-voltage histogram, watch --limits for perf-limit flags, test for the TDR step-down loopa second tool: both ship in the same static binary as the curve write
PackageWhat it ownsKey detail
internal/vfcurveAfterburner blob parse/encode, generation, validation12-byte header, 127 points
internal/curveLive-curve math: BuildOffsets, VerifyOffsets, ApplyCurvebounds guard, read-back verify
internal/testloopTDR-loop logic: Classify, StepFreq, ParseTDRCount100% coverage
internal/profileAfterburner .cfg INI read/writelegacy import path
internal/taskTask Scheduler XML for persistno 72h limit, restart on failure
internal/nvapinvapi64.dll syscall layercurve writes, P-states 2.0 (curve saved and restored around each write), telemetry reads
internal/forensicsheartbeat file, crash records, event-log parsing for holdno NVAPI calls
internal/drveventsSystem event log subscription for holdTDR (4101) and driver install (UserPnp 20003)
internal/sioNuvoton NCT6799D access over a two-method port interfacetested against a simulated chip
internal/pawnioPawnIO driver binding, embedded signed LpcIO moduleshared ISA-bus mutex
internal/fancurveFanControl curve import, 4-point chip fitpure maths
internal/vfplotlive curve plotsstock vs applied curve, profile cap, current operating point
cmd/vfctlCLI dispatchcurve, P-states, hold, fan, telemetry, and crash commands

Built partly by a self-correcting loop on a local Gemma 4 26B model - the internal/curve and internal/testloop extractions converged in one iteration each against a go test sensor, with human review catching a dropped sentinel guard the tests missed.

Three bugs separated the first attempt from a working write, and each was caught only by a stricter verification step than the last:

  1. A 4-byte struct offset. The control struct’s points start at 0x44; the 0x48 came from a read-only PoC that never exercised a write.
  2. Mixed struct generations. The status read used a 128-point layout while the control write used 255 points - different index spaces, so “point 72” in the read wasn’t “point 72” in the write.
  3. A fresh buffer instead of read-modify-write. The driver silently ignores writes to points whose type_ field doesn’t match what it returned. A zeroed buffer writes nothing that sticks.

Writes land when GetControl fills the full table (preserving type_/rsvd), one freq_offset_kHz is modified, and SetControl writes the whole table back. vfctl then reads the point back and treats a write that does not read back as an error.

A fourth bug was in the read path. The status struct’s freq_kHz (+4) is the nominal frequency (base + applied offset), not the base. The true base is vf_tuple_base.freq_kHz (+12). Using the nominal double-counts offsets on any non-stock card. This is why Afterburner profiles “mutate” after apply - the stored frequencies are a temperature-time snapshot, and only the offsets are real.

watch samples clock, voltage, utilisation, temperature, and power every interval, logs CSV, and prints a per-voltage histogram on exit. Full-session data from The Finals on an undervolted 5090:

MetricMenuFull load
Core clock2415 MHz2433 avg / 2497 max
Voltage880-885 mV930-935 mV (95.7% of time)
Utilisation13-17%72% avg / 99% peaks
Temperature45C57 avg / 61 max
Power31W76W avg / 103W max

The card sits at 930 mV with the curve targeting 860 because Blackwell’s DVFS governor adds voltage margin under sustained load, independent of the curve. Power (103W max of 575W) and temperature (61C) ruled out both limiters. The voltage step happens the instant utilisation crosses ~85%, before power or clock change, so it tracks how long the load has run rather than how much it asks for.

The cost of that margin is ~5W. The heat goal (“stock perf or better, lowest possible”) was already met: 2433 MHz avg at 76W average on a 575W card.

All accessed via nvapi_QueryInterface(function_id) on nvapi64.dll. Version field: (version << 16) | struct_size.

IDNameStructNotes
0x507B4B59ClkVfPointsGetInfoInfoV1, 0x182Cactive mask + per-point type/voltage_based
0x21537AD4ClkVfPointsGetStatusStatusV3, 0x15B0C255 pts x 348B at 0x68; base at +12, nominal at +4
0x23F1B133ClkVfPointsGetControlControlV1, 0x2420255 pts x 36B at 0x44; offset at +20
0x0733E009ClkVfPointsSetControlControlV1, 0x2420read-modify-write ONLY

Only points with info-struct type==0 && voltage_based==1 are editable core points - the 255-point buffer also carries memory/other clock domains, and writing those offsets corrupts them.

IDNameReads
0xDCB616C3GetAllClockFrequenciescurrent core/memory clocks (kHz)
0x60DED2EDGetDynamicPstatesInfoExutilization % (domain 0)
0xE3640A56GetThermalSettingstemperature - 3-arg call (gpu, sensorIndex, struct)
0xEDCF624EClientPowerTopologyGetStatuslive power draw
0x465F9BCFClientVoltRailsGetStatusvoltage (uV at +0x28)

ClientPowerPoliciesGetStatus (0x70916171) is one name away from ClientPowerTopologyGetStatus and returns the power-limit policy (frozen ~100%), not live draw. The symptom is a power reading pinned at exactly 100.0 W that never moves.

Memory offset and power limit (P-states 2.0)

Section titled “Memory offset and power limit (P-states 2.0)”

vfctl pstates [--json] dumps the table. vfctl mem [--offset MHZ|--reset], vfctl selftest-mem, and vfctl power [--limit PCT] use the same P-states 2.0 path.

Measured on an RTX 5090 FE with driver 617.42 on 2026-10-28:

Findingmeasured:
NvAPI_GPU_GetPstates20 accepts struct version 3; only P0 is editablepstates table read
P0 delta ranges: graphics -1000..+1000 MHz, memory -1000..+3000 MHz; video, P1, P3, P5 and P8 read-onlypstates table read
Memory clock per P-state: P0 14001, P1 13801, P3 7001, P5 810, P8 405 MHzpstates table read
The memory offset adds 1:1 to the reported clock: idle P1 13801 + 200 = 14001 MHz. An old Afterburner profile with memory +2000 read 15801 MHz, which is 13801 + 2000, not the stock clockmem --offset 200 before/after
The card exposes no base-voltage entry, so a voltage offset is not available; undervolting stays on the VF curvepstates table read
Any NvAPI_GPU_SetPstates20 write zeroes every VF-curve offset, even a memory delta of 0 to 0 (+892 MHz at 900 mV read +0 after)VF offsets read before and after
A P0 graphics delta replaces every VF point offset with that one flat value (+892 became +15 on all points), so core refuses while a curve is applied unless --forceVF offsets read before and after
With the save-and-restore in place, selftest-mem, mem --offset 200 and mem --reset leave the curve unchangedVF offsets read after each step
Power limit range 69.6% to 104.3% (default 100%); power --limit writes, reads back, and leaves the curve alonepower read, write and read-back

Stock below the ramp start, linear ramp to the target frequency at the target voltage, flat above. Offsets are computed against the live base (vf_tuple_base), so the result is temperature-correct at apply time:

offset = target_freq - base_freq_at_voltage

Curve view is vfctl live --chart in the terminal or vfctl live --svg PATH for a saved file. It shows stock vs applied curve, the profile cap, and the current operating point.

NVIDIA snaps frequencies to 15 MHz steps. A bounds guard rejects values outside sane envelopes (the catastrophic-typo check: 27970 instead of 2797). Every write is verified by read-back within one step, and set self-cleans stale offsets below the ramp region so switching curves never stacks.

Persistence: offsets do not survive a driver reload

Section titled “Persistence: offsets do not survive a driver reload”

The offsets live in driver memory. A reboot clears them, and so does any driver reload - including a driver reinstall by the NVIDIA installer while the desktop is running. On 2026-10-08 an installer run reinstalled nvlddmkm mid-session and the card went back to the stock curve with nothing signalling the process that had set it; the original logon-only set task never noticed.

vfctl hold closes that gap. It applies the curve, then checks it only when the driver may have reset it: it subscribes to the System event log for a TDR (Event 4101) or a driver install (Event 20003 from UserPnp, which the 2026-10-08 reinstall logged for nvlddmkm) and checks 10 s after one fires. A safety check every 15 minutes covers anything the log misses and is skipped while a fullscreen game is in front. A GPU device restart (pnputil /restart-device, which IRQ-affinity tools use to apply a pin) also reloads the driver and zeroes the curve, but on this box it logs nothing in the System or Kernel-PnP logs, so since v0.6.2 hold also registers for Plug and Play arrivals of the display adapter interface (CM_Register_Notification) and treats an NVIDIA arrival like a TDR: measured, the arrival reached hold 1 s after the restart and the curve was back 11 s later. Two traps on the way: the notification callback receives 32-bit arguments in 64-bit slots, and using the event size unmasked crashed hold with an access violation; and after one restart the device is left pending a reboot, so a second restart fails while pnputil still exits 0. The first version polled every 15 s, then every 30 s; seven days of its log showed the poll catching drift once, 30 s after startup, so v0.3.0 moved to events. Each check opens a fresh NVAPI session, compares the offsets with what hold last wrote, and re-applies on drift. After 20 failed checks in a row it exits non-zero so Task Scheduler restarts it with a freshly loaded nvapi64.dll.

persist --profile installs the binary and a machine profile under %ProgramFiles% (the task runs elevated, so neither may sit in a user-writable folder) and registers the task without the default 72-hour execution limit. The profile is a JSON file kept in the repo with the undervolt and fan settings, so changing a setting means editing the file and running persist again. Verified live: a fake Event 4101 written to the System log produced a check that found the curve intact, and resetting the card to stock followed by another fake Event 4101 got the curve re-applied (63 points verified).

Since v0.6.1 hold writes a small heartbeat file after every check and on every 15-minute tick while it is paused for a game: the target V/F, whether the curve checked clean, whether it was paused and for which exe, and the last apply time. The paused ticks make no NVAPI call. When hold finds the curve reset it appends one crash record per episode, with the cause read from the System log (TDR Event 4101, driver install UserPnp 20003, otherwise unknown) and any new crash dumps. At startup it looks for a Kernel-Power 41 newer than the last heartbeat and records it with the Application Error 1000 and WER 1001 events around it. vfctl crashes lists the records. A one-second telemetry history was left out on purpose: it would mean polling NVAPI during games, which the mouse-poll measurements below show is not free. One gotcha when shelling out from Go: Windows PowerShell 5.1 Get-WinEvent -ErrorAction SilentlyContinue exits 1 with no output when nothing matches, so exit 1 with empty output has to be read as “no events”.

FanControl reads every enabled sensor through LibreHardwareMonitor once a second and rewrites each fan’s duty in manual mode every tick. On this machine (ASUS ROG STRIX X670E-I, whose fan headers hang off a Nuvoton NCT6799D Super I/O) that polling showed up as missed polls on an 8 kHz mouse. The chip can run a fan curve itself in its SmartFan IV mode, which is how the BIOS Q-Fan curves already work, so vfctl writes the curves once and leaves the chip to run them.

How it works:

  • Chip access goes through PawnIO8, the signed kernel driver FanControl and LibreHardwareMonitor already install, using its signed LpcIO module9 embedded in vfctl. Every transaction holds the shared Global\Access_ISABUS.HTP.Method mutex those tools use, and vfctl refuses to touch the chip while FanControl runs.
  • Each FanControl curve (10-13 points) is fitted to the chip’s 4 points plus a full-speed temperature. The fitter tries every 4-point subset and keeps the one with the smallest worst-case duty error: 2.2, 3.7 and 6.4 percentage points for the three curves here.
  • Before the first write vfctl saves the BIOS register values, and vfctl fan restore puts them back. Every write is read back. vfctl never puts a fan in manual mode, so if it dies the chip keeps running the last curve.
  • hold writes the curves at logon and re-reads them on its 15-minute safety check. Between checks it makes no fan-side calls.

Register addresses come from the Linux nct6775 driver10 and the NCT6796D datasheet11 (Nuvoton publishes no NCT6799D datasheet). Several facts only showed up on the hardware:

FindingHow it was checked
PawnIO’s ioctl_find_bars returns 0x80070490 (not found) unless the chip is already in extended-function mode, because it reads the chip id firstmeasured: first run failed; the module source confirms the order9
The BIOS runs the CPU and chassis channels on source 28, the AMD CPU temperature over SB-TSI (register 0x4F4), not on the PECI or CPUTIN sourcesmeasured: register dump; rose 50 -> 66 C under a 30 s all-core load
Registers 0x073-0x07D show each fan channel’s current input temperature, not fixed sensors, so LibreHardwareMonitor’s names for them (PECI_0, CPUTIN, SYSTIN, AUXTIN0-2) do not fit this boardmeasured: 0x073 read 0 when channel 0 moved to an unset source, then the value written into that source
SmartFan IV interpolates linearly between the 4 pointsmeasured: three channels within one duty step of the linear value
Index 0x03 is the step-up time and 0x04 the step-down time (some sources swap them). The ASUS BIOS leaves both at 0 and the duty-per-step register 0x66 at 0, so writing a non-zero step time freezes the outputmeasured: with step times written, the chip’s computed target (0x0B) was right but two outputs never moved; keeping the BIOS 0/0 fixed it. Register meanings from the datasheet11
Source 31 reads the channel’s software-writable Virtual1 register, so a program can feed the chip an outside temperaturemeasured: monitor slot and output followed the written value
The ASUS embedded controller does not rewrite the registersmeasured: unchanged 7 minutes later and across restarts of hold

MousePlotter12 recordings of a Nuvoton M483 wired mouse at 8 kHz showed the missed polls that started this work. Each run below counts gaps over 0.4 ms per minute while the mouse was moving. The runs are 30-65 s each, and two that should match (the “curves on the chip” and “chip read only” rows) differ by 2x, so treat a single row as plus or minus half. The direction held across every run.

ConfigurationGaps over 0.4 ms per minute
FanControl running (Motherboard, CPU and NVAPI sources)54
FanControl closed11
vfctl curves on the chip, nothing polling15
hold reading only the fan chip every 5 s7
hold reading the GPU temperature through NVAPI every 5 s49-60
hold reading the GPU temperature every 60 s36

How it was checked: MousePlotter recordings of the M483 wired mouse on the RTX 5090 FE with driver 610.88, one configuration per run, mouse moving throughout.

A chip register read through PawnIO (p99 0.53 ms of wall time) cost nothing measurable. The NVAPI GPU temperature read cost most of FanControl’s overhead, whether the session stayed open or was opened per read, and the gaps came with the stall signature of a system-wide pause: MousePlotter lost its kernel timestamps for them. That runs against the usual view that on-die GPU temperature reads are cheap, at “a few microseconds” of CPU time13; on this RTX 5090 the CPU time may be small, but the stall it causes is not. Why the driver stalls is not established.

So the chassis fan, which FanControl drove from the higher of the CPU and GPU curves, now follows the CPU curve on the chip. vfctl can still drive a channel from max(CPU, GPU) by writing the GPU temperature into the channel’s Virtual1 register at a set interval; the profile leaves that off.

  1. Run the selftest first: write +15 MHz to one point, read back, restore. This proves the write path before anything else depends on it.
  2. Test in a game: The Finals (Unreal Engine 5, transient-heavy).
  3. On TDR (Windows Event 4101), step down -15 MHz and retest; vfctl test automates this loop.
  4. Watch the histogram, and judge the undervolt by where the card sits under load rather than by the target you set.

On driver 610.88, the stability cliff for a 5090 FE is exactly one 15 MHz step wide: 2812 @ 900 mV is stable, 2827 (the old-driver stable curve) crashes.

  • Writes require Administrator (error -137, NVAPI_INVALID_USER_PRIVILEGE); reads work unelevated
  • The curve does not pin the operating voltage; the DVFS governor adds margin under sustained load. Forcing lower needs a declining curve, which is notch territory
  • The undocumented curve interfaces may change between driver releases
  • Windows only (driver 610.88). The Linux driver ships libnvidia-api.so.1 with the same nvapi_QueryInterface entry point and VF function IDs (LACT’s VF curve editor uses them14), so a Linux backend is a port of the call layer, not new reverse engineering
  • Not yet measured: memory clock under game load with an offset
  • Not yet measured: watch --limits inside a GPU-bound game
  • GPU fan control is out of scope: manual % clamps to 30% minimum and 0 RPM is vBIOS-auto only; the card’s own curve stays in charge
  • Motherboard fan control covers the Nuvoton NCT6799D only, verified on one ASUS board; other Super I/O chips need their own register map
  • Tested on a single card: RTX 5090 FE (Blackwell GB202)

What is the tool for?An undervolt curve thatsurvives a driver reloadset, persist, holdFan curves on themotherboard chiphold, fan restoreA session's telemetry, andthe stability cliffwatch, test

The same three jobs as a list:

  1. An undervolt curve that survives a driver reload: set writes it with a read-back verify, persist installs the logon task, and hold re-applies it after a TDR (4101) or a driver install (UserPnp 20003) instead of polling.
  2. Fan curves that run with no software in the loop: hold writes the fitted curves into the NCT6799D at logon and re-reads them on the 15-minute safety check, and vfctl fan restore puts the saved BIOS register values back.
  3. A session’s telemetry, and the search for the stability cliff: watch logs clock, voltage, utilisation, temperature and power to CSV and prints a per-voltage histogram; test steps down 15 MHz on a TDR and retests.
  1. st4rdog, “MSI Afterburner curve editor shortcuts,” GitHub Gist. https://gist.github.com/st4rdog/d305609977037e64684a7932609446de ↩ ↩2

  2. jpietek, “hidden_nvapi_vf.py,” PenguinBurner. https://github.com/jpietek/PenguinBurner/blob/d8901e64a9c7b479d6ae4ced63b7a2048b61e3ce/hidden_nvapi_vf.py ↩

  3. Loong0x00, “Feature: Per-point V/F curve reading and editing for NVIDIA GPUs via undocumented NvAPI,” LACT issue #936. https://github.com/ilya-zlobintsev/LACT/issues/936 ↩

  4. NVIDIA, “NVAPI,” GitHub repository. https://github.com/NVIDIA/nvapi ↩

  5. arcnmx, “nvapi-rs,” Rust crate. https://github.com/arcnmx/nvapi-rs ↩

  6. arcnmx, “nvapi-sys,” Rust crate. https://docs.rs/nvapi-sys - struct layouts for power/thermal reads ↩

  7. NVIDIA, “NVAPI Reference Documentation,” Release 590. https://docs.nvidia.com/nvapi - documented clock/thermal APIs ↩

  8. namazso, “PawnIO,” scriptable kernel driver for hardware access. https://pawnio.eu ↩

  9. namazso, “LpcIO.p,” PawnIO.Modules. https://github.com/namazso/PawnIO.Modules/blob/24425a5299e84410751da882c121f322fb030b82/LpcIO.p ↩ ↩2

  10. Linux kernel, “nct6775-core.c,” hwmon driver for Nuvoton NCT677x/679x Super I/O chips. https://github.com/torvalds/linux/blob/0fcb05b72344f40806cbe810de8872f1698bf053/drivers/hwmon/nct6775-core.c ↩

  11. Nuvoton, “NCT6796D Datasheet,” Version 0.6, 2017. https://www.nuvoton.com/resource-files/NCT6796D_Datasheet_V0_6.pdf ↩ ↩2

  12. XBAB Tech, “MousePlotter.” https://github.com/XBAB-Tech/MousePlotter ↩

  13. Unwinder, “Does hardware polling software like RTSS, HWiNFO64 have a discernible impact on performance?,” Guru3D forums. https://forums.guru3d.com/threads/does-hardware-polling-software-like-rtss-hwinfo64-have-a-discernible-impact-on-performance.443665/ ↩

  14. I. Zlobintsev, “feat: add Nvidia VF curve editor,” LACT pull request #957, merged 2026-04-18. https://github.com/ilya-zlobintsev/LACT/pull/957 ↩