upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/testing.md
diff options
context:
space:
mode:
authorZack <zmasi21@gmail.com>2026-11-28 01:32:59 -0800
committerZack <zmasi21@gmail.com>2026-11-28 01:32:59 -0800
commit126058daed271ea3f8497541cd2e12fc31ab3067 (patch)
treed76dd55bbb3a316b025fdddda928b1f85b89c15b /docs/testing.md
parent67ec1d35afaa9300e0e725dbbc06e7c851496841 (diff)
parent3ca0707ddec7fd868ecd6df924d751901102fd9c (diff)
Merge remote-tracking branch 'origin/main' into results/gpu-vega20-radv
Diffstat (limited to 'docs/testing.md')
-rw-r--r--docs/testing.md128
1 files changed, 125 insertions, 3 deletions
diff --git a/docs/testing.md b/docs/testing.md
index 671c5548c..3e1ad6935 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -11,6 +11,78 @@ This page collects the setup steps and the problems testers have run into so far
11 11
12[claims]: https://github.com/ubiquitarianism/leonida/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22 12[claims]: https://github.com/ubiquitarianism/leonida/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22
13 13
14## Quick start on Windows
15
16The shortest path from a fresh Windows PC to a result you can post. The rest of this page has the details and the
17problems testers have hit; the steps below link to them.
18
191. Install, in this order:
20 - Visual Studio 2022 (Community or Build Tools) with "Desktop development with C++", the "C++ CMake tools for
21 Windows" component and Windows SDK 10.0.26100 or newer.
22 - The [Vulkan SDK](https://vulkan.lunarg.com/). It sets `VULKAN_SDK` and puts `spirv-as`, `spirv-val`,
23 `glslangValidator` and `vulkaninfo` on `PATH`.
24 - [Python 3.12+](https://www.python.org/downloads/), with "Add python.exe to PATH" ticked, and git.
25 - Optional but needed for the full suite: `llvm-mc` with the AMDGPU target (see [What you need](#what-you-need)).
26 `powershell -ExecutionPolicy Bypass -File scripts\build_llvm_mc.ps1` builds one and sets `LLVM_MC` for you.
272. Open a new PowerShell window (so it sees the new `PATH`), clone the repository and build the test programs:
28
29 ```powershell
30 git clone --recursive https://github.com/ubiquitarianism/leonida
31 cd leonida
32 powershell -ExecutionPolicy Bypass -File scripts\build_runtime.ps1
33 ```
34
35 The script uses the newest Visual Studio it finds. If Visual Studio 2026 is also installed and the link step
36 fails there, build from a "Developer PowerShell for VS 2022" instead:
37 `cmake -S runtime -B runtime\build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON`, then
38 `cmake --build runtime\build`.
393. Run the suite twice, once as your GPU runs it and once with wave64 emulation (this matters on NVIDIA and Intel,
40 whose subgroups are 32 wide, see [GPUs with 32-wide subgroups](#gpus-with-32-wide-subgroups-nvidia-intel-apple)):
41
42 ```powershell
43 python -I scripts\run_gpu_tests.py
44 $env:LEONIDA_W64_EMULATE = "1"; python -I scripts\run_gpu_tests.py; Remove-Item Env:LEONIDA_W64_EMULATE
45 ```
46
47 Without `llvm-mc`, add `--disasm-dir tests/semantic/fixtures/disasm` to both commands. That runs the
48 pre-disassembled subset only, so say "subset" in your result.
49
50 Using a prebuilt `runtime-windows` artifact instead of building? Check out the commit that built it and read
51 this page at that commit (see [Without a compiler](#without-a-compiler-a-ci-built-runtime)): an older
52 `run_gpu_tests.py` may not take every option shown here. `python -I scripts\run_gpu_tests.py --help`, run from
53 that checkout, lists the options it does take.
544. Collect what the record needs:
55
56 ```powershell
57 git rev-parse HEAD # the commit you built
58 vulkaninfo --summary # GPU name, driver version, Vulkan version
59 python -I tools\vk_subgroup_info.py # subgroup range (min_subgroup_size, max_subgroup_size)
60 cmd /c ver # Windows build
61 ```
62
635. Copy a Windows file in [`gpu-test-results/`](../gpu-test-results) (`RTX3060Ti-Windows.txt` is a complete one), fill
64 in your GPU, driver, subgroup range, OS build, commit, tool versions and the last line each run printed
65 (`N/M passed, K skipped`), and list every `FAIL` line. Then follow [Posting your result](#posting-your-result).
66
67A `FAIL` is worth reporting, not a reason to stop: check [Known problems](#known-problems) first, and say in the
68record whether it matched a row there.
69
70### Testing someone else's pull request
71
72Once your GPU has a record, testing open pull requests on it helps more than a second record: review and testing
73are what most pull requests wait for. Pick one that changes the translator, the runtime or a GPU test, then:
74
75```powershell
76git fetch origin pull/<N>/head:pr-<N>
77git checkout pr-<N>
78powershell -ExecutionPolicy Bypass -File scripts\build_runtime.ps1 # always rebuild after switching
79python -I scripts\run_gpu_tests.py # add --filter <name> for the tests it touches
80```
81
82Run `main` the same way for comparison (`git checkout main`, rebuild, run). Then comment on the pull request with
83one line per mode, in the form `<GPU>, <driver>, Windows <build>: X of Y passed, K skipped, F failed (native);
84main at <commit>: ...`, plus any `FAIL` lines that differ from `main`.
85
14## What you need 86## What you need
15 87
16- **Python 3.12+**, which `make_game.py` requires (it stops with "Python 3.12 or newer is needed" on an older one, so 88- **Python 3.12+**, which `make_game.py` requires (it stops with "Python 3.12 or newer is needed" on an older one, so
@@ -55,6 +127,32 @@ This page collects the setup steps and the problems testers have run into so far
55 - macOS: `brew install llvm molten-vk vulkan-headers vulkan-loader spirv-tools vulkan-tools`. The test programs 127 - macOS: `brew install llvm molten-vk vulkan-headers vulkan-loader spirv-tools vulkan-tools`. The test programs
56 load MoltenVK directly; set `LEONIDA_VULKAN_LOADER` to use the Vulkan loader instead. 128 load MoltenVK directly; set `LEONIDA_VULKAN_LOADER` to use the Vulkan loader instead.
57 129
130## Source-only smoke verification (DX-07)
131
132To verify a checkout quickly on any platform without game files, retail binaries, or hardware prerequisites:
133
134```bash
135# Standard-library sanity and toolchain discovery (Windows, Linux, macOS)
136python -I scripts/smoke.py --prereqs-only
137
138# Fast source-only smoke suite (< 1 second)
139python -I scripts/smoke.py --quick
140
141# Full synthetic smoke validation (compileall, no-game-data, CLI help, unit tests)
142python -I scripts/smoke.py
143
144# Machine-readable output for scripts and CI
145python -I scripts/smoke.py --json
146
147# Also available through the unified developer entry point
148python -I scripts/dev.py smoke --quick
149```
150
151Exit codes:
152- `0`: all requested synthetic checks passed.
153- `1`: one or more synthetic checks or tests failed.
154- `2`: required environment prerequisites missing (e.g., Python < 3.10) or invalid options.
155
58## Build the test programs 156## Build the test programs
59 157
60On a Windows runtime build with Vulkan enabled, CMake only registers `d3d12_translated_draw`, `d3d12_rect_list`, 158On a Windows runtime build with Vulkan enabled, CMake only registers `d3d12_translated_draw`, `d3d12_rect_list`,
@@ -336,12 +434,13 @@ of those fail for that reason.
336 434
337### Run a Windows CI artifact under Wine 435### Run a Windows CI artifact under Wine
338 436
339The `Runtime` workflow uploads `runtime-windows` for seven days. It contains the Windows executables, DLLs, 437The [Runtime workflow](https://github.com/ubiquitarianism/leonida/actions/workflows/runtime.yml) uploads
438`runtime-windows` for seven days. It contains the Windows executables, DLLs,
340synthetic test shaders, CTest inventory and the path of the Windows checkout. From a clean checkout of the commit 439synthetic test shaders, CTest inventory and the path of the Windows checkout. From a clean checkout of the commit
341used by the Windows job, set `run_id` to the Actions run ID and download the artifact to `runtime/build`: 440used by the Windows job, set `run_id` to the Actions run ID and download the artifact to `runtime/build`:
342 441
343```sh 442```sh
344gh run download "$run_id" --repo ItsNotRexed/Leonida --name runtime-windows --dir runtime/build 443gh run download "$run_id" --repo ubiquitarianism/leonida --name runtime-windows --dir runtime/build
345 444
346WINE=wine WINEPREFIX="$(mktemp -d)" WINEDLLOVERRIDES="mscoree,mshtml=" WINEDEBUG=-all \ 445WINE=wine WINEPREFIX="$(mktemp -d)" WINEDLLOVERRIDES="mscoree,mshtml=" WINEDEBUG=-all \
347 bash scripts/run_wine_session.sh python3 -I scripts/run_wine_tests.py \ 446 bash scripts/run_wine_session.sh python3 -I scripts/run_wine_tests.py \
@@ -574,6 +673,13 @@ only for `check.py`, the shaders read the tail from push constants the programs
574(`LEONIDA_MESH_COMPUTE=1`) isn't combined with it yet: its vertex shader still reads the output address from push 673(`LEONIDA_MESH_COMPUTE=1`) isn't combined with it yet: its vertex shader still reads the output address from push
575constants, so those tests skip. 674constants, so those tests skip.
576 675
676## Mesh shaders with their waves in series
677
678`LEONIDA_MESH_SERIAL_WAVES=1` for `run_gpu_tests.py`, together with `LEONIDA_W64_EMULATE=1`, translates the mesh
679shaders with `--mesh-serial-waves` (`docs/design.md`, "Mesh shaders with their waves in series"): the ones that
680qualify run one pass per wave in 64 invocations. The `ms_*` tests must pass with and without it;
681`ms_w64x_wave_votes` is the one whose two waves take different branches and both give the triangle a vertex. `ms_w64x_wave_loops` is the one whose two waves run a loop of different length (5 and 9 iterations), each iteration reading a wave-wide count, so under emulation the waves reach different numbers of barriers.
682
577## GPUs without mesh shaders (NVIDIA Pascal and older) 683## GPUs without mesh shaders (NVIDIA Pascal and older)
578 684
579Without `VK_EXT_mesh_shader`, the `ms_*` tests are skipped; that's expected, not a failure. To test the path that 685Without `VK_EXT_mesh_shader`, the `ms_*` tests are skipped; that's expected, not a failure. To test the path that
@@ -621,7 +727,7 @@ constant `false` there instead makes the emulated `ms_tri` draw a frame byte-ide
621`ms_tri`, `ms_wave_info_s3`, `ms_w64x_ballot` and `ms_v5_workgroup` byte-identical to NVIDIA's at both widths (Mesa 727`ms_tri`, `ms_wave_info_s3`, `ms_w64x_ballot` and `ms_v5_workgroup` byte-identical to NVIDIA's at both widths (Mesa
62226.0.3, [measured by @TreXito](https://github.com/ItsNotRexed/Leonida/pull/3838#issuecomment-7086696759), with a 42-line reduced 72826.0.3, [measured by @TreXito](https://github.com/ItsNotRexed/Leonida/pull/3838#issuecomment-7086696759), with a 42-line reduced
623reproducer). llvmpipe is not a substitute for a result from a 729reproducer). llvmpipe is not a substitute for a result from a
624real GPU in [#166](https://github.com/ItsNotRexed/Leonida/issues/166): it catches regressions, not hardware 730real GPU in [gpu-test-results/](../gpu-test-results/): it catches regressions, not hardware
625differences. 731differences.
626 732
627## Macs in CI 733## Macs in CI
@@ -736,6 +842,22 @@ exits 77, so CI skips it. `image_fuzz.py --oracle hw` loads a linear texture thr
736its CPU model; add `--negative-control` to check that wrong models are caught. A gfx1150 (RDNA3.5) is not RDNA2: a 842its CPU model; add `--negative-control` to check that wrong models are caught. A gfx1150 (RDNA3.5) is not RDNA2: a
737match supports the model and does not prove RDNA2. Run these one at a time: a second job on the same GPU can hang it. 843match supports the model and does not prove RDNA2. Run these one at a time: a second job on the same GPU can hang it.
738 844
845## Model oracle on any Vulkan GPU (no AMD hardware)
846
847`pk16_diff.py`, `vint_diff.py` and `sdwa_diff.py` judge their translated programs on a Vulkan GPU only against the words
848a native AMD GPU produced (`--oracle hw,vk`). `tools/vk_model_fuzz.py` runs the same programs, for the same seed, on
849whatever Vulkan GPU you have and judges them against the fuzzer's reference model instead:
850
851```sh
852python -I tools/vk_model_fuzz.py pk16_diff --programs 1500 --seed 11 --build runtime/build
853```
854
855`--build` is the folder with `vk_compute_test`; `llvm-mc` with the AMDGPU target is needed as for `valu_fuzz.py`. It exits
8560 when every judged program matched, 1 on a mismatch (the first few programs are printed), 2 when `vk_compute_test` is
857missing and 77 when nothing could be judged. A program the model declines counts as a skip. A mismatch here is the GPU
858disagreeing with the model, which is a driver difference, a translator bug or a model bug: re-read the program with
859the fuzzer itself (`pk16_diff.py --seed S --programs N`) before reporting it.
860
739## Choosing the GPU 861## Choosing the GPU
740 862
741With more than one GPU, pick one through the Vulkan loader, for example 863With more than one GPU, pick one through the Vulkan loader, for example