diff options
| author | Zack <zmasi21@gmail.com> | 2026-11-28 01:32:59 -0800 |
|---|---|---|
| committer | Zack <zmasi21@gmail.com> | 2026-11-28 01:32:59 -0800 |
| commit | 126058daed271ea3f8497541cd2e12fc31ab3067 (patch) | |
| tree | d76dd55bbb3a316b025fdddda928b1f85b89c15b /docs/testing.md | |
| parent | 67ec1d35afaa9300e0e725dbbc06e7c851496841 (diff) | |
| parent | 3ca0707ddec7fd868ecd6df924d751901102fd9c (diff) | |
Merge remote-tracking branch 'origin/main' into results/gpu-vega20-radv
Diffstat (limited to 'docs/testing.md')
| -rw-r--r-- | docs/testing.md | 128 |
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 | |||
| 16 | The shortest path from a fresh Windows PC to a result you can post. The rest of this page has the details and the | ||
| 17 | problems testers have hit; the steps below link to them. | ||
| 18 | |||
| 19 | 1. 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. | ||
| 27 | 2. 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`. | ||
| 39 | 3. 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. | ||
| 54 | 4. 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 | |||
| 63 | 5. 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 | |||
| 67 | A `FAIL` is worth reporting, not a reason to stop: check [Known problems](#known-problems) first, and say in the | ||
| 68 | record whether it matched a row there. | ||
| 69 | |||
| 70 | ### Testing someone else's pull request | ||
| 71 | |||
| 72 | Once your GPU has a record, testing open pull requests on it helps more than a second record: review and testing | ||
| 73 | are what most pull requests wait for. Pick one that changes the translator, the runtime or a GPU test, then: | ||
| 74 | |||
| 75 | ```powershell | ||
| 76 | git fetch origin pull/<N>/head:pr-<N> | ||
| 77 | git checkout pr-<N> | ||
| 78 | powershell -ExecutionPolicy Bypass -File scripts\build_runtime.ps1 # always rebuild after switching | ||
| 79 | python -I scripts\run_gpu_tests.py # add --filter <name> for the tests it touches | ||
| 80 | ``` | ||
| 81 | |||
| 82 | Run `main` the same way for comparison (`git checkout main`, rebuild, run). Then comment on the pull request with | ||
| 83 | one line per mode, in the form `<GPU>, <driver>, Windows <build>: X of Y passed, K skipped, F failed (native); | ||
| 84 | main 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 | |||
| 132 | To 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) | ||
| 136 | python -I scripts/smoke.py --prereqs-only | ||
| 137 | |||
| 138 | # Fast source-only smoke suite (< 1 second) | ||
| 139 | python -I scripts/smoke.py --quick | ||
| 140 | |||
| 141 | # Full synthetic smoke validation (compileall, no-game-data, CLI help, unit tests) | ||
| 142 | python -I scripts/smoke.py | ||
| 143 | |||
| 144 | # Machine-readable output for scripts and CI | ||
| 145 | python -I scripts/smoke.py --json | ||
| 146 | |||
| 147 | # Also available through the unified developer entry point | ||
| 148 | python -I scripts/dev.py smoke --quick | ||
| 149 | ``` | ||
| 150 | |||
| 151 | Exit 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 | ||
| 60 | On a Windows runtime build with Vulkan enabled, CMake only registers `d3d12_translated_draw`, `d3d12_rect_list`, | 158 | On 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 | ||
| 339 | The `Runtime` workflow uploads `runtime-windows` for seven days. It contains the Windows executables, DLLs, | 437 | The [Runtime workflow](https://github.com/ubiquitarianism/leonida/actions/workflows/runtime.yml) uploads |
| 438 | `runtime-windows` for seven days. It contains the Windows executables, DLLs, | ||
| 340 | synthetic test shaders, CTest inventory and the path of the Windows checkout. From a clean checkout of the commit | 439 | synthetic test shaders, CTest inventory and the path of the Windows checkout. From a clean checkout of the commit |
| 341 | used by the Windows job, set `run_id` to the Actions run ID and download the artifact to `runtime/build`: | 440 | used 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 |
| 344 | gh run download "$run_id" --repo ItsNotRexed/Leonida --name runtime-windows --dir runtime/build | 443 | gh run download "$run_id" --repo ubiquitarianism/leonida --name runtime-windows --dir runtime/build |
| 345 | 444 | ||
| 346 | WINE=wine WINEPREFIX="$(mktemp -d)" WINEDLLOVERRIDES="mscoree,mshtml=" WINEDEBUG=-all \ | 445 | WINE=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 |
| 575 | constants, so those tests skip. | 674 | constants, 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 | ||
| 679 | shaders with `--mesh-serial-waves` (`docs/design.md`, "Mesh shaders with their waves in series"): the ones that | ||
| 680 | qualify 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 | ||
| 579 | Without `VK_EXT_mesh_shader`, the `ms_*` tests are skipped; that's expected, not a failure. To test the path that | 685 | Without `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 |
| 622 | 26.0.3, [measured by @TreXito](https://github.com/ItsNotRexed/Leonida/pull/3838#issuecomment-7086696759), with a 42-line reduced | 728 | 26.0.3, [measured by @TreXito](https://github.com/ItsNotRexed/Leonida/pull/3838#issuecomment-7086696759), with a 42-line reduced |
| 623 | reproducer). llvmpipe is not a substitute for a result from a | 729 | reproducer). llvmpipe is not a substitute for a result from a |
| 624 | real GPU in [#166](https://github.com/ItsNotRexed/Leonida/issues/166): it catches regressions, not hardware | 730 | real GPU in [gpu-test-results/](../gpu-test-results/): it catches regressions, not hardware |
| 625 | differences. | 731 | differences. |
| 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 | |||
| 736 | its CPU model; add `--negative-control` to check that wrong models are caught. A gfx1150 (RDNA3.5) is not RDNA2: a | 842 | its CPU model; add `--negative-control` to check that wrong models are caught. A gfx1150 (RDNA3.5) is not RDNA2: a |
| 737 | match supports the model and does not prove RDNA2. Run these one at a time: a second job on the same GPU can hang it. | 843 | match 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 | ||
| 848 | a native AMD GPU produced (`--oracle hw,vk`). `tools/vk_model_fuzz.py` runs the same programs, for the same seed, on | ||
| 849 | whatever Vulkan GPU you have and judges them against the fuzzer's reference model instead: | ||
| 850 | |||
| 851 | ```sh | ||
| 852 | python -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 | ||
| 856 | 0 when every judged program matched, 1 on a mismatch (the first few programs are printed), 2 when `vk_compute_test` is | ||
| 857 | missing and 77 when nothing could be judged. A program the model declines counts as a skip. A mismatch here is the GPU | ||
| 858 | disagreeing with the model, which is a driver difference, a translator bug or a model bug: re-read the program with | ||
| 859 | the fuzzer itself (`pk16_diff.py --seed S --programs N`) before reporting it. | ||
| 860 | |||
| 739 | ## Choosing the GPU | 861 | ## Choosing the GPU |
| 740 | 862 | ||
| 741 | With more than one GPU, pick one through the Vulkan loader, for example | 863 | With more than one GPU, pick one through the Vulkan loader, for example |