Repository navigation
Add GPU memory telemetry to the nvidia_power trace collector - #7246
Open
shreyaskommuri wants to merge 1 commit into
Open
shreyaskommuri wants to merge 1 commit into
shreyaskommuri wants to merge 1 commit into
Conversation
nvidia_power.py already runs a background nvidia-smi collector for the whole RUN stage of any benchmark, but its QUERY_TABLE/QUERY_GROUPS had no entry for memory.used/memory.total, only utilization.memory (percent busy, not actual MiB consumed). There was no way to sample live GPU memory consumption during a benchmark run anywhere in the codebase; nvidia_driver.GetGpuMem() only reads static total capacity once at setup. Adds memory.used and memory.total as two new declarative QUERY_TABLE entries plus a 'memory' QUERY_GROUPS selection, following the exact pattern already used for power/utilization/temperature/clocks. No changes needed to the parsing, collection, or Analyze logic, since those are already fully table-driven. Purely additive: --nvidia_power_selections defaults to 'power' and is unaffected; 'all' now also includes the new memory group. New unit test (testParseNvidiaMemoryResult) parses a synthetic CSV fixture (tests/data/nvidia_memory_output.txt, modeled on documented nvidia-smi --format=csv output; not captured from real hardware, which I don't have access to) through the existing _NvidiaPowerResults parser, mirroring the existing testParseNvidiaPowerResult test exactly.
shreyaskommuri
marked this pull request as ready for review
November 10, 2026 20:02
This branch has not been deployed
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.
Summary
Fixes #7245.
perfkitbenchmarker/traces/nvidia_power.pyalready runs a backgroundnvidia-smicollector for the wholeRUNstage of any benchmark (hooked genericallyvia
events.before_phase/after_phaseonstages.RUN, so no per-benchmark wiring isneeded), and already samples power draw, p-state, utilization percentage, temperature,
and clock speeds at a configurable interval. It had no way to sample actual GPU memory
consumption:
utilization.memory(percent of the memory bus busy) exists, butmemory.used/memory.total(actual MiB consumed) did not. The only otherGPU-memory-related function in the codebase,
nvidia_driver.GetGpuMem(), only readsstatic total capacity once at install time, never live usage during a run.
This adds
memory.usedandmemory.totalas two newQUERY_TABLEentries and a new'memory'QUERY_GROUPSselection, following the exact same declarative shape as theexisting
power/utilization/temperature/clocksentries. No changes needed to_NvidiaPowerResults,_CollectorRunCommand, orAnalyze, since all three are alreadyfully driven by these tables.
Purely additive:
--nvidia_power_selectionsstill defaults to'power', unaffected bythis change;
'all'now also picks up the new'memory'group automatically. Alsoupdates the flag's help text, which explicitly enumerates valid group names.
Test Plan
New unit test
testParseNvidiaMemoryResultintests/traces/nvidia_power_test.py,mirroring the existing
testParseNvidiaPowerResultexactly: parses a synthetic CSVfixture (
tests/data/nvidia_memory_output.txt) through the existing_NvidiaPowerResultsparser and asserts both metrics/units/values.I don't have access to real GPU hardware, so the fixture is synthetic, built to match
the documented
nvidia-smi --format=csvoutput shape (same format the existingnvidia_power_output.txtfixture uses) rather than captured from a real run. Flaggingthis explicitly rather than presenting it as real hardware output.
Also verified the collector wiring directly (not just the parser), since
QUERY_TABLE/QUERY_GROUPSfeed into_CollectorRunCommandtoo:Confirmed
selections='all'also includesmemory.used/memory.totalautomatically.Ran the full
tests/traces/suite (all existing collectors) via the documentedpython -m unittestinvocation with zero regressions.pyink --pyink-indentation 2 --pyink-use-majority-quotes --unstable --line-length=80is clean on every line this PR adds.
git diff -U0 master | lint-diffsflags 3 styleitems on the new test method (PascalCase test name, no per-test docstring, protected-
member access) — confirmed via plain
pylintthat the pre-existing, untouched siblingtest (
testParseNvidiaPowerResult) in the same file has the identical three findings,so this matches the file's own established convention rather than introducing a new
one.
Additional Notes
I've signed the Google CLA. AI was used for context and guidance while investigating
and drafting this change.