diff options
| author | MoonEyes <14891700+MoonEyes@users.noreply.github.com> | 2026-12-02 11:51:40 +0100 |
|---|---|---|
| committer | MoonEyes <14891700+MoonEyes@users.noreply.github.com> | 2026-12-02 11:51:40 +0100 |
| commit | fff970e616bf965729cd08a4e86bc6264494de73 (patch) | |
| tree | 03cdc30677fbe1ddaaf33d160150c9afbcfe73c5 /docs | |
| parent | 7c245a359b8bdb6d9985c6d3ffd2bee0609de911 (diff) | |
| parent | 895c472faa1c3d44a1358640f09c1f10e6a6a876 (diff) | |
Merge origin/main into carry/1346
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/game_gate.md | 16 | ||||
| -rw-r--r-- | docs/testing.md | 29 |
2 files changed, 36 insertions, 9 deletions
diff --git a/docs/game_gate.md b/docs/game_gate.md index 4849a85f6..ec6e3eece 100644 --- a/docs/game_gate.md +++ b/docs/game_gate.md | |||
| @@ -27,7 +27,13 @@ pwsh -NoProfile -File scripts\game-gate.ps1 stop -RunDir <run folder> | |||
| 27 | - **The play script's switches.** `-PlayArgs` passes them on as they are, for example `-SeriesS -NoFrameGen`. | 27 | - **The play script's switches.** `-PlayArgs` passes them on as they are, for example `-SeriesS -NoFrameGen`. |
| 28 | - **Reaching the world.** The gate does not drive the menus. Pass key presses with `LEONIDA_KEYS`; they are timed from the start of the process, so allow for the precompile. | 28 | - **Reaching the world.** The gate does not drive the menus. Pass key presses with `LEONIDA_KEYS`; they are timed from the start of the process, so allow for the precompile. |
| 29 | - **The caches.** `-Data` keeps its caches (`cache-2`); only the saves are copied. The first start after a translator change translates every shader again: run once before measuring. | 29 | - **The caches.** `-Data` keeps its caches (`cache-2`); only the saves are copied. The first start after a translator change translates every shader again: run once before measuring. |
| 30 | - **Ending the run.** It stops when the time in the world reaches `-WorldSeconds`, when a `STOP` file appears in the run folder (`stop`), or after `-MaxMinutes` (45). | 30 | - **Ending the run.** It stops when the time in the world reaches `-WorldSeconds`, when a `STOP` file appears in the run folder (`stop`), or after `-MaxMinutes` (45). It checks every 5 s. When two reasons come at the same check, the first of these wins: the title relaunched, the world time (`target`), the memory stop (below), the `STOP` file, the time limit. So a `STOP` file and the world time at the same check give `target`. |
| 31 | - **Memory stop.** It also stops the run, the same clean way and with the reason `memory`, before memory runs out. A memory pile-up has taken a PC's whole Windows down, not only the device. It reads the runtime's memory lines (every 5 s, builds with diagnostics) and stops when: | ||
| 32 | - the game's private bytes pass `-StopPrivateMB` (default: the lower of 90 % of this PC's commit limit and 1.25 times its physical memory; with a large page file the limit is far above what a PC survives, and two Windows crashes came at about 100 GB private on a PC with 64 GB); | ||
| 33 | - the PC has less than `-StopCommitLeftMB` left to commit for 20 s (default: the larger of 128 MB and 0.25 % of the limit; on a PC with no page file a normal run can leave a few hundred MB); | ||
| 34 | - video memory stays over the system's budget for `-StopOverBudgetSeconds` (60). | ||
| 35 | |||
| 36 | 0 turns a limit off. The limits go into `run.json` (`memory_stop`) and the summary (`memory.stop_limits`). A run that reaches `-WorldSeconds` at the same check as a limit stops with `target`: it is a measurement, and its memory peaks are in the summary all the same. | ||
| 31 | - **How it stops.** With `WM_SYSCOMMAND`/`SC_CLOSE`, the runtime's own end: the title is suspended and the pipeline cache saved. It kills the game only if it has not ended 60 s later. | 37 | - **How it stops.** With `WM_SYSCOMMAND`/`SC_CLOSE`, the runtime's own end: the title is suspended and the pipeline cache saved. It kills the game only if it has not ended 60 s later. |
| 32 | - **Exit code.** 0 PASS, 1 FAIL, 2 ERROR. `start` exits when the detached run is created. | 38 | - **Exit code.** 0 PASS, 1 FAIL, 2 ERROR. `start` exits when the detached run is created. |
| 33 | 39 | ||
| @@ -44,6 +50,7 @@ The run folder (under `-RunRoot`, by default `<Data>\gate-runs`, refused inside | |||
| 44 | | `events.jsonl` | What the gate did and saw: the game found, the stop asked for and why, a kill, the exit code | | 50 | | `events.jsonl` | What the gate did and saw: the game found, the stop asked for and why, a kill, the exit code | |
| 45 | | `data\` | The run's copy of the template, and the runtime's `crashes.log` | | 51 | | `data\` | The run's copy of the template, and the runtime's `crashes.log` | |
| 46 | | `summary.json` | The result, below | | 52 | | `summary.json` | The result, below | |
| 53 | | `memory.csv` | One row per runtime memory line (every 5 s, builds with diagnostics): time, private bytes, of them in physical memory, the PC's memory free and left to commit, the card's video memory budget and in use, the shared memory in use, the objects let go that wait for their submissions, and the reaper thread's queue. Its header is `t_s,private_mb,in_memory_mb,pc_free_mb,pc_commit_left_mb,vram_budget_mb,vram_in_use_mb,shared_in_use_mb,waiting_objects,reaper_queue`. The video memory columns come from the video memory line nearest the memory line, and the last two from the census line nearest it, each within 2 s; a cell is empty when there is none. Only when the run has memory lines: a summary made again from a log without them removes an older `memory.csv` | | ||
| 47 | 54 | ||
| 48 | ## summary.json (`leonida-gate-summary/1`) | 55 | ## summary.json (`leonida-gate-summary/1`) |
| 49 | 56 | ||
| @@ -59,10 +66,10 @@ Times are seconds since the run started. The summary holds numbers, switch names | |||
| 59 | | `times.world_s` | Seconds from `world_at_s` to the stop request | | 66 | | `times.world_s` | Seconds from `world_at_s` to the stop request | |
| 60 | | `fps` | From the presents, after the first 60 s in the world: frames, median, p5, frame p95 (ms), median of the last 60 s (`end_median`), the first second with fewer than 2 frames, from 60 s in the world on too (`under_2_at_s`), the longest gap with no frame presented from the world on (`longest_present_gap_s`, `longest_gap_at_s`; on purpose from the world on: a freeze on pipeline compiles comes right after arrival, and 10 s with no frame is what a player sees), draws a frame. Without the present lines (a build without diagnostics), the median and p5 come from the frame lines, with a warning | | 67 | | `fps` | From the presents, after the first 60 s in the world: frames, median, p5, frame p95 (ms), median of the last 60 s (`end_median`), the first second with fewer than 2 frames, from 60 s in the world on too (`under_2_at_s`), the longest gap with no frame presented from the world on (`longest_present_gap_s`, `longest_gap_at_s`; on purpose from the world on: a freeze on pipeline compiles comes right after arrival, and 10 s with no frame is what a player sees), draws a frame. Without the present lines (a build without diagnostics), the median and p5 come from the frame lines, with a warning | |
| 61 | | `pipelines` | Waits that ran out (`missed_waits`), the most pipelines being made at once | | 68 | | `pipelines` | Waits that ran out (`missed_waits`), the most pipelines being made at once | |
| 62 | | `memory` | Peaks over the whole run, from the runtime's memory line and video memory line (every 5 s; builds with diagnostics only, otherwise `source` is null): the process's private bytes and when (`private_max_mb`, `private_max_at_s`), the most of them in physical memory, the least the PC had left to commit and when, the card's video memory in use at its most and when, with the budget the system gave then (`vram_in_use_max_mb`, `vram_max_at_s`, `vram_budget_at_max_mb`), the seconds spent over that budget, and the most of the PC's memory shared with the card in use. The video memory is what the system counts for this process, less than a tool like `nvidia-smi` shows for the whole card | | 69 | | `memory` | Peaks over the whole run, from the runtime's memory line and video memory line (every 5 s; builds with diagnostics only, otherwise `source` is null): the process's private bytes and when (`private_max_mb`, `private_max_at_s`), the most of them in physical memory, the least the PC had left to commit and when, the card's video memory in use at its most and when, with the budget the system gave then (`vram_in_use_max_mb`, `vram_max_at_s`, `vram_budget_at_max_mb`), the seconds spent over that budget, and the most of the PC's memory shared with the card in use. The video memory is what the system counts for this process, less than a tool like `nvidia-smi` shows for the whole card. `stop_limits` holds the memory stop's limits from `run.json` (null from a gate without the memory stop). Also, from the runtime's census line, the reaper thread's queue at its longest and when (`reaper_queue_max`, `reaper_queue_max_at_s`) and the most objects let go that wait for their submissions (`waiting_objects_max`); how fast the private bytes grew in the world in MB a minute (`private_mb_per_min_in_world`, a least-squares slope over the memory lines from `world_at_s` to the stop request: on a short run it is the loading's climb, on a long one a pile-up's slope; null with fewer than 3 lines there); and `series`, the name of `memory.csv` (null without memory lines, or when the file could not be written, for example open in another program: `game_gate.py` says so on stderr and writes `summary.json` all the same). The video memory peak and the time over the budget count every video memory line: the one written with each memory line, and the ones the runtime writes right before and after it makes the swap chain, right after the swap chain's buffers are made again for another size or format, and right after the system changes the card's budget by 256 MB or more. `memory.csv` has only the one nearest each memory line, so the summary's peak can come from a line with no row there | |
| 63 | | `crash` | `kind` is `none`, `device_lost`, `panic` or `fault`. It also gives the time, the code, the module kind (`runtime`, `title`, `driver`, `system`, `unknown`) and the access (read/write). `title_watchdog` marks a write at address 0 in the title more than 25 s after the last frame line. `count` is the number of crashes | | 70 | | `crash` | `kind` is `none`, `device_lost`, `panic` or `fault`. It also gives the time, the code, the module kind (`runtime`, `title`, `driver`, `system`, `unknown`) and the access (read/write). `title_watchdog` marks a write at address 0 in the title more than 25 s after the last frame line. `count` is the number of crashes | |
| 64 | | `exit` | The game's exit code, and its kind: `clean`, `device_lost` (0x887A0005), `killed` or `other` | | 71 | | `exit` | The game's exit code, and its kind: `clean`, `device_lost` (0x887A0005), `killed` or `other` | |
| 65 | | `stop` | Why it was stopped (`target`, `stop_file`, `timeout`, `relaunched`), whether it was killed, whether the cache was saved, whether the suspend was in time | | 72 | | `stop` | Why it was stopped (`target`, `stop_file`, `timeout`, `relaunched` or `memory`), whether it was killed, whether the cache was saved, whether the suspend was in time. After a memory stop, `memory_why` is the gate's whole sentence for it, with its numbers: `private bytes 31000 MB, over 30000 MB`, `the PC had under 200 MB left to commit for 25 s` or `video memory over its budget for 60 s`, for example. It is null for the other reasons | |
| 66 | | `verdict` | `result`, `reasons`, `warnings`, `min_world_s` | | 73 | | `verdict` | `result`, `reasons`, `warnings`, `min_world_s` | |
| 67 | 74 | ||
| 68 | ## The verdict | 75 | ## The verdict |
| @@ -81,6 +88,7 @@ Times are seconds since the run started. The summary holds numbers, switch names | |||
| 81 | - `exited_before_stop`; | 88 | - `exited_before_stop`; |
| 82 | - `present_gap`; | 89 | - `present_gap`; |
| 83 | - `world_time_short`: the time limit came first; | 90 | - `world_time_short`: the time limit came first; |
| 91 | - `memory_stop`: the memory stop ended the run, which was on its way to running out. `world_time_short` and `world_not_reached` are not added to it: the stop is why the run was short; | ||
| 84 | - `not_alive_at_stop`; | 92 | - `not_alive_at_stop`; |
| 85 | - `world_not_reached`, when the game ended before reaching the world. | 93 | - `world_not_reached`, when the game ended before reaching the world. |
| 86 | 94 | ||
| @@ -96,8 +104,6 @@ A crash after the stop request is a warning, except a device loss or a panic, wh | |||
| 96 | 104 | ||
| 97 | - A driver for the menus and a fixed route (a Lua mod). | 105 | - A driver for the menus and a fixed route (a Lua mod). |
| 98 | - An ABBA runner over several runs. | 106 | - An ABBA runner over several runs. |
| 99 | - A time series beside the summary (memory, census, reaping queue). | ||
| 100 | - A "memory rising" warning. | 107 | - A "memory rising" warning. |
| 101 | - VRAM and RAM peaks. | ||
| 102 | - The distance walked. | 108 | - The distance walked. |
| 103 | - The Vulkan runtime (`gta6rt`). | 109 | - The Vulkan runtime (`gta6rt`). |
diff --git a/docs/testing.md b/docs/testing.md index a5686330c..31ab93653 100644 --- a/docs/testing.md +++ b/docs/testing.md | |||
| @@ -144,10 +144,12 @@ python -I scripts/red_green.py <pull request number> | |||
| 144 | cherry-picked with a 3-way merge. A conflict, or a pull request that changes no test, is "red not constructible". | 144 | cherry-picked with a 3-way merge. A conflict, or a pull request that changes no test, is "red not constructible". |
| 145 | A hunk that mixes test and other code stays on the green side only. | 145 | A hunk that mixes test and other code stays on the green side only. |
| 146 | - It runs `cargo test --no-fail-fast` for the crates under `d3d12/crates` and `d3d12/apps` the pull request touches, | 146 | - It runs `cargo test --no-fail-fast` for the crates under `d3d12/crates` and `d3d12/apps` the pull request touches, |
| 147 | from `d3d12/` so the pinned toolchain applies. It also runs each changed `tests/**/test*.py` with unittest. Both | 147 | from `d3d12/` so the pinned toolchain applies. It also runs each changed `tests/**/test*.py` with unittest, after |
| 148 | sides run in one worktree with one cargo target dir, red first, under `<git common dir>/red-green` (`--work-dir` | 148 | removing the worktree's `__pycache__` folders so that no test runs stale bytecode. Both sides run in one worktree |
| 149 | to move it). The worktree and the target dir stay for the next run, which then builds only what changed. The | 149 | with one cargo target dir, red first, under `<git common dir>/red-green` (`--work-dir` to move it). The worktree |
| 150 | target dir takes several GB; delete the folder (and run `git worktree prune`) when done. | 150 | and the target dir stay for the next run, which then builds only what changed. The target dir takes several GB. |
| 151 | The worktree stays registered in git, in the default folder as with `--work-dir`: when done, run | ||
| 152 | `git worktree remove --force <folder>/tree` and delete the folder, or delete the folder and run `git worktree prune`. | ||
| 151 | - It prints the tests that go from red to green, those that pass on red and fail on green, those that fail on both | 153 | - It prints the tests that go from red to green, those that pass on red and fail on green, those that fail on both |
| 152 | (failing on `main` too), and those found on one side only. The verdict is one of: `red then green` (exit 0), | 154 | (failing on `main` too), and those found on one side only. The verdict is one of: `red then green` (exit 0), |
| 153 | `no red`, `red does not build`, `green fails`, `red not constructible`, `green not constructible`, `no tests ran`, | 155 | `no red`, `red does not build`, `green fails`, `red not constructible`, `green not constructible`, `no tests ran`, |
| @@ -157,6 +159,25 @@ python -I scripts/red_green.py <pull request number> | |||
| 157 | and the report says so; a second crash gives `compiler crashed`. Run it again later, or on another machine. | 159 | and the report says so; a second crash gives `compiler crashed`. Run it again later, or on another machine. |
| 158 | - `red does not build` is the case the fork-CI steps above call "does not build without the pull request's new | 160 | - `red does not build` is the case the fork-CI steps above call "does not build without the pull request's new |
| 159 | file": the test needs the new code, which does not show that it catches the bug. | 161 | file": the test needs the new code, which does not show that it catches the bug. |
| 162 | - `--mutate` also checks that the tests catch the change itself, what verifiers do by hand by removing a line of the | ||
| 163 | fix. After the green side, it undoes each hunk of the pull request's code alone (Rust and Python files it changes, | ||
| 164 | outside the tests and `#[cfg(test)]` code) and runs the tests again. A hunk is `caught` when a test that went red | ||
| 165 | then green fails, `not caught` when they all still pass, `does not build` when those tests no longer run, | ||
| 166 | `compiler crashed` when the compiler crashed twice, or `does not apply` when `main` moved those lines since. Each | ||
| 167 | mutation starts from the green tree, reset and cleaned, so what a test writes into the tree changes no other. It | ||
| 168 | tries at most `--mutate-max` hunks (10) and lists the others as `not tried, past --mutate-max` | ||
| 169 | (`mutations_skipped` in `--json`). A `not caught` hunk is code no new test looks at; it does not change the | ||
| 170 | verdict. | ||
| 171 | - Files the pull request adds are not mutated: undoing one would delete it, which only shows that something uses it. | ||
| 172 | The report lists them (`not mutated, added by the pull request`), so a fix whose code sits in a new file is not | ||
| 173 | read as covered. When no hunk is undone, the report says why: `nothing to undo` when the pull request changes no | ||
| 174 | Rust or Python code outside its tests (a test-only one, whose `no red` then says nothing against its test), or | ||
| 175 | `not run` when no test went red then green. `--json` has these in `mutations_not_run` and `added_not_mutated`. | ||
| 176 | - Each command of a mutated run (`cargo test`, one Python test file) is stopped with the processes it started after | ||
| 177 | `--mutate-timeout` seconds (600). The hunk is then `caught by timeout` when a test was running (the undone code | ||
| 178 | made it hang), or `timed out building` when cargo had not started a test yet, which says nothing about the tests | ||
| 179 | (raise the option for a crate that builds slowly). When the command ends, the processes it left behind are | ||
| 180 | stopped too (a Windows job object, the process group elsewhere). | ||
| 160 | - `--crate <name>` adds a crate, `--no-cargo` or `--no-python` leaves one kind out, `--base <ref>` tests on another | 181 | - `--crate <name>` adds a crate, `--no-cargo` or `--no-python` leaves one kind out, `--base <ref>` tests on another |
| 161 | base, and `--no-fetch` uses the refs as they are. | 182 | base, and `--no-fetch` uses the refs as they are. |
| 162 | 183 | ||