diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 22:35:34 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 22:35:34 -0500 |
| commit | 6ed716a99a7416f1e8a60c2e38e128876ab752ec (patch) | |
| tree | 3c35526aa8b96594252c82c278ab19b9aa3a98ba /docs/testing.md | |
| parent | 028a414fade7058a96e5933d1325f374a0026588 (diff) | |
| parent | bfef489cb6307fa4e1dc6ed2c40bfc0ce120d066 (diff) | |
Merge main into RT-QUEUE-SIGNAL (#430)
Everything below this rung (#414, #416, #427) and the rung's own routing are in
main already, through #984 and #939, in main's form; what is left of #430 is
its test of queue slot 17, ported onto main's layout detection.
Conflicts, all resolved to main's form:
- runtime/shims/d3d12_xs_device.cpp: main's queue slot 16/17 rule (a fence
there is the newer layout's Signal/Wait, for any caller) replaces the
rung's caller-gated rule; main's PresentX routing (slot 30, or 32 once the
newer layout is detected, LEONIDA_XS_PRESENT_X_SLOT) and lazily built
presenter replace the fixed slot 32 of #414; main's list proxy already
translates the CPU handles of console list slots 50 to 54 (#416) and
drops unordered access from a depth-stencil texture at slot 76 (#427).
- runtime/shims/d3d12_xs_device.h, runtime/shims/xbox_present.cpp,
runtime/shims/xbox_present.h, runtime/src/frame_pacer.h: main's shared
FrameTokenSource (Logan's piece of #414, as #984 carried it).
- runtime/shims/d3d12_xs_desc_clean.h, runtime/test/device_proxy_test.cpp:
main's without_depth_stencil_uav and its slot 25/76 test (#427).
- runtime/test/xs_proxy_mock_test.cpp: main's file, which already has
check_list_cpu_handles (#416's cases and more); the rung's slot 16/17 case
is ported to main's form at the end of check_xbox_queue_slots: slot 16 and
17 with a fence reach PC Signal and Wait with the real fence, not the PC
getters, and the fence proxy's vtable pointer is unchanged. The rung's
host-caller and no-fence expectations are dropped: under main's rule a
fence at 16 proves the newer layout, after which those calls answer S_OK.
Auto-merged, then set to main's content:
- runtime/test/queue_proxy_test.cpp: #414's call of queue slot 32 as an
overridden slot; on main slot 32 is routed only on the newer layout and the
sweep of the console tail already calls it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docs/testing.md')
| -rw-r--r-- | docs/testing.md | 232 |
1 files changed, 195 insertions, 37 deletions
diff --git a/docs/testing.md b/docs/testing.md index 743d7b640..ffe729d24 100644 --- a/docs/testing.md +++ b/docs/testing.md | |||
| @@ -2,13 +2,14 @@ | |||
| 2 | 2 | ||
| 3 | The GPU tests are small hand-written RDNA2 programs in `runtime/test/shaders`. They are translated to SPIR-V and run | 3 | The GPU tests are small hand-written RDNA2 programs in `runtime/test/shaders`. They are translated to SPIR-V and run |
| 4 | on your GPU, and the results are compared with what the RDNA2 hardware gives. They need no game files, and every | 4 | on your GPU, and the results are compared with what the RDNA2 hardware gives. They need no game files, and every |
| 5 | result helps: post it in [#166](https://github.com/ItsNotRexed/Leonida/issues/166), one comment per GPU and driver. | 5 | result helps: submit a pull request adding a record under [`gpu-test-results/`](../gpu-test-results), following |
| 6 | the existing files there and [CONTRIBUTING.md](../CONTRIBUTING.md). | ||
| 6 | If your GPU is already covered there, testing an open pull request from the review queue in the [coordination | 7 | If your GPU is already covered there, testing an open pull request from the review queue in the [coordination |
| 7 | issue][claims] helps more. | 8 | issue][claims] helps more. |
| 8 | 9 | ||
| 9 | This page collects the setup steps and the problems testers have run into so far. | 10 | This page collects the setup steps and the problems testers have run into so far. |
| 10 | 11 | ||
| 11 | [claims]: https://github.com/ItsNotRexed/Leonida/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22 | 12 | [claims]: https://github.com/ubiquitarianism/leonida/issues/14 |
| 12 | 13 | ||
| 13 | ## What you need | 14 | ## What you need |
| 14 | 15 | ||
| @@ -55,9 +56,9 @@ This page collects the setup steps and the problems testers have run into so far | |||
| 55 | 56 | ||
| 56 | ## Build the test programs | 57 | ## Build the test programs |
| 57 | 58 | ||
| 58 | On a Windows runtime build with Vulkan enabled, CMake only registers `d3d12_translated_draw`, `d3d12_m2_textured`, | 59 | On a Windows runtime build with Vulkan enabled, CMake only registers `d3d12_translated_draw`, `d3d12_rect_list`, |
| 59 | `d3d12_m2_formats`, `d3d12_m3_frame`, `d3d12_m4_compute` and `d3d12_buffer_uav` when it finds `llvm-mc`, | 60 | `d3d12_quad_index`, `d3d12_m2_textured`, `d3d12_m2_formats`, `d3d12_m3_frame`, `d3d12_m4_compute` and |
| 60 | `spirv-as` and `spirv-val`. It registers `d3d12_subgroup` only when it finds `llvm-mc` and `glslangValidator`. | 61 | `d3d12_buffer_uav` when it finds `llvm-mc`, `spirv-as` and `spirv-val`. It registers `d3d12_subgroup` only when it finds `llvm-mc` and `glslangValidator`. |
| 61 | Without `glslangValidator`, other tests are also omitted, including `d3d12_compute`, `d3d12_draw`, | 62 | Without `glslangValidator`, other tests are also omitted, including `d3d12_compute`, `d3d12_draw`, |
| 62 | `d3d12_set0_compute` and `d3d12_mesh`; some registered tests run only part of their checks. These tests can be | 63 | `d3d12_set0_compute` and `d3d12_mesh`; some registered tests run only part of their checks. These tests can be |
| 63 | **absent**, not reported as skipped, when their build prerequisites are missing, so a passing `ctest` percentage | 64 | **absent**, not reported as skipped, when their build prerequisites are missing, so a passing `ctest` percentage |
| @@ -143,7 +144,7 @@ Write-Output "Test exit code: $LASTEXITCODE" | |||
| 143 | ``` | 144 | ``` |
| 144 | 145 | ||
| 145 | Report the executable name, the workflow run and its commit, your GPU and driver, | 146 | Report the executable name, the workflow run and its commit, your GPU and driver, |
| 146 | the exit code, and the test summary in [#166](https://github.com/ItsNotRexed/Leonida/issues/166). | 147 | the exit code, and the test summary in your `gpu-test-results/` record. |
| 147 | Label it as a single-test run so the result is easy to distinguish from a full suite run. | 148 | Label it as a single-test run so the result is easy to distinguish from a full suite run. |
| 148 | 149 | ||
| 149 | ## Run them | 150 | ## Run them |
| @@ -170,17 +171,26 @@ python -I runtime/test/shaders/build.py <out dir> | |||
| 170 | python -I runtime/test/shaders/check.py <out dir> <folder with the test programs> | 171 | python -I runtime/test/shaders/check.py <out dir> <folder with the test programs> |
| 171 | ``` | 172 | ``` |
| 172 | 173 | ||
| 173 | For the standalone `v_mullit_f32` readback, build the full-screen triangle and the | 174 | For D3D12/runtime tests, `LEONIDA_VK_VALIDATION=1` enables `VK_LAYER_KHRONOS_validation`. When running with validation, set `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` if MSI Afterburner (RivaTuner) or OBS is installed: their overlay layers can add unsupported swapchain usage, and in an elevated (administrator) terminal the loader ignores `VK_LOADER_LAYERS_DISABLE=~implicit~` (see "Known problems"). |
| 174 | hand-written semantic fixture, then run 120 draws with runtime SGPR inputs. | ||
| 175 | The driver checks every pixel against an integer product rounded to 24 bits. | ||
| 176 | It reports the input words, pixel and channel on the first mismatch. | ||
| 177 | 175 | ||
| 178 | ```sh | 176 | On Windows, `run_gpu_tests.py` assembles and translates the D3D-78 fixture and runs the UAV readback and WARP |
| 179 | python -I runtime/test/shaders/build.py <out-dir> vs_ids ps_mullit | 177 | comparison from the same build folder. Use `--filter cs_texture_uav` to run only this case: |
| 180 | python -I runtime/test/shaders/mullit_readback.py <out-dir> <harness-directory> | 178 | |
| 179 | ```powershell | ||
| 180 | $env:LEONIDA_VK_VALIDATION = "1" | ||
| 181 | python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_texture_uav | ||
| 181 | ``` | 182 | ``` |
| 182 | 183 | ||
| 183 | For D3D12/runtime tests, `LEONIDA_VK_VALIDATION=1` enables `VK_LAYER_KHRONOS_validation`. When running with validation, set `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` if MSI Afterburner (RivaTuner) or OBS is installed: their overlay layers can add unsupported swapchain usage, and in an elevated (administrator) terminal the loader ignores `VK_LOADER_LAYERS_DISABLE=~implicit~` (see "Known problems"). | 184 | Use the actual configuration subfolder for the executables with a multi-config generator. The native Windows |
| 185 | case reports SKIP without WARP or a sufficiently capable Vulkan device; failed translation, a missing test | ||
| 186 | executable on Windows, and readback mismatches fail the runner. Devices without sliced 3D views still run the 1D, | ||
| 187 | array and whole-mip cases and check that partial views are refused. | ||
| 188 | |||
| 189 | CTest runs the same D3D-78 descriptor creation, copy, range/refusal and clear checks with `--descriptors-only`. | ||
| 190 | That mode requires Vulkan, but not a translated shader or WARP. The GPU runner still exercises dispatch and readback. | ||
| 191 | |||
| 192 | Use `--filter cs_imgload_mip` to check 2D `image_load_mip` on FLOAT (UNORM), UINT and SINT sampled views with | ||
| 193 | both full-width and D16 loads; mip 0 contains decoy data and mip 1 holds the expected texels. | ||
| 184 | 194 | ||
| 185 | `vk_compute_test`, `vk_bindless_test` and `vk_image_fuzz` read `LEONIDA_VK_VALIDATION` too (`vk_compute_test` | 195 | `vk_compute_test`, `vk_bindless_test` and `vk_image_fuzz` read `LEONIDA_VK_VALIDATION` too (`vk_compute_test` |
| 186 | through `runtime/test/vk_validation.h`): each validation message goes to stderr and a validation error makes the | 196 | through `runtime/test/vk_validation.h`): each validation message goes to stderr and a validation error makes the |
| @@ -227,6 +237,49 @@ and `vk_presenter_sync`, `xbox_present` and `dxgi_swapchain` pass, while they fa | |||
| 227 | compositor for those three. Six still failed with a real display: `device_proxy`, `d3d12_xs_root_signature`, | 237 | compositor for those three. Six still failed with a real display: `device_proxy`, `d3d12_xs_root_signature`, |
| 228 | `xdxr_build`, `d3d12_xdxr_rt`, `d3d12_present` and `d3d12_compute`. | 238 | `xdxr_build`, `d3d12_xdxr_rt`, `d3d12_present` and `d3d12_compute`. |
| 229 | 239 | ||
| 240 | Run one after another as above, the suite takes several seconds per test, although a test started by hand takes 0.1 to | ||
| 241 | 1 second. Four settings make a local run of the cross-build much faster: | ||
| 242 | |||
| 243 | ```sh | ||
| 244 | export WINEPREFIX="$HOME/.local/share/leonida-wine" WINEDEBUG=-all \ | ||
| 245 | WINEDLLOVERRIDES="winedbg.exe=d;winemenubuilder.exe=d" | ||
| 246 | mkdir -p "$WINEPREFIX" | ||
| 247 | xvfb-run -a sh -c 'wineserver -p; wine wineboot -u </dev/null >/dev/null 2>&1 | ||
| 248 | ctest --test-dir runtime/build/windows -j 6 --timeout 120; wineserver -k' | ||
| 249 | ``` | ||
| 250 | |||
| 251 | Start the server before `wineboot`: `wineserver -p` does nothing while another server runs for the prefix. Run | ||
| 252 | `wineboot` after it, with its output thrown away: the first Wine program a server runs starts the prefix's services, | ||
| 253 | which keep that program's output open for as long as the server lives, so a first test that started them would wait | ||
| 254 | for the end of its output until the timeout. | ||
| 255 | |||
| 256 | - `wineserver -p` keeps one Wine server for the whole run; without it a new one starts for each test. | ||
| 257 | - `winedbg.exe=d`: a test that crashes otherwise waits in Wine's debugger until its timeout. | ||
| 258 | - `winemenubuilder.exe=d`: without it `wineboot` on a fresh prefix writes `wine-extension-*.desktop` files and the MIME | ||
| 259 | cache into `~/.local/share/applications`, pointing your file associations at the test prefix. Set it before the | ||
| 260 | prefix is first made. | ||
| 261 | - `ctest -j 6` runs six tests at a time. The tests that share files under the temp directory (see "Known problems") | ||
| 262 | can then fail now and then; rerun such a failure on its own before you count it. | ||
| 263 | |||
| 264 | Measured with Wine 11.22 on llvmpipe, 40 tests of a clang-cl build (`ctest -R '^(d3d12_[a-c]|vk_[a-d]|xg)'`), adding | ||
| 265 | one setting at a time: | ||
| 266 | |||
| 267 | | Settings | Seconds | | ||
| 268 | |---|---| | ||
| 269 | | As above: one test after another | 179 | | ||
| 270 | | `wineserver -p` (and `wineboot` after it) | 35 | | ||
| 271 | | and `WINEDEBUG=-all` | 35 | | ||
| 272 | | and `winedbg.exe=d` | 35 | | ||
| 273 | | and `ctest -j 6` | 5.6 | | ||
| 274 | | `ctest -j 6` and the overrides, without `wineserver -p` | 18 | | ||
| 275 | |||
| 276 | The kept server is most of it: a test that takes 0.05 seconds with it took about 3.4 without, the time of a server | ||
| 277 | starting and stopping. `WINEDEBUG=-all` and `winedbg.exe=d` changed nothing here because no test crashed; with a crash, | ||
| 278 | `winedbg.exe=d` saves the rest of that test's timeout. The full suite (about 310 tests) took about 28 minutes run one | ||
| 279 | after another, and 67 seconds with all four settings for two devices (llvmpipe and an integrated GPU) run at the same | ||
| 280 | time. `scripts/run_wine_tests.py` (below) does the same: 32 seconds for those 40 tests with `--jobs 1`, 6 with | ||
| 281 | `--jobs 6`, and 19 seconds for all 312 tests with `--jobs 6`. | ||
| 282 | |||
| 230 | The build type defaults to `RelWithDebInfo`: xwin leaves out the debug CRT, so `Debug` needs `--include-debug-libs`. | 283 | The build type defaults to `RelWithDebInfo`: xwin leaves out the debug CRT, so `Debug` needs `--include-debug-libs`. |
| 231 | `make_game.py`'s `runtime` stage makes this same build on Linux when the tools and the SDK are there (`--runtime-build | 284 | `make_game.py`'s `runtime` stage makes this same build on Linux when the tools and the SDK are there (`--runtime-build |
| 232 | runtime/build/windows` takes a folder made by hand like a Windows build). CMake packages are | 285 | runtime/build/windows` takes a folder made by hand like a Windows build). CMake packages are |
| @@ -299,7 +352,12 @@ WINE=wine WINEPREFIX="$(mktemp -d)" WINEDLLOVERRIDES="mscoree,mshtml=" WINEDEBUG | |||
| 299 | 352 | ||
| 300 | The session script initializes a dedicated prefix and stops its Wine processes at exit. On a headless host, | 353 | The session script initializes a dedicated prefix and stops its Wine processes at exit. On a headless host, |
| 301 | put `xvfb-run -a` before `bash` so prefix initialization and the tests share one virtual display. The test runner | 354 | put `xvfb-run -a` before `bash` so prefix initialization and the tests share one virtual display. The test runner |
| 302 | maps the recorded Windows drive to the Linux checkout for shaders referenced by absolute Windows paths. It prints | 355 | maps the recorded Windows drive to the Linux checkout for shaders referenced by absolute Windows paths. It keeps one |
| 356 | wineserver alive for the run and stops it at the end, and adds `winedbg.exe=d;winemenubuilder.exe=d` to each test's | ||
| 357 | `WINEDLLOVERRIDES` (an entry of yours for the same program wins). `--jobs N` runs N tests at a time (default 1): tests | ||
| 358 | marked `RUN_SERIAL` run alone, tests that share a `RESOURCE_LOCK` never overlap, and the verdicts are printed in the | ||
| 359 | same order as with `--jobs 1`; the tests that share temp files can fail now and then in parallel (see "Known | ||
| 360 | problems"). It prints | ||
| 303 | every verdict and returns a failure status if any required test fails, skips or is missing. Check the printed | 361 | every verdict and returns a failure status if any required test fails, skips or is missing. Check the printed |
| 304 | verdicts for failures outside the required set. | 362 | verdicts for failures outside the required set. |
| 305 | 363 | ||
| @@ -345,6 +403,118 @@ on an Apple M3 Max (MoltenVK 1.4.2 and 1.4.3): 17 workgroup shapes from 1 to 102 | |||
| 345 | subgroups, with and without full subgroups and register pressure, all 32 lanes in order. A device whose default | 403 | subgroups, with and without full subgroups and register pressure, all 32 lanes in order. A device whose default |
| 346 | isn't the requested size still prints `not available`, and those tests skip. | 404 | isn't the requested size still prints `not available`, and those tests skip. |
| 347 | 405 | ||
| 406 | `cs_w32_salu_ext` runs 38 scalar ALU ops that no other fixture runs: `s_sub_i32`, `s_andn2_b32`, `s_orn2_b32`, | ||
| 407 | `s_xor_b32`, `s_ashr_i32`, `s_mul_hi_u32`, `s_lshl3_add_u32`, `s_lshl4_add_u32`, `s_pack_ll_b32_b16`, | ||
| 408 | `s_pack_hh_b32_b16`, `s_abs_i32`, `s_bcnt0_i32_b32`, `s_bitset0_b32`, `s_bitset1_b32`, `s_brev_b32`, `s_flbit_i32`, | ||
| 409 | `s_flbit_i32_b32`, `s_sext_i32_i8`, the six `s_cmp_*_i32`, `s_cmp_gt_u32`, `s_cmp_le_u32`, `s_bitcmp0_b32`, | ||
| 410 | `s_bitcmp1_b32`, `s_addk_i32`, `s_mulk_i32`, `s_cmovk_i32`, `s_ashr_i64`, `s_lshl_b64`, `s_lshr_b64`, | ||
| 411 | `s_bcnt0_i32_b64`, `s_bitset0_b64`, `s_cmov_b64` and `s_ff0_i32_b64`. Its sixteen operand words arrive in `s4..s19` | ||
| 412 | through `VKC_SGPRS`, so each op reaches the driver as SPIR-V: a scalar op on literals is folded by the translator | ||
| 413 | (the "Chained scalar constant folding" row of [design.md](design.md)) and only its result is stored. One thread stores | ||
| 414 | every destination and four words of SCC bits: SCC after each op that writes it, each run on operands that set it | ||
| 415 | and on operands that clear it; each compare and bit test both ways, the signed and the unsigned ones on words that | ||
| 416 | tell the two apart; and SCC after each op that must keep it, set to 1 and to 0 in turn before them. The 73 expected | ||
| 417 | words are literals in `check.py`, derived in the fixture's header, and `tests/test_gpu_salu_ext.py` recomputes them | ||
| 418 | from the fixture's own instruction lines with the reference of `tools/salu_diff.py`, the model that was compared | ||
| 419 | with hardware. Both GPU runners compare the whole 80-word heap, the untouched fill after the results included. Run | ||
| 420 | it alone with `python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_salu_ext --require-pass`. | ||
| 421 | On an RTX 4070 Ti (NVIDIA 620.70.06, Linux) and on llvmpipe (Mesa 26.2.6, LLVM 23.1.4) all 80 words match. Nine | ||
| 422 | translator rules broken one at a time each failed it on both: `s_ashr_i32` shifting in zeros (word 8), | ||
| 423 | `s_lshlN_add_u32` taking SCC from the add's carry alone (word 69), `s_abs_i32` negating (word 17), `s_mulk_i32` and | ||
| 424 | `s_addk_i32` zero-extending their immediate (words 37 and 21), `s_cmovk_i32` ignoring SCC (word 38), the 64-bit | ||
| 425 | shifts taking their count modulo 32 and `s_ashr_i64` shifting in zeros (word 51), and the 64-bit shifts taking SCC | ||
| 426 | from the low dword alone (word 72). | ||
| 427 | |||
| 428 | `cs_w32_shift64` checks `v_lshlrev_b64`, `v_lshrrev_b64` and `v_ashrrev_i64` with 64 memory-fed cases: | ||
| 429 | eight boundary values crossed with counts 0, 1, 31, 32, 33, 63, 64 and 65. The expected values come from Python | ||
| 430 | integers using the low six count bits, as specified by the [RDNA2 ISA, VOP3 opcodes 767–769](https://docs.amd.com/api/khub/documents/Et~wpu9g~Ffl7d9q0QZ~Og/content). | ||
| 431 | It also overlaps the destination with the count, one source word or the entire source pair. Both GPU runners | ||
| 432 | compare all 640 heap words (384 results and 256 unchanged input words); the operands are loaded at runtime so | ||
| 433 | the driver cannot replace the tested operations with constant-folded answers. Run it alone with | ||
| 434 | `python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_shift64 --require-pass`. | ||
| 435 | It needs shader Int64 support; a device that lacks it reports a skip. This is a wave32 test of 64-bit values, | ||
| 436 | independent of wave64 emulation. On RTX 3080 Ti (616.92, Windows 11), all 640 words matched; replacing the count | ||
| 437 | mask with 31 or the arithmetic shift with a logical shift made the test fail at words 66 and 251 respectively. | ||
| 438 | |||
| 439 | `cs_w32_frexp_ldexp` checks `v_frexp_mant_f32`, `v_frexp_exp_i32_f32`, `v_ldexp_f32`, `v_frexp_mant_f64` and | ||
| 440 | `v_frexp_exp_i32_f64`, which the translator computes with integer ops on the float's words. 64 records of a binary32 | ||
| 441 | value, an `ldexp` exponent and a binary64 value are loaded at run time: normals, the clamp of the exponent at ±512 | ||
| 442 | and beyond, results that overflow to an infinity and that fall below the smallest normal, binary32 denormals (read | ||
| 443 | as zero), binary64 subnormals (normalized; single fraction bits on both sides of the dword boundary and patterns | ||
| 444 | with several), zeros, infinities and NaNs. Each thread stores the five results, `v_frexp_mant_f32` with a `neg` | ||
| 445 | source and `v_ldexp_f32` with an `abs` source run with the odd threads turned off, whose destination must keep the | ||
| 446 | word it held. The expected words come from an oracle written from the rows of [design.md](design.md) | ||
| 447 | (`frexp_mant_f32`, `frexp_exp_i32_f32`, `ldexp_f32` and `frexp_f64` in `check.py`), and | ||
| 448 | `tests/test_gpu_frexp_ldexp.py` checks it against `math.frexp` and `math.ldexp` wherever those agree with the | ||
| 449 | hardware. Both GPU runners compare all 768 heap words, the 256 unchanged input words included. Run it alone with | ||
| 450 | `python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_frexp_ldexp --require-pass`. | ||
| 451 | On an RTX 4070 Ti (NVIDIA 620.70.06, Linux) and on llvmpipe (Mesa 26.2.6, LLVM 23.1.4) all 768 words match. While | ||
| 452 | the binary32 ops still applied `neg` and `abs` with `OpFNegate` and `FAbs`, six words differed on the 4070 Ti and none | ||
| 453 | on llvmpipe: every NaN source under a modifier came back as `0x7fffffff`, the driver's default NaN (word 419 is the | ||
| 454 | first: the mantissa of the negated `0x7fc00000`). Rules broken one at a time each failed the test on both devices: | ||
| 455 | the mantissa given the exponent field 127 (word 0) or, for binary64, 1023 (word 5), the exponent subtracting 127 | ||
| 456 | (word 1), `v_ldexp_f32` without its clamp (word 258) or overflowing to the largest finite value (word 106), a | ||
| 457 | binary32 denormal not read as zero (word 352), the binary64 subnormal exponent off by one in the low or in the high | ||
| 458 | dword (words 134 and 150), and the fixture without its `v_cmpx` (word 15). | ||
| 459 | |||
| 460 | `cs_w32_cmp_f64` checks the 32 binary64 vector compares, `v_cmp_*_f64` into VCC and `v_cmpx_*_f64` on EXEC, with | ||
| 461 | 256 memory-fed operand pairs: the product of 16 values (±inf, ±max, the 1-ULP neighbours of ±1, the smallest | ||
| 462 | subnormals, ±0, the smallest normal, a NaN whose payload is only in the low dword and a negative quiet NaN). Each | ||
| 463 | thread stores one bit per predicate for both forms, a bit for `tru` run with the odd threads turned off (an inactive | ||
| 464 | lane gets VCC 0 from `v_cmp_` and stays off through `v_cmpx_`) and two bits for `lt` and `nge` with VOP3 `abs`/`neg`. | ||
| 465 | The expected words come from Python floats (`cmp_f64_words` in `check.py`): IEEE-754 ordering, with every pair that | ||
| 466 | has a NaN unordered. Both GPU runners compare all 1536 heap words (512 result words and 1024 unchanged input words); | ||
| 467 | the operands are loaded at run time, so neither the translator nor the driver can fold a compare. Run it alone with | ||
| 468 | `python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_cmp_f64 --require-pass`. | ||
| 469 | It is a wave32 test and no step of it needs a particular subgroup width, so it also runs on llvmpipe; the SGPR-pair | ||
| 470 | and constant operand forms are CPU-checked only (`tests/semantic/test_cmp_f64.py`). On an RTX 4070 Ti (NVIDIA | ||
| 471 | 620.70.06, Linux) all 1536 words matched, and seven translator rules broken one at a time each failed it: no `-0` | ||
| 472 | canonicalization at word 206, a NaN test that ignores the low dword at word 28, an ordering key without the low | ||
| 473 | dword at word 70, the raw result written to an inactive lane's VCC at word 2, `v_cmpx_` replacing EXEC at word 3, | ||
| 474 | `abs` ignored and `nlt` lowered as the negation of `le` at word 0. | ||
| 475 | |||
| 476 | `cs_w32_round_f64` checks `v_trunc_f64`, `v_ceil_f64`, `v_rndne_f64` and `v_floor_f64`, which the translator gives | ||
| 477 | to the driver's double-precision `Trunc`, `Ceil`, `RoundEven` and `Floor` (`shaderFloat64`). 64 inputs are loaded at | ||
| 478 | run time: signed zeros, the smallest subnormals and normals, values around 0.5 and 1 (the largest value below 0.5 | ||
| 479 | among them), ties from 0.5 to 5.5 and at 2^31 + 0.5, 2^51 + 0.5 and 2^52 - 0.5, integers from 2^52 to 2^63, 1e300, | ||
| 480 | the largest finite value, the infinities, and quiet and signalling NaNs. Each thread stores the four roundings, | ||
| 481 | `v_trunc_f64` with a `neg` source, `v_ceil_f64` with an `abs` source, a `v_floor_f64` whose destination pair overlaps | ||
| 482 | its source pair, and a `v_rndne_f64` run with the odd threads turned off, whose destination must keep the pair it | ||
| 483 | held. The expected words come from Python (`round_f64` in `check.py`: exact IEEE-754, the result keeping its | ||
| 484 | source's sign), and `tests/test_gpu_round_f64.py` checks that oracle against exact rational rounding. All 1152 heap | ||
| 485 | words are compared exactly, the 128 unchanged input words included: a NaN and a subnormal are rounded by the | ||
| 486 | translated code with integer ops and not by the driver, as the row in [design.md](design.md) says. (llvmpipe gets | ||
| 487 | one allowance, for what it does to `Trunc` and `RoundEven` on some CPUs; see below.) Run it alone with | ||
| 488 | `python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_round_f64 --require-pass`. | ||
| 489 | It needs `shaderFloat64`; a device without it reports a skip. | ||
| 490 | |||
| 491 | Measured: on an RTX 4070 Ti (NVIDIA 620.70.06, Linux) and on llvmpipe (Mesa 26.2.6, LLVM 23.1.4) all 1152 words | ||
| 492 | match. While those two kinds of input still went to the driver's function, 15 of the 512 results differed on the | ||
| 493 | 4070 Ti, those of the two signalling NaNs, which came back quiet with sign and payload kept (`0x7ff0000000000001` | ||
| 494 | gave `0x7ff8000000000001`), and five more on llvmpipe, which read the two smallest subnormals as zero (`v_ceil_f64` | ||
| 495 | of the positive one gave +0 instead of 1, `v_floor_f64` of the negative one -0 instead of -1). Rules broken one at a | ||
| 496 | time each failed the test on both devices: a NaN left to the driver (word 784), the NaN and subnormal tests ignoring | ||
| 497 | the low dword, `v_ceil_f64` or `v_floor_f64` lifting the subnormal of the wrong sign (words 34 and 38), a subnormal's | ||
| 498 | result losing its sign (word 40), a NaN's low word dropped (word 784), `rndne` lowered as `floor(x + 0.5)` (word 20, | ||
| 499 | the sign of -0), `trunc` or `ceil` lowered as `Floor`, the `neg` or the `abs` source modifier ignored (words 8 and | ||
| 500 | 26), the two result words swapped (word 8), and the fixture without its `v_cmpx` (word 30). Two changes are not | ||
| 501 | caught everywhere: a subnormal left to the driver fails on llvmpipe (word 34) and passes on the 4070 Ti, which keeps | ||
| 502 | binary64 denormals, and `RoundEven` replaced by GLSL `Round` changes nothing on either device, since both send a tie | ||
| 503 | to the even integer. | ||
| 504 | |||
| 505 | llvmpipe gave those results on a CPU with AVX-512. On one without it, `Trunc` and `RoundEven` of a double go through | ||
| 506 | the code llvmpipe has for a float, because its double vectors are twice its native width (512 bits at the usual 256) | ||
| 507 | and it only has the exact rounding for a width the CPU has an extension for. There a magnitude above 2^24 comes back | ||
| 508 | unchanged (`v_trunc_f64` of 123456789.0625 is 123456789.0625) and `RoundEven` of a smaller one can give the other | ||
| 509 | neighbouring integer (1 for 1.5, 0 for the value just above 0.5): 48 of the 512 results, the same 48 with Mesa | ||
| 510 | 25.2.8 (LLVM 20.1.2) on a CI runner and with Mesa 26.2.6 under `GALLIUM_OVERRIDE_CPU_CAPS=avx`, which is how to see | ||
| 511 | it on a CPU that has AVX-512. `Floor` and `Ceil` are exact on that path. The CI's runners differ in this, so the | ||
| 512 | unchanged fixture passed or failed there by the machine it got. On llvmpipe the judge therefore lets `v_trunc_f64` | ||
| 513 | and `v_rndne_f64` return what that path can give, the source itself above 2^24 and either neighbouring integer | ||
| 514 | from 0.5 up to it, and nothing else (`ROUND_F64_FLOAT_PATH` in `check.py`); `v_floor_f64`, `v_ceil_f64`, the kept | ||
| 515 | pair and the inputs stay exact there, and no other device gets the allowance. `LP_NATIVE_VECTOR_WIDTH=128` makes | ||
| 516 | llvmpipe exact on a CPU with AVX. | ||
| 517 | |||
| 348 | ## Wave64 pixel, vertex and geometry shaders (`w64_graphics.py`) | 518 | ## Wave64 pixel, vertex and geometry shaders (`w64_graphics.py`) |
| 349 | 519 | ||
| 350 | Graphics stages have no emulation: on a 32-wide subgroup a wave64 VS, PS or GS runs as two 32-lane halves, and the | 520 | Graphics stages have no emulation: on a 32-wide subgroup a wave64 VS, PS or GS runs as two 32-lane halves, and the |
| @@ -384,23 +554,6 @@ Each line prints `ok`, a `SKIP` with its reason, or what differed. To add a fixt | |||
| 384 | 3. Add it to `EXPECT` in `tests/test_wave64_halves_fixtures.py` with the tier, reasons and idioms the translator | 554 | 3. Add it to `EXPECT` in `tests/test_wave64_halves_fixtures.py` with the tier, reasons and idioms the translator |
| 385 | should give it, and run `python -m pytest tests/test_wave64_halves_fixtures.py`. | 555 | should give it, and run `python -m pytest tests/test_wave64_halves_fixtures.py`. |
| 386 | 4. Run `w64_graphics.py` on a RADV GPU and say which GPU and Mesa version in the pull request. | 556 | 4. Run `w64_graphics.py` on a RADV GPU and say which GPU and Mesa version in the pull request. |
| 387 | ## GPUs with 128 bytes of push constants (AMD RDNA2 iGPUs on Windows, some Intel Arc drivers) | ||
| 388 | |||
| 389 | The translated shaders take 144 bytes of push constants: s0..s31, then the heap base and the code base. A device whose | ||
| 390 | `maxPushConstantsSize` is 128, Vulkan's minimum, can't take that, so the texture tests and every test drawn through | ||
| 391 | `vk_harness` skip there (`unsupported: need 144 push constant bytes, device has 128`); `vulkaninfo` shows the limit. | ||
| 392 | AMD's older Windows drivers report 128 on RDNA2 iGPUs (Radeon 680M on 22.40.84.06, 610M on 24.10.16.14, the Ryzen 5 | ||
| 393 | 7600's iGPU on 24.10.24); 26.11.2 reports 256 on a Radeon 610M, where these tests run without the variable below. | ||
| 394 | RADV reports more on the same chips. | ||
| 395 | |||
| 396 | To run them anyway, set `LEONIDA_PC_TAIL_UBO=1` **for both `build.py` and `check.py`** (or for | ||
| 397 | `run_gpu_tests.py`). The shaders are then translated with `--pc-tail-ubo`: s0..s31 stay in 128 push-constant bytes, | ||
| 398 | and the heap base and code base move to a uniform block at set 1 (`docs/design.md`, "Push-constant tail as a uniform | ||
| 399 | block"), which `vk_compute_test`, `vk_store_test`, `vk_harness`, `vk_texture_test`, `vk_sampler_test` and | ||
| 400 | `vk_bindless_test` bind (`runtime/test/vk_pc_tail.h`). If you set it | ||
| 401 | only for `check.py`, the shaders read the tail from push constants the programs no longer declare. `--mesh-compute` | ||
| 402 | (`LEONIDA_MESH_COMPUTE=1`) isn't combined with it yet: its vertex shader still reads the output address from push | ||
| 403 | constants, so those tests skip. | ||
| 404 | 557 | ||
| 405 | ## GPUs with 128 bytes of push constants (AMD RDNA2 iGPUs on Windows, some Intel Arc drivers) | 558 | ## GPUs with 128 bytes of push constants (AMD RDNA2 iGPUs on Windows, some Intel Arc drivers) |
| 406 | 559 | ||
| @@ -708,9 +861,14 @@ CS, 10,974 PS). | |||
| 708 | 861 | ||
| 709 | ## Posting your result | 862 | ## Posting your result |
| 710 | 863 | ||
| 711 | Use the template at the top of [#166](https://github.com/ItsNotRexed/Leonida/issues/166): GPU, driver, subgroup | 864 | Submit a pull request adding a file under [`gpu-test-results/`](../gpu-test-results), using the existing files |
| 712 | range, OS, the commit you built, the tool versions and the counts each script printed. Post counts and pass/fail | 865 | there as format examples. Follow [CONTRIBUTING.md](../CONTRIBUTING.md) and claim the work in the |
| 713 | lines only, never shaders or logs from the game. A failure that isn't in the table above gets its own issue, linked | 866 | [coordination issue][claims] before opening the pull request. |
| 714 | from your entry. | 867 | |
| 868 | Include your GPU, driver, subgroup range, OS, the commit you built, the tool versions, and the pass, skip and fail | ||
| 869 | counts each script printed. Label a single-test run clearly instead of presenting it as a full suite run. | ||
| 870 | Post counts and pass/fail lines only, never shaders or logs from the game. A failure that is not in the table | ||
| 871 | above gets its own issue, linked from your record. | ||
| 715 | 872 | ||
| 716 | Use your system's detected CPU, GPU, VRAM and RAM model names in the #166 entry, not benchmark scores. For a rough browser-based check against reference profiles, you can use [Can I Run Leonida](https://assttro.github.io/can-i-run-leonida/). | 873 | Use your system's detected CPU, GPU, VRAM and RAM model names in your result record, not benchmark scores. |
| 874 | For a rough browser-based check against reference profiles, you can use [Can I Run Leonida](https://assttro.github.io/can-i-run-leonida/). | ||