diff options
Diffstat (limited to 'docs/testing.md')
| -rw-r--r-- | docs/testing.md | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/docs/testing.md b/docs/testing.md index 635c700a6..ba91fb2af 100644 --- a/docs/testing.md +++ b/docs/testing.md | |||
| @@ -163,7 +163,7 @@ C++ `runtime/` tests are not run by it; use the fork's CI as above. | |||
| 163 | 163 | ||
| 164 | - **Python 3.12+**, which `make_game.py` requires (it stops with "Python 3.12 or newer is needed" on an older one, so | 164 | - **Python 3.12+**, which `make_game.py` requires (it stops with "Python 3.12 or newer is needed" on an older one, so |
| 165 | its tests fail there too). `scripts/run_gpu_tests.py` on its own runs on 3.10 or newer. | 165 | its tests fail there too). `scripts/run_gpu_tests.py` on its own runs on 3.10 or newer. |
| 166 | - **`llvm-mc` with the AMDGPU target** (LLVM 21+). The official LLVM Windows release has no AMDGPU target. On | 166 | - **`llvm-mc` with the AMDGPU target** (LLVM 21+ to assemble the test fixtures, 23+ for the `shaders` stage; see below). The official LLVM Windows release has no AMDGPU target. On |
| 167 | Windows, use one of: | 167 | Windows, use one of: |
| 168 | - `scripts\build_llvm_mc.ps1`, which builds a native `llvm-mc.exe` (needs git and the Visual Studio C++ tools); | 168 | - `scripts\build_llvm_mc.ps1`, which builds a native `llvm-mc.exe` (needs git and the Visual Studio C++ tools); |
| 169 | - conda-forge's `llvm-tools` package, whose Windows build includes the AMDGPU target; | 169 | - conda-forge's `llvm-tools` package, whose Windows build includes the AMDGPU target; |
| @@ -193,6 +193,13 @@ C++ `runtime/` tests are not run by it; use the fork's CI as above. | |||
| 193 | 193 | ||
| 194 | If it reports `not a valid operand`, point `LLVM_MC` at a build that accepts this instruction. The Windows | 194 | If it reports `not a valid operand`, point `LLVM_MC` at a build that accepts this instruction. The Windows |
| 195 | conda-forge `llvm-tools` 23.1.6 package assembled the same f16 programs. | 195 | conda-forge `llvm-tools` 23.1.6 package assembled the same f16 programs. |
| 196 | |||
| 197 | The `shaders` stage needs LLVM 23+ as well, for reasons that have nothing to do with the tests above: 840 of the | ||
| 198 | 2,684 compute programs in the pipeline library come out of LLVM 21.1.8's listings with 79,490 undecodable words, so | ||
| 199 | the translator refuses them (`fall-through into undecodable words`) and 1,844 of 2,684 reach the output. 23.1.5 | ||
| 200 | decodes those 840 with no rejected word and the stage translates 2,683 of 2,684 (the last is refused for | ||
| 201 | `s_sethalt`, which the translator does not implement); `scripts\build_llvm_mc.ps1` builds 23.1.5 by default | ||
| 202 | ([design.md](design.md), "Disassembling shaders"). | ||
| 196 | - **SPIRV-Tools** (`spirv-as`, `spirv-val`): part of the Vulkan SDK, or a distribution package. | 203 | - **SPIRV-Tools** (`spirv-as`, `spirv-val`): part of the Vulkan SDK, or a distribution package. |
| 197 | - **A C++20 compiler, CMake and the Vulkan headers** to build the test programs: | 204 | - **A C++20 compiler, CMake and the Vulkan headers** to build the test programs: |
| 198 | - Windows: the full runtime needs Visual Studio 2022 with "Desktop development with C++" and Windows SDK | 205 | - Windows: the full runtime needs Visual Studio 2022 with "Desktop development with C++" and Windows SDK |
| @@ -400,6 +407,18 @@ WINEPREFIX="$HOME/.local/share/leonida-wine" ctest --test-dir runtime/build/wind | |||
| 400 | Use a recent xwin: 0.10.0 lays out SDK 10.0.26100 with the command above, while 0.6.5 stops with "unable to find | 407 | Use a recent xwin: 0.10.0 lays out SDK 10.0.26100 with the command above, while 0.6.5 stops with "unable to find |
| 401 | x86_64 headers for Win11SDK_10.0.26100". | 408 | x86_64 headers for Win11SDK_10.0.26100". |
| 402 | 409 | ||
| 410 | On a Mac (Apple Silicon) the same steps work with Homebrew's LLVM and lld (`brew install llvm lld xwin`; the cross | ||
| 411 | tools are `clang-cl`, `lld-link`, `llvm-lib`, `llvm-rc` and `llvm-mt` under `$(brew --prefix)/opt/llvm/bin` and | ||
| 412 | `$(brew --prefix)/opt/lld/bin`) and the WineHQ macOS build, an x86-64 Wine that runs under Rosetta. Homebrew's | ||
| 413 | `wine-stable` cask is disabled (it does not pass Gatekeeper), so take the archive the cask names from its | ||
| 414 | `url` and check it against the cask's `sha256`. Configure with `-DCMAKE_CROSSCOMPILING_EMULATOR=<path to its wine>` | ||
| 415 | when `wine` is not on `PATH`; a path with spaces (`Wine Stable.app`) is easiest behind a small wrapper script. Run | ||
| 416 | `ctest` with `ROSETTA_ADVERTISE_AVX=1`: without it Rosetta hides AVX from Wine, and the `run_tiny_*` loader tests stop | ||
| 417 | with "the game's code needs AVX, and this CPU or OS lacks AVX, OSXSAVE". Measured on an Apple M3 (macOS 26.5.1, | ||
| 418 | Wine 11.0, its bundled MoltenVK 1.4.1) at `main` `fbf100b1b`: 1084 targets build, and `ctest -j 6 --timeout 120` | ||
| 419 | gives 461 of 482 passed (440 without `ROSETTA_ADVERTISE_AVX`). The display is the Mac's own, so no virtual X server | ||
| 420 | is needed. | ||
| 421 | |||
| 403 | On a machine without a display (a server, a container, WSL without WSLg), Wine has no graphics driver to create a | 422 | On a machine without a display (a server, a container, WSL without WSLg), Wine has no graphics driver to create a |
| 404 | Vulkan instance with, so every Vulkan test fails with `vkCreateInstance failed (VkResult -3)` and, with | 423 | Vulkan instance with, so every Vulkan test fails with `vkCreateInstance failed (VkResult -3)` and, with |
| 405 | `WINEDEBUG=+vulkan`, "Failed to load Wine graphics driver supporting Vulkan". Run the tests under a virtual X server, | 424 | `WINEDEBUG=+vulkan`, "Failed to load Wine graphics driver supporting Vulkan". Run the tests under a virtual X server, |
| @@ -985,6 +1004,7 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin | |||
| 985 | | `cs_w32_salu64` gives eight wrong words on RDNA1 under RADV Mesa 25.2.8 (`0x1E6A2C48 0x1234 0 0x100 47 48 0xFFFF8000 0xFFFFFFFE`, where word 2 should be `0xFFFFFFFF`) | Only the high word of the `s_bfe_i64` result is wrong. The same words appear on four pinned V540s (Navi 12, PCI `1002:7360`) and on a clean upstream/main worktree, and three different valid SPIR-V sign-extension formulations give the same result while the CPU interpreter matches, so this is the driver version rather than the translator (SHADER-276) | Expected with Mesa 25.2.8; the fixture passes on NVIDIA and on AMD's Windows driver. Try a newer Mesa before treating it as a translator bug; do not weaken the fixture's expectation | | 1004 | | `cs_w32_salu64` gives eight wrong words on RDNA1 under RADV Mesa 25.2.8 (`0x1E6A2C48 0x1234 0 0x100 47 48 0xFFFF8000 0xFFFFFFFE`, where word 2 should be `0xFFFFFFFF`) | Only the high word of the `s_bfe_i64` result is wrong. The same words appear on four pinned V540s (Navi 12, PCI `1002:7360`) and on a clean upstream/main worktree, and three different valid SPIR-V sign-extension formulations give the same result while the CPU interpreter matches, so this is the driver version rather than the translator (SHADER-276) | Expected with Mesa 25.2.8; the fixture passes on NVIDIA and on AMD's Windows driver. Try a newer Mesa before treating it as a translator bug; do not weaken the fixture's expectation | |
| 986 | | `d3d12_typeless_rtv` fails its WARP comparison on an AMD desktop iGPU (TEST-591) | [Reported on the Ryzen 5 7600X iGPU with Windows 10 build 19045 and AMD 23.40.02](https://github.com/ItsNotRexed/Leonida/issues/166#issuecomment-7083403389). The exact cause is still open. | Retest on a newer Windows and AMD driver combination. Passing results were reported on the [Ryzen 9 7900 iGPU with AMD 25.10.30.02](https://github.com/ItsNotRexed/Leonida/issues/3232#issuecomment-7085263408), a [gfx1036 iGPU with AMD 26.5.2](https://github.com/ItsNotRexed/Leonida/issues/2891#issuecomment-7084023801), and the [Ryzen 7 9800X3D iGPU with driver 32.0.21045.29003](https://github.com/ItsNotRexed/Leonida/pull/3440). | | 1005 | | `d3d12_typeless_rtv` fails its WARP comparison on an AMD desktop iGPU (TEST-591) | [Reported on the Ryzen 5 7600X iGPU with Windows 10 build 19045 and AMD 23.40.02](https://github.com/ItsNotRexed/Leonida/issues/166#issuecomment-7083403389). The exact cause is still open. | Retest on a newer Windows and AMD driver combination. Passing results were reported on the [Ryzen 9 7900 iGPU with AMD 25.10.30.02](https://github.com/ItsNotRexed/Leonida/issues/3232#issuecomment-7085263408), a [gfx1036 iGPU with AMD 26.5.2](https://github.com/ItsNotRexed/Leonida/issues/2891#issuecomment-7084023801), and the [Ryzen 7 9800X3D iGPU with driver 32.0.21045.29003](https://github.com/ItsNotRexed/Leonida/pull/3440). | |
| 987 | | `ps_interp_f16_high` fails on a Mac: `PerVertexKHR decoration is not supported in MSL`, then `vkCreateGraphicsPipelines` -3 | MoltenVK can't convert `PerVertexKHR` inputs to Metal | Current `main` translates it with `--f16-interp-fallback` on MoltenVK (see "Macs: 16-bit interpolation") | | 1006 | | `ps_interp_f16_high` fails on a Mac: `PerVertexKHR decoration is not supported in MSL`, then `vkCreateGraphicsPipelines` -3 | MoltenVK can't convert `PerVertexKHR` inputs to Metal | Current `main` translates it with `--f16-interp-fallback` on MoltenVK (see "Macs: 16-bit interpolation") | |
| 1007 | | `ps_ssharp` fails on some Macs with MoltenVK 1.4.2 (an Apple M3, not an M5 Pro): `point bias +1: (0,0): (1.0, 0.0, 0.502, 0.502) != (0.502, 0.502, 0.502, 0.502)` | MoltenVK drops the sampler's `mipLodBias`, so the S#'s `LOD_BIAS` moves neither the explicit nor the derivative LOD | Current `main` translates with `--explicit-lod-bias` where `tools/vk_subgroup_info.py --lod-bias` measures that the sampler drops the bias (see "S# LOD bias without the sampler's `mipLodBias`" in [design.md](design.md)). Forcing it on another driver (`LEONIDA_EXPLICIT_LOD_BIAS=1`) counts the bias twice and fails the +-0.26 cases | | ||
| 988 | | `ps_vcmpx_forms` fails on a Mac: word 1 reads `0xf05e8e16`, want `0xf05e8a12` | MoltenVK's fast-math makes a compare of a NaN with itself true (SHADER-234) | Current `main`'s test programs turn it off (`MVK_CONFIG_FAST_MATH_ENABLED=0`, unless you set the variable yourself); rebuild them | | 1008 | | `ps_vcmpx_forms` fails on a Mac: word 1 reads `0xf05e8e16`, want `0xf05e8a12` | MoltenVK's fast-math makes a compare of a NaN with itself true (SHADER-234) | Current `main`'s test programs turn it off (`MVK_CONFIG_FAST_MATH_ENABLED=0`, unless you set the variable yourself); rebuild them | |
| 989 | | On a Mac, a translated shader's GPU time is 1.5 to 16 times what it would be without the precise-arithmetic overhead | MoltenVK's SPIRV-Cross turns every `NoContraction` float add, subtract and multiply into a call to an `[[clang::optnone]]` helper that Metal does not inline. MoltenVK 1.4.2 and `main` up to at least `5189f8de` are affected (SHADER-234, [design notes](design.md#translator-status-and-runtime-contract)) | Expected with these MoltenVK versions, and the output is still exact. Before you time shaders on a Mac, build MoltenVK with SPIRV-Cross `98cbb7c0` or newer in `ExternalRevisions/SPIRV-Cross_repo_revision` (KhronosGroup/MoltenVK#2917 moves it to `57e4efcc`), and point `LEONIDA_VULKAN_LOADER` at its `libMoltenVK.dylib` | | 1009 | | On a Mac, a translated shader's GPU time is 1.5 to 16 times what it would be without the precise-arithmetic overhead | MoltenVK's SPIRV-Cross turns every `NoContraction` float add, subtract and multiply into a call to an `[[clang::optnone]]` helper that Metal does not inline. MoltenVK 1.4.2 and `main` up to at least `5189f8de` are affected (SHADER-234, [design notes](design.md#translator-status-and-runtime-contract)) | Expected with these MoltenVK versions, and the output is still exact. Before you time shaders on a Mac, build MoltenVK with SPIRV-Cross `98cbb7c0` or newer in `ExternalRevisions/SPIRV-Cross_repo_revision` (KhronosGroup/MoltenVK#2917 moves it to `57e4efcc`), and point `LEONIDA_VULKAN_LOADER` at its `libMoltenVK.dylib` | |
| 990 | | `d3d12_descriptor_test` reports that the set had room for fewer than 5001 2D views and 2100 samplers, and the device logs that the bindless set holds fewer samplers than a full shader-visible sampler heap | The device's descriptor limits, or its `vkGetDescriptorSetLayoutSupport`, allow no bigger bindless set ([d3d12_vulkan.md](d3d12_vulkan.md) section 5). MoltenVK's answer is ignored, since it rejects every layout of `maxPerSetDescriptors` (1212) or more although it runs the full set | Expected where the limits are low. The test still checks the last index of each array and that the next view and sampler are refused | | 1010 | | `d3d12_descriptor_test` reports that the set had room for fewer than 5001 2D views and 2100 samplers, and the device logs that the bindless set holds fewer samplers than a full shader-visible sampler heap | The device's descriptor limits, or its `vkGetDescriptorSetLayoutSupport`, allow no bigger bindless set ([d3d12_vulkan.md](d3d12_vulkan.md) section 5). MoltenVK's answer is ignored, since it rejects every layout of `maxPerSetDescriptors` (1212) or more although it runs the full set | Expected where the limits are low. The test still checks the last index of each array and that the next view and sampler are refused | |
| @@ -998,6 +1018,7 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin | |||
| 998 | | `cs_bvh` and `cs_bvh32` fail on a Mac with KosmicKrisp: `out[3]` reads `0x7fc00000`, want `0xffffffff` | KosmicKrisp's `nir_to_msl` compiler (Mesa 26.3.1, measured on Apple M2 Ultra, macOS 27.3), not the translator or the buffer format. The triangle branch writes bitcast `float` words and the box branch writes `OpSelect %uint` with `0xffffffff` (`-1`) into the same VGPRs; NIR erases `OpBitcast`, type inference marks the shared register and `bcsel` as `float`, and `nir_to_msl` prints any `float`-typed 32-bit constant in the IEEE-754 NaN range (`0x7f800001..0x7fffffff`, `0xff800001..0xffffffff`) as `(NAN)` (`0x7fc00000`) | Expected with KosmicKrisp in Mesa 26.3.1; MoltenVK 1.4.2 and llvmpipe (Mesa 26.3.1) return `0xffffffff` on the same machine. Do not weaken `vk_compute_test`'s expected BVH words | | 1018 | | `cs_bvh` and `cs_bvh32` fail on a Mac with KosmicKrisp: `out[3]` reads `0x7fc00000`, want `0xffffffff` | KosmicKrisp's `nir_to_msl` compiler (Mesa 26.3.1, measured on Apple M2 Ultra, macOS 27.3), not the translator or the buffer format. The triangle branch writes bitcast `float` words and the box branch writes `OpSelect %uint` with `0xffffffff` (`-1`) into the same VGPRs; NIR erases `OpBitcast`, type inference marks the shared register and `bcsel` as `float`, and `nir_to_msl` prints any `float`-typed 32-bit constant in the IEEE-754 NaN range (`0x7f800001..0x7fffffff`, `0xff800001..0xffffffff`) as `(NAN)` (`0x7fc00000`) | Expected with KosmicKrisp in Mesa 26.3.1; MoltenVK 1.4.2 and llvmpipe (Mesa 26.3.1) return `0xffffffff` on the same machine. Do not weaken `vk_compute_test`'s expected BVH words | |
| 999 | | `ps_cndmask_sign_mods` fails on a Mac with KosmicKrisp: all 4096 pixels differ, `(0,0)` reads `0x7fc00000, 0x7fc00000, 0x80000001, 0x7fc00000`, want `0xff800001, 0x7f800001, 0x80000001, 0x7f800001` | The same `nir_to_msl` NaN-constant path as `cs_bvh` above: the shader selects between `float` NaNs with sign and payload (`-NaN`, `+NaN`), and KosmicKrisp prints each such constant as `(NAN)` (`0x7fc00000`). Measured on an Apple M3, macOS 27.0, Mesa 26.3.1 | Expected with KosmicKrisp; the same test passes 4096/4096 on llvmpipe (Mesa 26.3.1) and on MoltenVK 1.4.2 on the same machine | | 1019 | | `ps_cndmask_sign_mods` fails on a Mac with KosmicKrisp: all 4096 pixels differ, `(0,0)` reads `0x7fc00000, 0x7fc00000, 0x80000001, 0x7fc00000`, want `0xff800001, 0x7f800001, 0x80000001, 0x7f800001` | The same `nir_to_msl` NaN-constant path as `cs_bvh` above: the shader selects between `float` NaNs with sign and payload (`-NaN`, `+NaN`), and KosmicKrisp prints each such constant as `(NAN)` (`0x7fc00000`). Measured on an Apple M3, macOS 27.0, Mesa 26.3.1 | Expected with KosmicKrisp; the same test passes 4096/4096 on llvmpipe (Mesa 26.3.1) and on MoltenVK 1.4.2 on the same machine | |
| 1000 | | `ps_valu16_mad_sel` fails on a Mac with KosmicKrisp: all 4096 pixels differ, `(0,0)` reads `0x8003, 0xdb880000, 0x7fc00000, 0x80000000`, want `0x8003, 0xdb880000, 0xffffffff, 0x80000000` | Same cause: a value the shader writes as `0xffffffff` (`-1`) reaches the render target as `0x7fc00000` because `nir_to_msl` types the shared register as `float` and prints the NaN-range constant as `(NAN)`. Measured on an Apple M3, macOS 27.0, Mesa 26.3.1 | Expected with KosmicKrisp; passes 4096/4096 on llvmpipe (Mesa 26.3.1) and on MoltenVK 1.4.2 on the same machine | | 1020 | | `ps_valu16_mad_sel` fails on a Mac with KosmicKrisp: all 4096 pixels differ, `(0,0)` reads `0x8003, 0xdb880000, 0x7fc00000, 0x80000000`, want `0x8003, 0xdb880000, 0xffffffff, 0x80000000` | Same cause: a value the shader writes as `0xffffffff` (`-1`) reaches the render target as `0x7fc00000` because `nir_to_msl` types the shared register as `float` and prints the NaN-range constant as `(NAN)`. Measured on an Apple M3, macOS 27.0, Mesa 26.3.1 | Expected with KosmicKrisp; passes 4096/4096 on llvmpipe (Mesa 26.3.1) and on MoltenVK 1.4.2 on the same machine | |
| 1021 | | `cs_fmt_all` fails on a Mac with KosmicKrisp: word 293 reads `0x80007e00`, want `0x80007c01` | The same `(NAN)` printing as the rows above, still in Mesa `main`: `emit_src_component` in `src/kosmickrisp/compiler/msl_type_inference.c` prints every `float`-typed NaN constant as `(NAN)`, dropping its payload and sign. Here the input `0x7f800001` of a 16-bit float store becomes `0x7fc00000`, which narrows to `0x7e00` instead of `0x7c01`. Measured on an Apple M3 (macOS 26.5.1) with Mesa 26.3.1 at `main` `a73a57e13` | Expected with KosmicKrisp; MoltenVK 1.4.2 and llvmpipe (Mesa 26.3.1) pass on the same machine. Do not weaken the expected words | | ||
| 1001 | | `cs_fma_fused` fails on a Mac with KosmicKrisp: word 7 reads `0x7352`, want `0x7351` | The f16 multiply-add (round to odd), computed at run time, comes out as if the product were rounded first: the exact product, 14988, is halfway between the f16 values 14984 (`0x7351`) and 14992 (`0x7352`), the addend is -2^-22, and one rounding gives `0x7351`. Measured on an Apple M3 with Mesa 26.3.1, 20 of 20 runs (the review of #1724). While the fixture's f16 operands were literals the constant was folded exactly, so the test passed there | Expected with KosmicKrisp in Mesa 26.3.1; MoltenVK 1.4.2 and llvmpipe (Mesa 26.3.1) give `0x7351` on the same machine. The f32 words KosmicKrisp splits are accepted under `--fma glsl`; the f16 word is not, since it does not use `Fma` | | 1022 | | `cs_fma_fused` fails on a Mac with KosmicKrisp: word 7 reads `0x7352`, want `0x7351` | The f16 multiply-add (round to odd), computed at run time, comes out as if the product were rounded first: the exact product, 14988, is halfway between the f16 values 14984 (`0x7351`) and 14992 (`0x7352`), the addend is -2^-22, and one rounding gives `0x7351`. Measured on an Apple M3 with Mesa 26.3.1, 20 of 20 runs (the review of #1724). While the fixture's f16 operands were literals the constant was folded exactly, so the test passed there | Expected with KosmicKrisp in Mesa 26.3.1; MoltenVK 1.4.2 and llvmpipe (Mesa 26.3.1) give `0x7351` on the same machine. The f32 words KosmicKrisp splits are accepted under `--fma glsl`; the f16 word is not, since it does not use `Fma` | |
| 1002 | | CMake stops with "needs the Windows SDK 10.0.26100 or newer", or MSVC reports `'Desc_1_2': is not a member of 'D3D12_VERSIONED_ROOT_SIGNATURE_DESC'` | A Windows SDK older than 10.0.26100 (10.0.22621 is the common one), which has no version 1.2 root signatures | `winget install Microsoft.WindowsSDK.10.0.26100`, or add it in the Visual Studio Installer, then delete `runtime/build` and configure again | | 1023 | | CMake stops with "needs the Windows SDK 10.0.26100 or newer", or MSVC reports `'Desc_1_2': is not a member of 'D3D12_VERSIONED_ROOT_SIGNATURE_DESC'` | A Windows SDK older than 10.0.26100 (10.0.22621 is the common one), which has no version 1.2 root signatures | `winget install Microsoft.WindowsSDK.10.0.26100`, or add it in the Visual Studio Installer, then delete `runtime/build` and configure again | |
| 1003 | | `scripts/build_runtime.ps1` stops at once: "The checkout path ... contains '%'" (`build_llvm_mc.ps1`: "-Temp ... contains '%'") | A `%` in the checkout's path (or in `-Temp`). cmd.exe expands `%...%` in the generated `_build.cmd` (twice on a `CALL` line), and even with that escaped, `cl` rejects a `%` in the path-valued `/D` definitions of the test targets (`D8038: invalid argument`) however it is quoted. Older scripts failed in configure or a few hundred steps into Ninja instead | Move or clone the checkout (or choose a `-Temp`) in a folder without `%` in its path | | 1024 | | `scripts/build_runtime.ps1` stops at once: "The checkout path ... contains '%'" (`build_llvm_mc.ps1`: "-Temp ... contains '%'") | A `%` in the checkout's path (or in `-Temp`). cmd.exe expands `%...%` in the generated `_build.cmd` (twice on a `CALL` line), and even with that escaped, `cl` rejects a `%` in the path-valued `/D` definitions of the test targets (`D8038: invalid argument`) however it is quoted. Older scripts failed in configure or a few hundred steps into Ninja instead | Move or clone the checkout (or choose a `-Temp`) in a folder without `%` in its path | |