interplane.Get Omega
Read in your language

aien-rig

AIEN Rig: local AI and frame-rate tuning for RTX gaming PCs. Pre-alpha; host fixtures and target-card qualification are separate.

Brought by drakestapleton

branch main Branches Tags History

aien-rig / docs / TEACHING.md

194 lines · 12028 bytes Raw Blame History Source

Teaching AIEN Rig: the tuner's undo log, and a first local exercise

This walkthrough explains one mechanism that has been implemented, and shows you how to run its tests yourself. It uses only source, tests, commits and evidence that are already in this repository. The repository has no ADRs yet, so the design reasons below are quoted from the module comments and commit messages at the pinned commit.

1. What is on main, and what is on the branches

On main, engine/, speech/, creator/, tuner/ and app/ each hold a single placeholder README. PLAN.md assigns each component its own branch. The code is on those branches, and none of them has been merged. The table in the README lists each branch at a pinned commit, along with what it contains and the evidence behind it. Three different kinds of status appear in this document, and they must be kept apart:

2. The problem the tuner solves

The tuner changes Windows settings on the user's own PC. AGENTS.md sets the rule: *apply only safe changes, record a receipt for each, and be able to undo every change. Do not add a change the tuner cannot revert.* The undo log is the mechanism that enforces this rule.

3. The mechanism

All links below point to tuner/v0 at commit 2a2cda0.

Why it was built this way

The reasons below are taken from source comments and commits. They are not a reconstructed personal account.

A failed approach elsewhere in the project

Creator's first end-to-end run, at commit 8c2c463, received HTTP 503 "GPU lock held by other jobs" on every attempt for 899 s and then exited with status 1. The run was kept as evidence. Commit 7aef4de added --busy-wait, and the next run passed. Both runs are recorded in the creator evidence README.

Upstream components

The tuner's direct dependencies, from Cargo.toml, are anyhow, clap, serde and serde_json on every OS. On Windows it also uses Microsoft's windows and windows-registry crates. Exact versions are pinned in tuner/Cargo.lock. The development method (HDAE) is attributed in the README.

4. Exercise: run the pure core and its refusal case (offline after fetch, no GPU, no Windows)

Pins. Repository https://github.com/aien-dev/aien-rig.git, commit 2a2cda0e2e4684119d28859261dbe123b4ded009 (the head of branch tuner/v0, 2026-10-19).

Requirements. Git and a stable Rust toolchain with cargo. The recipe was replayed with rustc and cargo 1.98.1 on Ubuntu 24.04 aarch64. It needs no GPU, no model download, no Windows and no administrator rights. The only network step is cargo fetch, which downloads the crates pinned in Cargo.lock from crates.io. Every step after it can run with --offline.

Inputs. The tests build their own inputs. MemStore is an in-memory settings store, and the test functions hags() and dvr() stand for the Windows registry values HwSchMode and HistoricalCaptureEnabled.

git clone https://github.com/aien-dev/aien-rig.git rig-exercise
cd rig-exercise
git checkout 2a2cda0e2e4684119d28859261dbe123b4ded009
cd tuner
cargo fetch --locked                                # network: crates.io only
cargo test --offline --locked                       # step A: all pure-core tests
cargo test --offline --locked undo::                # step B: the undo-log tests
AIEN_RIG_HOME="$(mktemp -d)" cargo run --offline --locked -q -- undo --list   # step C
cargo run --offline --locked -q -- scan             # step D: expected refusal off Windows

Expected output and exit status.

What each test establishes.

ClaimTest (in tuner/src/undo.rs)
The old value reaches disk before the change, and undo restores it exactly, including deleting a value that did not exist beforeapply_then_undo_restores_exactly_including_missing
A write whose read-back does not match is rolled back and not loggedbad_readback_rolls_back
Refusal: a setting the user changed afterwards is left alone unless force is setundo_leaves_settings_changed_by_someone_else_unless_forced
A Pending entry left by a crash is still undonepending_entry_from_a_crash_is_still_undone
Refusal: a tweak may not delete a settingrefuses_to_delete_as_a_tweak

Negative control: show that the refusal test can fail

A test is only evidence if it fails when the behaviour it checks is removed. Disable the ChangedSince guard in a throwaway checkout, run the test, then restore the file:

sed -i.bak 's/if !ours && !force {/if false {/' src/undo.rs && rm src/undo.rs.bak
cargo test --offline --locked -q undo::tests::undo_leaves   # expected: exit 101, test FAILED
git checkout -- src/undo.rs
cargo test --offline --locked -q undo::tests::undo_leaves   # expected: exit 0, 1 passed

With the guard disabled, the test fails with assertion failed: matches!(out[0], UndoOutcome::ChangedSince { .. }) at src/undo.rs:433, and cargo exits with status 101. Restore the file with git checkout, not by moving a backup copy back into place. mv keeps the backup's older modification time, so cargo treats the build as up to date and the test keeps failing. That happened in the first replay of this recipe.

What this exercise does not show

The exercise runs the pure core against an in-memory store. It does not touch the Windows registry, ETW, NVML or a display. It produces no FPS number, and it is not a 5070 result.

5. Optional: Windows and RTX 5070 qualification (separate, not done yet)

These steps come from the tuner README and its CI at the same commit. They are listed here so that a reader can tell what remains.

  1. Windows host, no NVIDIA card needed. .github/workflows/tuner.yml builds rig-tune.exe, runs the unit tests and the Windows OS tests, runs clippy with -D warnings, and runs tuner/ci/windows-e2e.ps1. That script checks scan, compares the ETW frame count with a WARP Direct3D 11 probe presenting at 120 fps, runs apply --yes followed by an exact undo, and checks game mode. This passed on windows-latest in run 39292662908 (commit 4cebe95) and in run 39293286436 (commit 2a2cda0). This is host CI on a runner with a virtual display. It is not target-hardware evidence.
  2. RTX 5070 PC (not done). Run rig-tune scan as administrator. Check that the NVML readings for Resizable BAR and PCIe link width are correct. Check a real monitor refresh-rate change and its 15 s revert. Record measure before and after apply for one game at the same spot, with --label before and --label after, then run compare and undo. Keep the receipts in evidence/ and name the card, driver and game. Until these receipts exist, the tuner README's "Not yet verified" list still applies, and no FPS gain is claimed.

The engine and speech GPU paths have only been measured on a DGX Spark (GB10). See their branch READMEs. Repeating those numbers on an RTX 5070 is a separate qualification, and none has been done.