Contributing
VirtualGPU is a Rust performance model with a Python package around it. The Rust core is in crates/vgpu-core/, the Python package and Triton frontend in python/virtualgpu/, the CUDA microbenchmarks in microbench/, the GPU profiles in profiles/ and the hardware validation in validation/. The docs index lists what every doc covers.
Prerequisites
- Rust stable
- Python 3.10 or newer
- uv
- Git
- Linux or WSL2. Triton only runs on Linux
- An NVIDIA GPU and the CUDA toolkit only for the microbenchmarks and validation runs. Everything else runs on a CPU
Installation
- Clone the repository:
git clone https://github.com/VirtualGPU/VirtualGPUcd VirtualGPU
- Create a virtual environment and install the tools:
uv venv --python 3.12uv pip install --group dev
- Build the Rust core into the environment:
.venv/bin/maturin develop --uv
- Set up the Git hooks. They format your staged files and check your commit message:
.venv/bin/pre-commit install --hook-type pre-commit --hook-type commit-msg
Useful commands
cargo test # Rust tests
cargo clippy --all-targets -- -D warnings # Rust lint
cargo fmt # format Rust
.venv/bin/python -m pytest # Python tests
.venv/bin/python -m unittest validation.test_validation # validation tests, CPU only
.venv/bin/ruff check . && .venv/bin/ruff format . # lint and format Python
.venv/bin/python scripts/check_profiles.py # validate every GPU profile
.venv/bin/python scripts/check_text.py # English only, no em or en dashes
Making a change
- Fork the repo.
- Create a branch:
git checkout -b feature/my-new-feature
- Make your changes and add or update tests for them.
- Add a line to
CHANGELOG.mdunder the top version. - Commit your changes:
git commit -m "feat: add my new feature"
- Push to your fork and open a pull request against
mainwith a clear description.
Guidelines
- Everything is written in English: code, comments, docs, commits, issues and pull requests.
- No reverse engineering. Use public specs, documented tool output and our own measurements.
- Never fit model parameters to kernel timings. Calibration data (microbenchmarks), development data and holdout data stay apart.
- The schemas in
schemas/are the contracts between parts. Change one only together with every part that reads it. - When the code changes how a part works, update its doc in
docs/components/in the same pull request. - Files in
validation/that a seal or fit points to are never moved, renamed or reformatted. A new evaluation adds new files. - Tests for the Python package live in
python/tests/, mirroringpython/virtualgpu/. Rust tests live next to the code or incrates/vgpu-core/tests/. Every bug fix needs a test that fails without it. ruff,rustfmtandclippyset the code style. They run on every pull request and must pass.- Keep comments short and only where they help.
- Use short commit messages that start with
feat:,fix:,docs:,ci:orchore:, and link related issues. - Security problems go through a private report, not a pull request. See SECURITY.md.
Changes to model mechanisms
Any change to prediction logic in crates/vgpu-core/, to frontend IR extraction or to how profile fields are derived goes through a pull request, maintainers included. Profile data, docs and tooling that leave predictions unchanged follow the usual process.
Such a pull request includes three things:
- The prediction diff. Replay the archived Kernel IRs on the base and the candidate, and record both revisions, the IR and profile digests, cache state, draws and seed. Report what stays bit-identical, how many predictions change, by how much, and any status changes. For a change to IR extraction or profile derivation, regenerate that input from the same source and keep the other one fixed.
- The microbenchmark evidence. Link it with the raw captures, and say whether each capture rule and gate passed.
python -m microbench.capture_posthoc check RUN.json [RUN.json ...]checks the dispersion rules. - Validation. For a mechanism that is meant to be validated, register the decision rule and freeze the predictions before the validation capture. Effects on already opened data are post-hoc only and do not validate the change.
To get the prediction diff on a CPU, run this in both checkouts with their own built environments, with the same absolute IR_DIR and PROFILE and a different OUT. Repeat for both cache states and every affected case:
CUDA_VISIBLE_DEVICES="" python -m virtualgpu.cli predict --ir-dir "$IR_DIR" \
--case "$CASE" --profile "$PROFILE" --cache cold --draws 32 --seed 17 --out "$OUT"
Then compare the two files:
python scripts/prediction_diff.py /tmp/vgpu-base.json /tmp/vgpu-candidate.json
Contributing a GPU profile
If you have a GPU we don't have a profile for, measuring it is the most useful thing you can do. See contributing a profile.
Support
Bugs and ideas go in this repo. Add as much detail as you can, in English if possible.