Contributing a GPU profile
VirtualGPU lets developers compare kernel variants for GPUs they do not own, as long as someone with that GPU has run the isolated microbenchmark suite once and submitted the resulting profile to profiles/.
This guide walks through building the microbenchmark binary, collecting a profile with microbench/collect_profile.py, running self-checks, and opening a pull request.
Principles
- Public APIs and isolated microbenchmarks only. Never reverse engineer vendor drivers, firmware, or machine code.
- Never fit to workloads. Do not hand-edit profile numbers to match GEMM, attention, or MoE timings.
- Be honest about provenance. Keep
provenance.source(measured,partial, orspec_derived) andclock_policy.lockedaccurate; VirtualGPU relies on those flags andrel_uncertaintyto avoid overconfident rankings.
Prerequisites
- Hardware: An NVIDIA GPU with a working driver and
nvidia-smiaccessible. Native Linux is preferred so clocks can be locked; WSL2 is supported in record-only mode (the collector records clock drift and widensrel_uncertaintyautomatically). - Python: Python
>= 3.10anduv(or standardvenv+pip). - CUDA Toolkit (
nvcc+ runtime): Either a system CUDA installation onPATH, or pip-installednvidia-cuda-nvccandnvidia-cuda-runtimeinside the project virtual environment. Use a toolkit version that supports your target GPU architecture (for example, CUDA 12.8+ forsm_120/sm_121).
Step 1: Set up the environment and build vgpu_bench
From the repository root:
uv venv .venv --python 3.12
uv pip install --python .venv jsonschema nvidia-cuda-nvcc nvidia-cuda-runtime
If you already have a matching system nvcc on PATH, you only need jsonschema in .venv. microbench/build.py checks the venv first and falls back to nvcc on PATH.
Compile the CUDA C++ microbenchmark binary for your GPU's compute capability (--arch):
.venv/bin/python microbench/build.py --arch sm_89
Common --arch values:
| Architecture | Example GPUs | --arch |
|---|---|---|
| Ampere | A100, A800, RTX 3090 | sm_80 / sm_86 |
| Ada | L40S, L20, RTX 4090, RTX 4070 | sm_89 |
| Hopper | H100, H800, H200, H20 | sm_90 |
| Blackwell (datacenter) | B200, GB200 / B300, GB300 | sm_100 / sm_103 |
| Blackwell (client/edge) | RTX 5090, RTX PRO 6000 / GB10 | sm_120 / sm_121 |
This produces microbench/build/vgpu_bench.
Step 2: Prepare the GPU (clock locking and isolation)
Ensure no other GPU workloads are running. On a shared machine, wrap the run with flock /tmp/virtualgpu-gpu.lock ....
On native Linux (recommended when you have root privileges), lock SM and memory clocks to sustainable frequencies before collecting so measurements have minimal drift:
# Inspect supported clocks:
nvidia-smi --query-supported-clocks=gr,mem --format=csv -i 0
# Lock clocks (replace with sustainable values for your GPU):
sudo nvidia-smi -i 0 -lgc <SM_MHZ>,<SM_MHZ>
sudo nvidia-smi -i 0 -lmc <MEM_MHZ>,<MEM_MHZ>
After collection finishes, reset clocks back to default:
sudo nvidia-smi -i 0 -rgc
sudo nvidia-smi -i 0 -rmc
On WSL2 or platforms where clock locking is unavailable, skip this step. collect_profile.py polls nvidia-smi under active load, sets clock_policy.locked = false, and widens rel_uncertainty automatically.
Step 3: Collect the profile
Choose a lowercase filename slug for your GPU under profiles/ (for example profiles/rtx4090.json, profiles/h100_sxm5.json, or profiles/gb10.json), then run:
.venv/bin/python microbench/collect_profile.py \
--device 0 \
--output profiles/<gpu_slug>.json
Useful CLI options:
--binary: Path tovgpu_bench(default:microbench/build/vgpu_bench).--device: CUDA device index (default:0).--samples: Timed iterations per benchmark point (default:15).--repeats: Repeats per CTA dispatch probe (default:5).
What it runs: collect_profile.py runs every vgpu_bench mode (memory, L2, MMA, pipeline, sync loop, SFU and shuffle, spill, launch and CTA dispatch), polls nvidia-smi for clocks and thermal throttling, computes bootstrap 95% confidence intervals, validates the result against schemas/gpu_profile.schema.json and writes the profile. Runtime depends on the GPU's memory size and bandwidth.
Step 4: Check it before opening a PR
Run all checks locally before committing:
-
Schema and semantic validation:
.venv/bin/python -m virtualgpu.profile profiles/<gpu_slug>.jsonConfirm it prints
OK: <SKU> (<arch>, schema 0.1). -
Provenance and thermal hygiene: Open
profiles/<gpu_slug>.jsonand verify:provenance.driver_version,toolkit_version,suite_version, andhost_osare populated.provenance.sourcematches the leafMeasuredValue.sourcetags (measuredif all leaves aremeasured,partialif any leaves areestimated,spec_derivedif all leaves areestimated).provenance.clock_policy.throttle_eventsis0. If throttling occurred, let the GPU cool down (or lock to a lower sustainable clock) and re-run.- If you locked clocks on native Linux, verify
observed_sm_clock_range_mhzshows[min, max]equal to the locked clock.
-
Physical sanity check:
specs.sm_countandspecs.l2_size_bytesmatch your GPU.measured.memory.dram_bw_read_gbps.valueis below the card's theoretical DRAM bandwidth.measured.memory.l2_bw_read_gbps.valueexceedsdram_bw_read_gbps.value.
-
End-to-end Rust core check (optional, if Rust is installed):
cargo test -
Repo checks:
python scripts/check_profiles.pypython scripts/check_text.py
Step 5: Open a pull request
- Add a row for your GPU to the table in
profiles/README.md. - Commit only your profile JSON and the
profiles/README.mdupdate:git add profiles/<gpu_slug>.json profiles/README.mdgit commit -m "feat: add <GPU SKU> (<arch>) profile" -- profiles/<gpu_slug>.json profiles/README.md - Open a pull request against
mainongithub.com/VirtualGPU/VirtualGPU. In the PR description, note your GPU model, host OS (native Linux vs. WSL2), driver/CUDA versions, and whether clocks were locked.
CI will automatically validate your profile against the JSON schema, all semantic invariants in python/virtualgpu/profile.py, provenance completeness, source honesty, and the text check.