Repository navigation
GPU control: GFX minimum, undervolt and overclock (GPUSensors 0.9.0) - #159
Merged
Merged
Conversation
The kext takes a raised GFX minimum (OD8 id 1) with the rest of the OD8 state, through the same 0xa1 call and the same owner rules and way back. It is taken only inside the card's own 0x9f range for id 1 and never above the GFX maximum of the same state (the driver's FMIN <= FMAX rule); anything else is refused as GfxMinRange (12). It keeps the clock up at idle, so it is taken only while the watchdog has fresh readings, and the watchdog's 95 C and missing-readings rules hold it while it is held. Channel version stays 2: setOd8 also takes 14 scalars (the 13 of 0.7.0 still work), status flag 512, held bit 16, and OD8WriteState publishes GfxMinHeld and Takes. gpucontrol gains "gfxmin MHz" for hold and check. The app shows a GFX minimum clock section under the maximum in Settings > GPU control, only when the kext publishes Takes with the minimum, and remembers it with the rest of the OD8 state. The curve rules copy and its fixture cover the new check; the first 100 fixture lines are unchanged. Not added: the memory maximum (its 0x9f minimum is the stock 2000 MHz on the RX 6800 XT, so nothing is lower, and a memory clock change blanks the display) and the fan minimum speed and target temperature (the driver does not offer them while it offers the fan curve).
The OD8 state now also takes a lower GFX voltage (OD8 id 37, the firmware's VddGfxOffset). Read end to end in the 25G342 driver: it is offered with PP_OD8VoltageSliderSupport (the Navi 21 default) as a range from the card's minimum to its stock value (881 to 1075 mV on the test RX 6800 XT), the driver writes value minus the top as the offset of the whole voltage curve and reads back top plus offset. The kext takes it lower only, in 25 mV steps from stock, reads it back exactly, and sends the stock value in every other call so no way back leaves an offset. Two raises, only when the request asks for them and only inside the card's own OverDrive range: a GFX maximum above stock up to the 0x9f maximum (setOd8 flag 4), and a power limit above the start-up one up to the start-up limit plus the card's power percent, cut at +15 % (set's new 3-scalar form; 261 W on the test card). One step past either maximum is refused. Each raise needs fresh watchdog readings and is held under the watchdog: 95 C or 10 s without readings puts stock back and turns writing off (new WriteOff 16 for the power limit). Not added: the memory clock and fast memory timings. Both start with an IRI call (0x110018) that Apple's display glue does not implement, so the driver cannot apply them on macOS. Channel version stays 2: setOd8 takes 15 scalars too, set takes 3, replies 21 and 22, Od8Check 13, status flags 1024 and 2048, held bits 32 and 64, VoltHeld, Takes 119, PowerRange CeilW. gpucontrol gains "volt mV", "overclock" and "hold power W raise". The app adds a GFX voltage section (it suggests stock minus 25 mV as a starting point and never applies it by itself) and an Overclock section, off by default, with no suggested values. A voltage or a raise is never sent again by itself at launch. docs/GPU_CONTROL.md describes every control, its range and its risks. Tested on the host only: controltest 432 checks, the curve rules fixture grew to 149 cases (the first 120 unchanged), ./build.sh --test. Not booted.
At launch the remembered OD8 state was refused once with "the fan watchdog has no fresh hotspot and fan readings" and never asked for again. The kext's PMLog copy only moves when someone reads the accelerator's PerformanceStatistics, and right after launch nothing had yet. Now the app reads PerformanceStatistics right before every OD8 change and every raised power limit, and a remembered request refused for missing readings is tried again every 3 s for 30 s. Real refusals (out of range, not allowed, another program) are never sent again, and the owner's own choices still show a refusal at once. The remembered GFX voltage and the raised GFX maximum now come back at launch too, the raise only while "Allow overclocking" is on (also checked again after a wake). A raised power limit is still not asked for at launch. Footers, docs and the changelog say so in every language. The "Fan always on" switch only edited the fan editor's draft, which went out with "Apply curve"; the voltage and clock controls sent the held state without it, so the switch could read on while the kext held zero RPM at stock. While a curve is held the switch now sends at once with that curve. gpucontrol status says "GFX max raised" for a maximum above stock and shows a held voltage. ./build.sh --test: 34986 checks OK; concurrency gate OK.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds four things to the GPU control, all in GPUSensors 0.9.0 (never released, so they share the number): a raised GFX minimum clock, a lower GFX voltage, and two raises, the GFX maximum clock and the power limit. They go through the same channel and the same rules as the fan curve and the power limit: changes must be allowed first, one program at a time, back to stock on release, quit, 30 s of silence, after a wake and on restart.
Everything stays inside the card's own OverDrive limits, the ones its tables publish to the driver (the same limits Radeon Software offers on Windows). The kext refuses anything outside them with a reason, it never clamps.
GFX minimum. Raised from stock up to the GFX maximum in force (500 to 2800 MHz on my RX 6800 XT, stock 500). It keeps the clock up at idle, so the kext only takes it while it has fresh temperature readings and the watchdog puts stock back at 95 C or if the readings stop.
GFX voltage (undervolt). Lower only, from the card's stock value down to its own minimum in 25 mV steps (1075 to 881 mV here). I read it end to end in the driver: it becomes the firmware's VddGfxOffset, which moves the whole voltage curve down, and the driver reads it back as top plus offset, which the kext checks exactly. Linux writes the same field. The kext sends the stock value in every other call, so a way back never leaves an offset behind. The page suggests stock minus 25 mV as a starting point and never applies it by itself.
Overclock. A separate section, off by default, with no suggested values: the GFX maximum above stock up to the card's own maximum (2800 MHz here), and the power limit above the start-up one up to the start-up limit plus the card's power percent, never more than +15 % (261 W here, +9 %). One step past either is refused. Both are held under the watchdog. A voltage or a raise is never sent again by itself when the app starts, so a value that froze the Mac can't freeze it again at the next launch.
Left out on purpose. The memory clock and the fast memory timings switch. On macOS the driver can't apply them: both start with a call to the display side that Apple's part of the driver doesn't implement, so a memory clock makes the whole request fail and fast timings are recorded but never programmed. Also out, as before: the fan minimum speed and target temperature, which the driver hides while it offers the fan curve.
Only the RX 6800 XT writes; the RX 6900 XT shows readings only, other RX 6000 cards aren't read by the control yet. Every control, its range and its risks are in
docs/GPU_CONTROL.md.The channel stays at version 2.
setOd8also takes 14 and 15 values andsettakes 3; older apps keep working, and an older kext refuses the new forms with a wrong-count error.Tested:
./build.sh --testpasses (34961 checks) andGPU/tests/run.shpasses (controltest 432 checks; the curve rules fixture has 149 cases and its first 120 lines did not change). Not tested on the card yet: nothing here has been booted.