feat: show the clock domains NVML does not report (XBAR, SYS, NVD) - #502
Open
Panchovix wants to merge 1 commit into
Open
feat: show the clock domains NVML does not report (XBAR, SYS, NVD)#502Panchovix wants to merge 1 commit into
Panchovix wants to merge 1 commit into
Conversation
NVML only exposes the graphics, memory and video clocks, so the domains that explain a lot of NVIDIA behaviour under a power limit - XBAR, SYS and NVD - are invisible from nvtop. They are reachable through the NvAPI library the driver installs next to NVML, which resolves every entry point through nvapi_QueryInterface, so a driver without it loses nothing else and needs no privileges of its own. The dynamic info carries them as a small array of named domains rather than as NVIDIA specific fields, since other drivers expose clocks of the same kind (socclk and fclk on AMD, for instance) and can fill the same array. A domain marked secondary is one that sits at a fixed frequency most of the time; -x shows the rest, -X shows both, and the snapshot output carries everything. How many domains a GPU reports is only known after its first refresh, which happens once the windows are already laid out, so the rows the bar needs are revisited on every draw and the windows rebuilt when the count changes. The bar therefore costs nothing on a GPU that reports no such domain, and takes a second row when eight of them are on screen. Rows are never given back on their own, only when an option changes, so one failed read cannot make the interface jump. Domain 20 is labelled NVD rather than the Pwr some tools use: a frequency offset on it raises NVENC throughput by the same proportion, measured A-B-A on an RTX PRO 6000, which a power management clock would not do.
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.
NVML reports the graphics, memory and video clocks and nothing else, so on NVIDIA the domains that explain much of what the GPU is doing under a power limit are invisible to nvtop. XBAR in particular is the clock the memory subsystem runs at, and watching it next to the graphics clock is what tells a power limited board apart from a bandwidth limited one.
They are reachable through the NvAPI library the driver installs next to NVML. Everything is resolved through
nvapi_QueryInterface, so a driver without the library, or without these entry points, simply reports no extra clocks and nothing else in the interface changes. No privileges are needed - this works as an ordinary user, same as NVML.Screenshot
nvtop -x, on an idle and a loaded GPU:Not an NVIDIA specific field
The dynamic info carries these as a small array of named domains rather than as three NVIDIA specific fields, since other drivers expose clocks of the same kind -
socclkandfclkon AMD, for instance - and can fill the same array with a single call togpuinfo_add_extra_clock().A domain can be marked secondary, meaning it sits at a fixed frequency most of the time and is only worth a look now and then.
-xshows the rest,-Xshows both, and both have a checkbox in the setup window under Devices. The snapshot output carries every domain a device reports, keyed by name.The bar costs nothing when there is nothing to show
How many domains a GPU reports is only known after its first refresh, which happens once the windows have already been laid out. So the rows the bar needs are recomputed on every draw and the windows rebuilt when the count changes. A GPU that reports no such domain - an AMD or Intel one, or an NVIDIA whose driver has no NvAPI - costs no row at all rather than leaving a blank line, and the bar takes a second row when eight domains are on screen.
Rows are never given back on their own, only when an option changes, so one failed read cannot make the interface jump. The rebuild is also held back while the setup window is open, since
alloc_setup_window()clearsvisibleand would otherwise close it under the user mid-toggle.Testing
Six GPUs on one machine, driver 610.57.04: three RTX PRO 6000 Blackwell, an RTX PRO 4000 Blackwell, an RTX 2000 Ada and a GeForce RTX 3060 Ti, plus a Ryzen 9900X integrated GPU for the case where a device reports nothing. Ada and Ampere work as well as Blackwell, so this is not new hardware only.
The struct layout was checked against
nvidia-smibefore being trusted: domain 0 matchesclocks.current.graphics, domain 4 matchesclocks.current.memoryand domain 21 matchesclocks.current.video, exactly, on all six.Verified: both options separately and together, alongside
-i, toggling from the setup window, saving and reloading the config, a config that leaves only the integrated GPU monitored (no row reserved), and the snapshot output. Builds clean with-Wall -Wextra.