1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
|
# Running the GPU tests
The GPU tests are small hand-written RDNA2 programs in `runtime/test/shaders`. They are translated to SPIR-V and run
on your GPU, and the results are compared with what the RDNA2 hardware gives. They need no game files, and every
result helps: submit a pull request adding a record under [`gpu-test-results/`](../gpu-test-results), following
the existing files there and [CONTRIBUTING.md](../CONTRIBUTING.md).
If your GPU is already covered there, testing an open pull request from the review queue in the [coordination
issue][claims] helps more.
This page collects the setup steps and the problems testers have run into so far.
[claims]: https://github.com/ProjectLeonida/mandy/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22
## Quick start on Windows
The shortest path from a fresh Windows PC to a result you can post. The rest of this page has the details and the
problems testers have hit; the steps below link to them.
1. Install, in this order:
- Visual Studio 2022 (Community or Build Tools) with "Desktop development with C++", the "C++ CMake tools for
Windows" component and Windows SDK 10.0.26100 or newer.
- The [Vulkan SDK](https://vulkan.lunarg.com/). It sets `VULKAN_SDK` and puts `spirv-as`, `spirv-val`,
`glslangValidator` and `vulkaninfo` on `PATH`.
- [Python 3.12+](https://www.python.org/downloads/), with "Add python.exe to PATH" ticked, and git.
- Optional but needed for the full suite: `llvm-mc` with the AMDGPU target (see [What you need](#what-you-need)).
`powershell -ExecutionPolicy Bypass -File scripts\build_llvm_mc.ps1` builds one and sets `LLVM_MC` for you.
2. Open a new PowerShell window (so it sees the new `PATH`), clone the repository and build the test programs:
```powershell
git clone --recursive https://github.com/ProjectLeonida/mandy
cd mandy
powershell -ExecutionPolicy Bypass -File scripts\build_runtime.ps1
```
The script uses the newest Visual Studio it finds. If Visual Studio 2026 is also installed and the link step
fails there, build from a "Developer PowerShell for VS 2022" instead:
`cmake -S runtime -B runtime\build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON`, then
`cmake --build runtime\build`.
3. Run the suite twice, once as your GPU runs it and once with wave64 emulation (this matters on NVIDIA and Intel,
whose subgroups are 32 wide, see [GPUs with 32-wide subgroups](#gpus-with-32-wide-subgroups-nvidia-intel-apple)):
```powershell
python -I scripts\run_gpu_tests.py
$env:LEONIDA_W64_EMULATE = "1"; python -I scripts\run_gpu_tests.py; Remove-Item Env:LEONIDA_W64_EMULATE
```
Without `llvm-mc`, add `--disasm-dir tests/semantic/fixtures/disasm` to both commands. That runs the
pre-disassembled subset only, so say "subset" in your result.
Using a prebuilt `runtime-windows` artifact instead of building? Check out the commit that built it and read
this page at that commit (see [Without a compiler](#without-a-compiler-a-ci-built-runtime)): an older
`run_gpu_tests.py` may not take every option shown here. `python -I scripts\run_gpu_tests.py --help`, run from
that checkout, lists the options it does take.
4. Collect what the record needs:
```powershell
git rev-parse HEAD # the commit you built
vulkaninfo --summary # GPU name, driver version, Vulkan version
python -I tools\vk_subgroup_info.py # subgroup range (min_subgroup_size, max_subgroup_size)
cmd /c ver # Windows build
```
5. Copy a Windows file in [`gpu-test-results/`](../gpu-test-results) (`RTX3060Ti-Windows.txt` is a complete one), fill
in your GPU, driver, subgroup range, OS build, commit, tool versions and the last line each run printed
(`N/M passed, K skipped`), and list every `FAIL` line. Then follow [Posting your result](#posting-your-result).
A `FAIL` is worth reporting, not a reason to stop: check [Known problems](#known-problems) first, and say in the
record whether it matched a row there.
### Testing someone else's pull request
Once your GPU has a record, testing open pull requests on it helps more than a second record: review and testing
are what most pull requests wait for. Pick one that changes the translator, the runtime or a GPU test, then:
```powershell
git fetch origin pull/<N>/head:pr-<N>
git checkout pr-<N>
powershell -ExecutionPolicy Bypass -File scripts\build_runtime.ps1 # always rebuild after switching
python -I scripts\run_gpu_tests.py # add --filter <name> for the tests it touches
```
Run `main` the same way for comparison (`git checkout main`, rebuild, run). Then comment on the pull request with
one line per mode, in the form `<GPU>, <driver>, Windows <build>: X of Y passed, K skipped, F failed (native);
main at <commit>: ...`, plus any `FAIL` lines that differ from `main`.
#### A runtime pull request, red and green on your fork's CI
A C++ pull request to `runtime/` can be checked red and green on the Runtime workflow of your own fork, with the
compiler the CI provides, when you cannot build it locally. It uses your fork's Actions minutes, not the project's.
Starting a run on a fork is described in
[Without a compiler: a CI-built runtime](#without-a-compiler-a-ci-built-runtime). A fork run does not replace the pull
request's own CI here, nor someone else's verification: it is one more data point.
1. **Bring your fork's `main` up to date** (`git push <fork> origin/main:main`). "Run workflow" lists only a
workflow that exists on the fork's default branch.
2. **Make two branches from the same `main` commit**, and write that commit down:
- `ci-green/<N>`: `main` plus the pull request, `git merge --no-ff pr-<N>`.
- `ci-red/<N>`: `main` plus only the pull request's test and how it is built: the test file(s) **and** the
test's registration in `runtime/CMakeLists.txt` (`add_executable` / `add_test`). Apply that part of the pull
request's diff (`git diff <merge-base> pr-<N> -- runtime/CMakeLists.txt | git apply --3way`) rather than checking
out the pull request's whole `CMakeLists.txt`, which would also undo what `main` has added since.
3. **Commit the red side's test before pushing.** `git apply --3way` only stages the CMake lines: stage the test
file(s) as well, check with `git diff --cached` that the staged change is just the test and its registration,
and commit it on `ci-red/<N>`. Without that commit the pushed branch is still the plain `main` commit, and the
red run has no such test.
4. **Push both branches to the fork and start the runs**:
`gh workflow run runtime.yml --repo <you>/<fork> --ref ci-green/<N>`, the same with `ci-red/<N>`, then
`gh run list --repo <you>/<fork>` for their ids. A pull request that only adds tests has nothing to remove for
red: run `main` itself as the red side.
When the red side proves nothing:
- **The test includes a file the pull request adds** (a new header next to the code): the red branch does not
compile (`fatal error: ... No such file or directory`). That shows the test needs the new code, not that it catches
the bug. Write "red: does not build without the pull request's new file", not "red: fails".
- **The test and its CMake lines alone pass on `main`**: the test does not exercise the change, or `main` already
behaves. Report "no red".
- **The test is not registered**: if the CMake lines stay on the green side only, the red build has no such test and
`ctest` cannot fail it. Check that the test's name is in the red run's `ctest` output.
Reading the result: open the `windows` job, step "CPU runtime tests"
(`ctest --test-dir runtime/build --output-on-failure --timeout 300`). Each test is a line
`k/T Test #i: <name> .... Passed` (or `***Failed`, `***Not Run (Disabled)`); the summary is
`100% tests passed out of R`, then the tests that did not run and, on a failure, `The following tests FAILED:`.
`R` excludes disabled tests, so report "R/R passed, D disabled (out of T)". A threaded timing test can fail once
on a shared runner: rerun that side before calling it a regression. Other jobs (`linux-gpu-tools`, `wine`; `macos` is
currently disabled) can be red on `main` too; compare with `main`'s latest Runtime run before blaming the pull request.
Comment on the pull request with the two run links, the `main` commit, and per side the test's own line and the
summary (red: ...; green: ...).
#### A D3D12 or Python pull request, red and green on your machine
`scripts/red_green.py` does the same locally for the D3D12 crates' `cargo test` and the Python tests under
`tests/`:
```
python -I scripts/red_green.py <pull request number>
```
- **Green** is current `main` (it fetches `origin/main`) with the pull request merged.
- **Red** is current `main` plus only the pull request's tests. That means its test files (under a `tests` folder,
`*_tests.rs`, `tests.rs`), and, in other Rust files, the hunks that change only `#[cfg(test)]` items. Those are
cherry-picked with a 3-way merge. A conflict, or a pull request that changes no test, is "red not constructible".
A hunk that mixes test and other code stays on the green side only.
- It runs `cargo test --no-fail-fast` for the crates under `d3d12/crates` and `d3d12/apps` the pull request touches,
from `d3d12/` so the pinned toolchain applies. It also runs each changed `tests/**/test*.py` with unittest, after
removing the worktree's `__pycache__` folders so that no test runs stale bytecode. Both sides run in one worktree
with one cargo target dir, red first, under `<git common dir>/red-green` (`--work-dir` to move it). The worktree
and the target dir stay for the next run, which then builds only what changed. The target dir takes several GB.
The worktree stays registered in git, in the default folder as with `--work-dir`: when done, run
`git worktree remove --force <folder>/tree` and delete the folder, or delete the folder and run `git worktree prune`.
- It prints the tests that go from red to green, those that pass on red and fail on green, those that fail on both
(failing on `main` too), and those found on one side only. The verdict is one of: `red then green` (exit 0),
`no red`, `red does not build`, `green fails`, `red not constructible`, `green not constructible`, `no tests ran`,
`compiler crashed` (exit 1). `--json` prints all of it.
- A crashed compiler is not a build error: rustc or a build script ending with a Windows crash status (such as
0xC0000005, an access violation), an internal compiler error, or a failed allocation. That side builds again once,
and the report says so; a second crash gives `compiler crashed`. Run it again later, or on another machine.
- `red does not build` is the case the fork-CI steps above call "does not build without the pull request's new
file": the test needs the new code, which does not show that it catches the bug.
- `--mutate` also checks that the tests catch the change itself, what verifiers do by hand by removing a line of the
fix. After the green side, it undoes each hunk of the pull request's code alone (Rust and Python files it changes,
outside the tests and `#[cfg(test)]` code) and runs the tests again. A hunk is `caught` when a test that went red
then green fails, `not caught` when they all still pass, `does not build` when those tests no longer run,
`compiler crashed` when the compiler crashed twice, or `does not apply` when `main` moved those lines since. Each
mutation starts from the green tree, reset and cleaned, so what a test writes into the tree changes no other. It
tries at most `--mutate-max` hunks (10) and lists the others as `not tried, past --mutate-max`
(`mutations_skipped` in `--json`). A `not caught` hunk is code no new test looks at; it does not change the
verdict.
- Files the pull request adds are not mutated: undoing one would delete it, which only shows that something uses it.
The report lists them (`not mutated, added by the pull request`), so a fix whose code sits in a new file is not
read as covered. When no hunk is undone, the report says why: `nothing to undo` when the pull request changes no
Rust or Python code outside its tests (a test-only one, whose `no red` then says nothing against its test), or
`not run` when no test went red then green. `--json` has these in `mutations_not_run` and `added_not_mutated`.
- Each command of a mutated run (`cargo test`, one Python test file) is stopped with the processes it started after
`--mutate-timeout` seconds (600). The hunk is then `caught by timeout` when a test was running (the undone code
made it hang), or `timed out building` when cargo had not started a test yet, which says nothing about the tests
(raise the option for a crate that builds slowly). When the command ends, the processes it left behind are
stopped too (a Windows job object, the process group elsewhere).
- `--crate <name>` adds a crate, `--no-cargo` or `--no-python` leaves one kind out, `--base <ref>` tests on another
base, and `--no-fetch` uses the refs as they are.
C++ `runtime/` tests are not run by it; use the fork's CI as above.
## What you need
- **Python 3.12+**, which `make_game.py` requires (it stops with "Python 3.12 or newer is needed" on an older one, so
its tests fail there too). `scripts/run_gpu_tests.py` on its own runs on 3.10 or newer.
- **`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
Windows, use one of:
- `scripts\build_llvm_mc.ps1`, which builds a native `llvm-mc.exe` (needs git and the Visual Studio C++ tools);
- conda-forge's `llvm-tools` package, whose Windows build includes the AMDGPU target;
- `llvm-21` in WSL, with `LLVM_MC` set to the whole command:
`LLVM_MC="wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc"`.
On Linux, the distribution's `llvm-mc` on `PATH` is enough, if it is 21 or newer. Debian and Ubuntu's `llvm-21`
installs it only as `llvm-mc-21` and `/usr/lib/llvm-21/bin/llvm-mc`; with `LLVM_MC` unset, the tools take the newest
such versioned install when there is no plain `llvm-mc` (`tools/mc_command.py`). On macOS, Homebrew's `llvm` is
keg-only, so `brew install llvm` doesn't put `llvm-mc` on `PATH`: the pytest suites find it in
`/opt/homebrew/opt/llvm*/bin` (or `/usr/local/opt/llvm*/bin` on Intel), and the other tools need
`LLVM_MC="$(brew --prefix llvm)/bin/llvm-mc"`.
An older `llvm-mc` is not enough for everything. Ubuntu 24.04's default `llvm-18` (18.1.3) works for
`valu_fuzz.py --family mem` and `lds_fuzz.py`, but rejects `ps_sdwa_f16_const`. LLVM 19+ assembles the stock CI
test fixtures. However, full f16 fuzzing with `valu_fuzz.py --family f16` requires LLVM 21+, as LLVM 19 still
rejects `op_sel` on the 16-bit integer VOP3 forms that the fuzzer generates
(`v_ashrrev_i16_e64 ... op_sel:[0,0,0]`: "not a valid operand").
On Windows, ROCm 7.2's bundled `llvm-mc.exe` reports LLVM 21.0.0git. It assembled the TEST-71 memory and
LDS programs but rejected the 16-bit shift used by the f16 generator. To check an assembler directly in
PowerShell, set `$env:LLVM_MC` to the path of its executable and run:
```powershell
'v_lshlrev_b16_e64 v34, v27, v27 op_sel:[0,1,1]' | & $env:LLVM_MC -triple=amdgcn--amdpal -mcpu=gfx1013 -show-encoding
```
If it reports `not a valid operand`, point `LLVM_MC` at a build that accepts this instruction. The Windows
conda-forge `llvm-tools` 23.1.6 package assembled the same f16 programs.
The `shaders` stage needs LLVM 23+ as well, for reasons that have nothing to do with the tests above: 840 of the
2,684 compute programs in the pipeline library come out of LLVM 21.1.8's listings with 79,490 undecodable words, so
the translator refuses them (`fall-through into undecodable words`) and 1,844 of 2,684 reach the output. 23.1.5
decodes those 840 with no rejected word and the stage translates 2,683 of 2,684 (the last is refused for
`s_sethalt`, which the translator does not implement); `scripts\build_llvm_mc.ps1` builds 23.1.5 by default
([design.md](design.md), "Disassembling shaders").
- **SPIRV-Tools** (`spirv-as`, `spirv-val`): part of the Vulkan SDK, or a distribution package.
- **A C++20 compiler, CMake and the Vulkan headers** to build the test programs:
- Windows: the full runtime needs Visual Studio 2022 with "Desktop development with C++" and Windows SDK
10.0.26100 or newer. Install the Vulkan SDK for the backend headers. The standalone tools also compile with llvm-mingw and the Vulkan headers alone.
Running the GPU tests needs a Vulkan loader and a compatible driver.
- Linux: CMake 3.24+, GCC or Clang, and the Vulkan headers and loader. The headers should be recent enough
for `VK_KHR_maintenance8`; older ones still build, but skip what needs it.
- macOS: `brew install llvm molten-vk vulkan-headers vulkan-loader spirv-tools vulkan-tools`. The test programs
load MoltenVK directly; set `LEONIDA_VULKAN_LOADER` to use the Vulkan loader instead.
## Source-only smoke verification (DX-07)
To verify a checkout quickly on any platform without game files, retail binaries, or hardware prerequisites:
```bash
# Standard-library sanity and toolchain discovery (Windows, Linux, macOS)
python -I scripts/smoke.py --prereqs-only
# Fast source-only smoke suite (< 1 second)
python -I scripts/smoke.py --quick
# Full synthetic smoke validation (compileall, no-game-data, CLI help, unit tests)
python -I scripts/smoke.py
# Machine-readable output for scripts and CI
python -I scripts/smoke.py --json
# Also available through the unified developer entry point
python -I scripts/dev.py smoke --quick
```
Exit codes:
- `0`: all requested synthetic checks passed.
- `1`: one or more synthetic checks or tests failed.
- `2`: required environment prerequisites missing (e.g., Python < 3.10) or invalid options.
## Build the test programs
On a Windows runtime build with Vulkan enabled, CMake only registers `d3d12_translated_draw`, `d3d12_rect_list`,
`d3d12_quad_index`, `d3d12_m2_textured`, `d3d12_m2_formats`, `d3d12_m3_frame`, `d3d12_m4_compute` and
`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`.
Without `glslangValidator`, other tests are also omitted, including `d3d12_compute`, `d3d12_draw`,
`d3d12_set0_compute` and `d3d12_mesh`; some registered tests run only part of their checks. These tests can be
**absent**, not reported as skipped, when their build prerequisites are missing, so a passing `ctest` percentage
alone does not establish that they ran. Check the CMake configure messages and list the
configured tests with `ctest --test-dir runtime/build -C RelWithDebInfo -N` before comparing test counts. After
installing missing tools, rerun CMake in an environment where they are visible and rebuild.
Windows, from a "Developer PowerShell for VS 2022" or a plain shell:
```powershell
scripts\build_runtime.ps1 # CMake + Ninja into runtime\build
```
For the standalone Vulkan tools, put llvm-mingw on `PATH` and point CMake at the directory containing `vulkan/vulkan.h`:
```powershell
cmake -S runtime -B runtime/build/vulkan -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF -DVulkan_INCLUDE_DIR=C:/Vulkan-Headers/include
cmake --build runtime/build/vulkan --parallel --target vk_harness vk_texture_test vk_sampler_test vk_compute_test vk_store_test vk_bindless_test
```
Pass `--build runtime/build/vulkan` to `scripts/run_gpu_tests.py`.
If you configure with CMake's Visual Studio generator instead, the programs end up in `runtime\build\Release` (or
`RelWithDebInfo`); pass that folder to `--build` below.
Linux and macOS:
```sh
cmake -S runtime -B runtime/build/linux
cmake --build runtime/build/linux --parallel
```
On macOS, add `-DVulkan_INCLUDE_DIR=/opt/homebrew/include` to the first command.
The test programs and `scripts/run_gpu_tests.py` should come from the same commit. Some checks tolerate an older
binary (`unpinned_subgroup_skip`), but mixing them can report false failures in the compute tests: 28 `cs_*`
failures on both an RTX 5070 Ti Laptop and a Radeon 610M with the `426023a` script and `48ad23f` binaries, where
either matching pair is clean. If you cannot build locally, the `runtime-windows` artifact of the Runtime workflow
belongs to the commit that built it; check that commit out as well.
### Without a compiler: a CI-built runtime
If you cannot build the test programs locally, the Runtime workflow publishes them as the `runtime-windows`
artifact of its own commit. It holds Windows executables, so use them on Windows or under Wine as in the
section below; GitHub expires the artifact after 7 days. Because the legacy C++ `runtime/` is deprecated in favor
of `d3d12/` and the new Rust Vulkan runtime (in progress), `.github/workflows/runtime.yml` no longer runs
automatically on pushes or pull requests; start a run of the commit you want with "Run workflow"
(`workflow_dispatch`) or take an existing run under Actions -> Runtime and check out the commit it built. Download
and unzip `runtime-windows`, and pass the unzipped folder to `--build`:
```sh
python -I scripts/run_gpu_tests.py --build <unzipped runtime-windows>
```
If you also have neither `llvm-mc` nor SPIRV-Tools (`spirv-as` / `spirv-val`) installed, `--disasm-dir` runs the
pre-disassembled subset in `tests/semantic/fixtures/disasm` and `--assembler python` (the default under `auto` when
`spirv-as` is absent) assembles SPIR-V with `tools/spirv_asm.py`:
```sh
python -I scripts/run_gpu_tests.py --build <unzipped runtime-windows> --disasm-dir tests/semantic/fixtures/disasm --assembler python
```
`build.py` and `check.py` take the same folder as their second argument:
```sh
python -I runtime/test/shaders/build.py <out dir>
python -I runtime/test/shaders/check.py <out dir> <unzipped runtime-windows>
```
The artifact belongs to the commit that built it, so run the scripts from that commit as well (see the note above).
#### Run one test from the Windows artifact
For a focused GPU check without building locally, extract the artifact and open
PowerShell in the directory containing the test executable. Keep the extracted
files together so the test can find any fixtures relative to that directory.
For example, to run the synthetic depth/stencil resolve test without game files:
```powershell
.\d3d12_depth_resolve_test.exe
Write-Output "Test exit code: $LASTEXITCODE"
```
Report the executable name, the workflow run and its commit, your GPU and driver,
the exit code, and the test summary in your `gpu-test-results/` record.
Label it as a single-test run so the result is easy to distinguish from a full suite run.
## Run them
The whole suite, assembled, translated and run in one go:
```sh
python -I scripts/run_gpu_tests.py --build runtime/build/linux # Windows: the default runtime\build
```
`--filter <text>` runs only matching tests, and `--work <dir>` keeps the intermediate files.
Add `--require-pass` when verifying a specific path: an all-skipped run exits 1 instead of 0.
Skips still appear as `SKIP`, and individual skips are allowed if at least one test passes and none fail.
A GPU test program that runs longer than 120 seconds is killed and counted as a failure, so a hung driver does
not stall the suite. `LEONIDA_GPU_TEST_TIMEOUT` sets the limit in seconds for `check.py`, `run_gpu_tests.py` and
the `valu_fuzz.py` translator oracle; `0` turns the limit off.
**Rebuild the test programs after pulling.** The programs carry the V# and push-constant layout the translator expects. An executable from an older commit still loads and runs every shader, so a stale `vk_compute_test` does not fail loudly: when a newer translator starts enforcing a descriptor rule the old program does not set up (the raw V# in `pc[2..3]`, for one), every compute test reports the untouched `0xEEEEEEEE` fill pattern and the run looks like a translator regression. If all the compute tests in a run return that pattern, rebuild first (`cmake --build runtime/build/linux`, or `cmake --build runtime\build` on Windows) and run again before reading anything into the words.
The two-step form, which `CONTRIBUTING.md` describes:
```sh
python -I runtime/test/shaders/build.py <out dir>
python -I runtime/test/shaders/check.py <out dir> <folder with the test programs>
```
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").
On Windows, `run_gpu_tests.py` assembles and translates the D3D-78 fixture and runs the UAV readback and WARP
comparison from the same build folder. Use `--filter cs_texture_uav` to run only this case:
```powershell
$env:LEONIDA_VK_VALIDATION = "1"
python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_texture_uav
```
Use the actual configuration subfolder for the executables with a multi-config generator. The native Windows
case reports SKIP without WARP or a sufficiently capable Vulkan device; failed translation, a missing test
executable on Windows, and readback mismatches fail the runner. Devices without sliced 3D views still run the 1D,
array and whole-mip cases and check that partial views are refused.
CTest runs the same D3D-78 descriptor creation, copy, range/refusal and clear checks with `--descriptors-only`.
That mode requires Vulkan, but not a translated shader or WARP. The GPU runner still exercises dispatch and readback.
Use `--filter cs_imgload_mip` to check 2D `image_load_mip` on FLOAT (UNORM), UINT and SINT sampled views with
both full-width and D16 loads; mip 0 contains decoy data and mip 1 holds the expected texels.
`vk_compute_test`, `vk_bindless_test` and `vk_image_fuzz` read `LEONIDA_VK_VALIDATION` too (`vk_compute_test`
through `runtime/test/vk_validation.h`): each validation message goes to stderr and a validation error makes the
program exit 1, so `LEONIDA_VK_VALIDATION=1 VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1 python scripts/run_gpu_tests.py` fails
every compute test the layer objects to; the program's output ends with "N validation errors". The other shader test
programs (`vk_harness`, `vk_store_test`, `vk_texture_test`, `vk_sampler_test`) don't read it.
To check one, load the layer through the loader and run it by hand, for example
`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1 vk_harness vs.spv ps.spv out.raw`.
The layer prints its messages to stdout and the program's exit status doesn't change, and `run_gpu_tests.py` shows
only each test's last line, so read the program's own output. GPU-assisted validation (`..._GPUAV_ENABLE=1`)
instruments the translated shaders and reports what they actually do at run time: out-of-bounds buffer accesses, and
an image read through a view whose numeric type doesn't match the shader's (a T# FORMAT that disagrees with the
bound view). It runs on llvmpipe. `VK_KHRONOS_VALIDATION_VALIDATE_SYNC=1` adds synchronization validation.
## The Windows runtime on Linux, under Wine or Proton
The Linux build above makes only the Vulkan programs. The loader (`gta6rt`), its shims and their tests are Windows
programs; `runtime/cmake/clang-cl-xwin.cmake` cross-compiles them on Linux with clang-cl and lld-link (LLVM 19+, but not 22.1.7 or 22.1.8 (see Known problems): the
MSVC STL that xwin lays out rejects older Clang; versioned names go in with `-DCMAKE_CXX_COMPILER=clang-cl-19` etc.)
against an MSVC CRT and Windows SDK that [xwin](https://github.com/Jake-Shadle/xwin) downloads from Microsoft
(running it means accepting Microsoft's licence), and `ctest` runs them through Wine:
```sh
xwin --accept-license --sdk-version 10.0.26100 splat --use-winsysroot-style --preserve-ms-arch-notation \
--output ~/.local/share/xwin-sdk
cmake -S runtime -B runtime/build/windows --toolchain "$PWD/runtime/cmake/clang-cl-xwin.cmake" \
-DXWIN_DIR="$HOME/.local/share/xwin-sdk"
cmake --build runtime/build/windows --parallel
WINEPREFIX="$HOME/.local/share/leonida-wine" ctest --test-dir runtime/build/windows
```
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
x86_64 headers for Win11SDK_10.0.26100".
On a Mac (Apple Silicon) the same steps work with Homebrew's LLVM and lld (`brew install llvm lld xwin`; the cross
tools are `clang-cl`, `lld-link`, `llvm-lib`, `llvm-rc` and `llvm-mt` under `$(brew --prefix)/opt/llvm/bin` and
`$(brew --prefix)/opt/lld/bin`) and the WineHQ macOS build, an x86-64 Wine that runs under Rosetta. Homebrew's
`wine-stable` cask is disabled (it does not pass Gatekeeper), so take the archive the cask names from its
`url` and check it against the cask's `sha256`. Configure with `-DCMAKE_CROSSCOMPILING_EMULATOR=<path to its wine>`
when `wine` is not on `PATH`; a path with spaces (`Wine Stable.app`) is easiest behind a small wrapper script. Run
`ctest` with `ROSETTA_ADVERTISE_AVX=1`: without it Rosetta hides AVX from Wine, and the `run_tiny_*` loader tests stop
with "the game's code needs AVX, and this CPU or OS lacks AVX, OSXSAVE". Measured on an Apple M3 (macOS 26.5.1,
Wine 11.0, its bundled MoltenVK 1.4.1) at `main` `fbf100b1b`: 1084 targets build, and `ctest -j 6 --timeout 120`
gives 461 of 482 passed (440 without `ROSETTA_ADVERTISE_AVX`). The display is the Mac's own, so no virtual X server
is needed.
On a machine without a display (a server, a container, WSL without WSLg), Wine has no graphics driver to create a
Vulkan instance with, so every Vulkan test fails with `vkCreateInstance failed (VkResult -3)` and, with
`WINEDEBUG=+vulkan`, "Failed to load Wine graphics driver supporting Vulkan". Run the tests under a virtual X server,
as CI does: `WINEPREFIX="$HOME/.local/share/leonida-wine" xvfb-run -a ctest --test-dir runtime/build/windows`
(packages `xvfb` and `xauth`, which `xvfb-run` needs). With Mesa installed, the tests then run on llvmpipe.
A virtual X server has no presentable surface, so presentation cannot be judged under it. With a real display (here
Wine 11.22 on a Wayland session, through XWayland) the same 123-test list gives 92 passed, 6 failed and 25 skipped,
and `vk_presenter_sync`, `xbox_present` and `dxgi_swapchain` pass, while they fail under `xvfb-run`. Use a real
compositor for those three. Six still failed with a real display: `device_proxy`, `d3d12_xs_root_signature`,
`xdxr_build`, `d3d12_xdxr_rt`, `d3d12_present` and `d3d12_compute`.
Run one after another as above, the suite takes several seconds per test, although a test started by hand takes 0.1 to
1 second. Four settings make a local run of the cross-build much faster:
```sh
export WINEPREFIX="$HOME/.local/share/leonida-wine" WINEDEBUG=-all \
WINEDLLOVERRIDES="winedbg.exe=d;winemenubuilder.exe=d"
mkdir -p "$WINEPREFIX"
xvfb-run -a sh -c 'wineserver -p; wine wineboot -u </dev/null >/dev/null 2>&1
ctest --test-dir runtime/build/windows -j 6 --timeout 120; wineserver -k'
```
Start the server before `wineboot`: `wineserver -p` does nothing while another server runs for the prefix. Run
`wineboot` after it, with its output thrown away: the first Wine program a server runs starts the prefix's services,
which keep that program's output open for as long as the server lives, so a first test that started them would wait
for the end of its output until the timeout.
- `wineserver -p` keeps one Wine server for the whole run; without it a new one starts for each test.
- `winedbg.exe=d`: a test that crashes otherwise waits in Wine's debugger until its timeout.
- `winemenubuilder.exe=d`: without it `wineboot` on a fresh prefix writes `wine-extension-*.desktop` files and the MIME
cache into `~/.local/share/applications`, pointing your file associations at the test prefix. Set it before the
prefix is first made.
- `ctest -j 6` runs six tests at a time. The tests that share files under the temp directory (see "Known problems")
can then fail now and then; rerun such a failure on its own before you count it.
Measured with Wine 11.22 on llvmpipe, 40 tests of a clang-cl build (`ctest -R '^(d3d12_[a-c]|vk_[a-d]|xg)'`), adding
one setting at a time:
| Settings | Seconds |
|---|---|
| As above: one test after another | 179 |
| `wineserver -p` (and `wineboot` after it) | 35 |
| and `WINEDEBUG=-all` | 35 |
| and `winedbg.exe=d` | 35 |
| and `ctest -j 6` | 5.6 |
| `ctest -j 6` and the overrides, without `wineserver -p` | 18 |
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
starting and stopping. `WINEDEBUG=-all` and `winedbg.exe=d` changed nothing here because no test crashed; with a crash,
`winedbg.exe=d` saves the rest of that test's timeout. The full suite (about 310 tests) took about 28 minutes run one
after another, and 67 seconds with all four settings for two devices (llvmpipe and an integrated GPU) run at the same
time. `scripts/run_wine_tests.py` (below) does the same: 32 seconds for those 40 tests with `--jobs 1`, 6 with
`--jobs 6`, and 19 seconds for all 312 tests with `--jobs 6`.
The build type defaults to `RelWithDebInfo`: xwin leaves out the debug CRT, so `Debug` needs `--include-debug-libs`.
`make_game.py`'s `runtime` stage makes this same build on Linux when the tools and the SDK are there (`--runtime-build
runtime/build/windows` takes a folder made by hand like a Windows build). CMake packages are
looked up only inside the SDK folder, so a Windows SDL3 for the GameInput shim is passed as `-DSDL3_DIR=<its
cmake folder>` (`CMAKE_PREFIX_PATH` is not searched here).
### Proton's wine
Proton's wine runs the suite against the D3D12 a Proton game gets: the prefix's vkd3d-proton and DXVK. Start any
program once with `proton run` so that it lays down the prefix libraries; the `STEAM_COMPAT_DATA_PATH` folder has to
exist first, because Proton opens `<data>/pfx.lock` in it:
```sh
mkdir -p ~/.local/share/leonida-proton
STEAM_COMPAT_DATA_PATH="$HOME/.local/share/leonida-proton" \
STEAM_COMPAT_CLIENT_INSTALL_PATH="$HOME/.local/share/Steam" \
"$HOME/.local/share/Steam/steamapps/common/Proton 11.0/proton" run cmd /c exit 0
cmake -S runtime -B runtime/build/proton --toolchain "$PWD/runtime/cmake/clang-cl-xwin.cmake" \
-DXWIN_DIR="$HOME/.local/share/xwin-sdk" \
-DCMAKE_CROSSCOMPILING_EMULATOR="$HOME/.local/share/Steam/steamapps/common/Proton 11.0/files/bin/wine"
cmake --build runtime/build/proton --parallel 2
WINEPREFIX="$HOME/.local/share/leonida-proton/pfx" WINEDLLOVERRIDES="d3d12=n;d3d12core=n;dxgi=n" \
WINEDEBUG=-all ctest --test-dir runtime/build/proton
```
`proton run` itself doesn't pass the program's output on, so the tests can't run through it. `WINEPREFIX` must be
the prefix the emulator made: a prefix from another wine version fails every test with "wine client error: version
mismatch". The tests need a real display here as well.
Measured on 2026-11-23 with Proton 11.0 (wine-11.0, vkd3d-proton 3.0) on an RX 7600 XT (radv): 155 tests
registered, 154 run, 127 passed, 20 skipped, one disabled and seven failed. The skips are the usual ones (game data,
`LEONIDA_FIRST_LIGHT_DIR`, no independent Vulkan queue for `d3d12_queue_wait`, and so on). All seven failures are in
the comparisons with the host D3D12, which is vkd3d-proton here:
- `d3d12_fence_timing`, `d3d12_private_data`, `d3d12_sampler2` and `d3d12_subresource_copy` disagree with
vkd3d-proton on a return value or a field it writes (`GetCustomHeapProperties` of a custom heap type,
`SetName(nullptr)`, unknown sampler flags, CPU-copy boxes).
- `d3d12_r9g9b9e5_uav` compares a clear with WARP, and Proton's dxgi answers `EnumWarpAdapter` with the first
hardware adapter ("WARP not supported"), so the compared value is the hardware's.
- `d3d12_compute` and `d3d12_method_variants` crash with an access violation inside `d3d12core.dll` on their
null-argument checks, not on device creation: `GetCachedBlob(nullptr)` and `CreateCommandQueue1(nullptr, ...)`
are not validated by vkd3d-proton (filed upstream as vkd3d-proton issues 3512 and 3513; Wine's builtin d3d12
crashes on the queue one too). `d3d12_compute` passes with only `WINEDLLOVERRIDES="dxgi=n"`, where the host is
Wine's own d3d12 and the comparison skips.
The host's D3D12 here is Wine's vkd3d or vkd3d-proton, not Microsoft's runtime, and Proton's `EnumWarpAdapter`
returns the hardware adapter, so "WARP" is vkd3d-proton on the GPU. Most tests that compare with the host or WARP
skip that comparison under Wine and Proton (`runtime/test/host_wine.h`), and most of them still check the layer
against Microsoft's answers recorded in the test (`d3d12_subresource_copy` and `d3d12_private_data` keep theirs in
`d3d12_subresource_copy_answers.h` and `d3d12_private_data_answers.h`).
A few still compare with the host (`root_sig`, `device_proxy`, and some of `d3d12_vulkan_device`'s cases), so some
of those fail for that reason.
### Run a Windows CI artifact under Wine
The [Runtime workflow](https://github.com/ProjectLeonida/mandy/actions/workflows/runtime.yml) uploads
`runtime-windows` for seven days. It contains the Windows executables, DLLs,
synthetic test shaders, CTest inventory and the path of the Windows checkout. From a clean checkout of the commit
used by the Windows job, set `run_id` to the Actions run ID and download the artifact to `runtime/build`:
```sh
gh run download "$run_id" --repo ProjectLeonida/mandy --name runtime-windows --dir runtime/build
WINE=wine WINEPREFIX="$(mktemp -d)" WINEDLLOVERRIDES="mscoree,mshtml=" WINEDEBUG=-all \
bash scripts/run_wine_session.sh python3 -I scripts/run_wine_tests.py \
--tests runtime/build/ctest.json \
--windows-root "$(cat runtime/build/windows-root.txt)" \
--require loader --require pe_loader --require loader_tls --require unimplemented_policy \
--require run_tiny_game --require run_tiny_game_exit_code
```
The session script initializes a dedicated prefix and stops its Wine processes at exit, with the Wine named by
`WINE` (default `wine`) and the `wineserver` next to it (or `WINESERVER`), so Proton's or UMU-Proton's
`files/bin/wine` works without a system Wine. On a headless host,
put `xvfb-run -a` before `bash` so prefix initialization and the tests share one virtual display. The test runner
maps the recorded Windows drive to the Linux checkout for shaders referenced by absolute Windows paths. It keeps one
wineserver alive for the run and stops it at the end, and adds `winedbg.exe=d;winemenubuilder.exe=d` to each test's
`WINEDLLOVERRIDES` (an entry of yours for the same program wins). `--jobs N` runs N tests at a time (default 1): tests
marked `RUN_SERIAL` run alone, tests that share a `RESOURCE_LOCK` never overlap, and the verdicts are printed in the
same order as with `--jobs 1`; the tests that share temp files can fail now and then in parallel (see "Known
problems"). It prints
every verdict and returns a failure status if any required test fails, skips or is missing. Check the printed
verdicts for failures outside the required set.
## GPUs with 32-wide subgroups (NVIDIA, Intel, Apple)
The game's shaders are mostly wave64. A GPU that can't run 64-wide compute subgroups skips the wave64 tests
(`cs_wavemask`, `cs_wave64_ballot`, `cs_wm_*`, `cs_w64x_*`, `ms_w64x_ballot`); that's expected, not a failure.
To test the wave64 emulation that makes them exact on these GPUs, set `LEONIDA_W64_EMULATE=1`, **for both
`build.py` and `check.py`**: `build.py` translates with emulation only when it's set. If you set it only for
`check.py`, the shaders are checked against the emulated expectations without being emulated, and every wave64 test
fails.
`scripts/bench_wave64.py` normally compares emulation on AMD and NVIDIA with a native-wave64 AMD reference. On a
machine without that reference, use `--emulated-only` to time the current Vulkan device instead:
```sh
export LLVM_MC="$(brew --prefix llvm)/bin/llvm-mc" # bench_wave64.py reads --llvm-mc from LLVM_MC
python3 -I scripts/bench_wave64.py --build runtime/build/linux --emulated-only
```
This mode builds only the emulated shader, requires every benchmark process to finish the shader's `0 mismatches`
self-check and requires the output hash to stay identical between processes. It says `no native reference` in the
result: the run establishes deterministic self-consistency on that device, not equality with native Wave64. The mode
leaves `LEONIDA_VK_DEVICE`, `VK_DRIVER_FILES` and `VK_LOADER_DRIVERS_SELECT` untouched; on macOS the test tools use
MoltenVK directly by default.
`ps_bitmask_perm` is a wave32 pixel shader, and a pixel shader's width can't be requested on every device. Intel
drivers report subgroups of 8..32 and may run it 8 or 16 wide; its second pattern reads lanes 16-31, which then
don't run. The test skips when the frame shows that (#1318), and the translation gives 0 for a source lane that
isn't running instead of an undefined value (#618). At 16 wide the first pattern stays inside the running lanes, so
it is still checked before the skip.
The wave32 tests whose words depend on 32 lanes (`cs_dpp*`, `cs_bpermute32`, `cs_exec_const`, `cs_wqm_w32`,
`cs_w32_*`, and in `check.py` every compute test the index records at 32) ask `vk_compute_test` for 32 lanes
(`VKC_SUBGROUP_SIZE=32`). MoltenVK can't require a subgroup size (`requiredSubgroupSizeStages` is 0, sizes 4..32),
but its default is 32 and the translator's SPIR-V 1.5 doesn't allow varying sizes, so Vulkan fixes the size at 32.
`vk_compute_test` checks that with a probe shader before the test (where the device has compute ballots): same
local size and flags as the test's `main`, every subgroup 32 lanes wide by its own lane numbers and ballot, and the
lanes in invocation order, which the translator assumes. It prints `compute subgroup size: 32 (observed: ...)` and
the test is judged. A wrong width fails the test with `observed wrong` and the first wrong invocation; 32-lane
subgroups in another order print `not available`, a skip. Measured
on an Apple M3 Max (MoltenVK 1.4.2 and 1.4.3): 17 workgroup shapes from 1 to 1024 invocations, partial last
subgroups, with and without full subgroups and register pressure, all 32 lanes in order. A device whose default
isn't the requested size still prints `not available`, and those tests skip.
`cs_w32_salu_ext` runs 38 scalar ALU ops that no other fixture runs: `s_sub_i32`, `s_andn2_b32`, `s_orn2_b32`,
`s_xor_b32`, `s_ashr_i32`, `s_mul_hi_u32`, `s_lshl3_add_u32`, `s_lshl4_add_u32`, `s_pack_ll_b32_b16`,
`s_pack_hh_b32_b16`, `s_abs_i32`, `s_bcnt0_i32_b32`, `s_bitset0_b32`, `s_bitset1_b32`, `s_brev_b32`, `s_flbit_i32`,
`s_flbit_i32_b32`, `s_sext_i32_i8`, the six `s_cmp_*_i32`, `s_cmp_gt_u32`, `s_cmp_le_u32`, `s_bitcmp0_b32`,
`s_bitcmp1_b32`, `s_addk_i32`, `s_mulk_i32`, `s_cmovk_i32`, `s_ashr_i64`, `s_lshl_b64`, `s_lshr_b64`,
`s_bcnt0_i32_b64`, `s_bitset0_b64`, `s_cmov_b64` and `s_ff0_i32_b64`. Its sixteen operand words arrive in `s4..s19`
through `VKC_SGPRS`, so each op reaches the driver as SPIR-V: a scalar op on literals is folded by the translator
(the "Chained scalar constant folding" row of [design.md](design.md)) and only its result is stored. One thread stores
every destination and four words of SCC bits: SCC after each op that writes it, each run on operands that set it
and on operands that clear it; each compare and bit test both ways, the signed and the unsigned ones on words that
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
words are literals in `check.py`, derived in the fixture's header, and `tests/test_gpu_salu_ext.py` recomputes them
from the fixture's own instruction lines with the reference of `tools/salu_diff.py`, the model that was compared
with hardware. Both GPU runners compare the whole 80-word heap, the untouched fill after the results included. Run
it alone with `python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_salu_ext --require-pass`.
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
translator rules broken one at a time each failed it on both: `s_ashr_i32` shifting in zeros (word 8),
`s_lshlN_add_u32` taking SCC from the add's carry alone (word 69), `s_abs_i32` negating (word 17), `s_mulk_i32` and
`s_addk_i32` zero-extending their immediate (words 37 and 21), `s_cmovk_i32` ignoring SCC (word 38), the 64-bit
shifts taking their count modulo 32 and `s_ashr_i64` shifting in zeros (word 51), and the 64-bit shifts taking SCC
from the low dword alone (word 72).
`cs_w32_shift64` checks `v_lshlrev_b64`, `v_lshrrev_b64` and `v_ashrrev_i64` with 64 memory-fed cases:
eight boundary values crossed with counts 0, 1, 31, 32, 33, 63, 64 and 65. The expected values come from Python
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).
It also overlaps the destination with the count, one source word or the entire source pair. Both GPU runners
compare all 640 heap words (384 results and 256 unchanged input words); the operands are loaded at runtime so
the driver cannot replace the tested operations with constant-folded answers. Run it alone with
`python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_shift64 --require-pass`.
It needs shader Int64 support; a device that lacks it reports a skip. This is a wave32 test of 64-bit values,
independent of wave64 emulation. On RTX 3080 Ti (616.92, Windows 11), all 640 words matched; replacing the count
mask with 31 or the arithmetic shift with a logical shift made the test fail at words 66 and 251 respectively.
`cs_w32_frexp_ldexp` checks `v_frexp_mant_f32`, `v_frexp_exp_i32_f32`, `v_ldexp_f32`, `v_frexp_mant_f64` and
`v_frexp_exp_i32_f64`, which the translator computes with integer ops on the float's words. 64 records of a binary32
value, an `ldexp` exponent and a binary64 value are loaded at run time: normals, the clamp of the exponent at ±512
and beyond, results that overflow to an infinity and that fall below the smallest normal, binary32 denormals (read
as zero), binary64 subnormals (normalized; single fraction bits on both sides of the dword boundary and patterns
with several), zeros, infinities and NaNs. Each thread stores the five results, `v_frexp_mant_f32` with a `neg`
source and `v_ldexp_f32` with an `abs` source run with the odd threads turned off, whose destination must keep the
word it held. The expected words come from an oracle written from the rows of [design.md](design.md)
(`frexp_mant_f32`, `frexp_exp_i32_f32`, `ldexp_f32` and `frexp_f64` in `check.py`), and
`tests/test_gpu_frexp_ldexp.py` checks it against `math.frexp` and `math.ldexp` wherever those agree with the
hardware. Both GPU runners compare all 768 heap words, the 256 unchanged input words included. Run it alone with
`python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_frexp_ldexp --require-pass`.
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
the binary32 ops still applied `neg` and `abs` with `OpFNegate` and `FAbs`, six words differed on the 4070 Ti and none
on llvmpipe: every NaN source under a modifier came back as `0x7fffffff`, the driver's default NaN (word 419 is the
first: the mantissa of the negated `0x7fc00000`). Rules broken one at a time each failed the test on both devices:
the mantissa given the exponent field 127 (word 0) or, for binary64, 1023 (word 5), the exponent subtracting 127
(word 1), `v_ldexp_f32` without its clamp (word 258) or overflowing to the largest finite value (word 106), a
binary32 denormal not read as zero (word 352), the binary64 subnormal exponent off by one in the low or in the high
dword (words 134 and 150), and the fixture without its `v_cmpx` (word 15).
`cs_w32_cmp_f64` checks the 32 binary64 vector compares, `v_cmp_*_f64` into VCC and `v_cmpx_*_f64` on EXEC, with
256 memory-fed operand pairs: the product of 16 values (±inf, ±max, the 1-ULP neighbours of ±1, the smallest
subnormals, ±0, the smallest normal, a NaN whose payload is only in the low dword and a negative quiet NaN). Each
thread stores one bit per predicate for both forms, a bit for `tru` run with the odd threads turned off (an inactive
lane gets VCC 0 from `v_cmp_` and stays off through `v_cmpx_`) and two bits for `lt` and `nge` with VOP3 `abs`/`neg`.
The expected words come from Python floats (`cmp_f64_words` in `check.py`): IEEE-754 ordering, with every pair that
has a NaN unordered. Both GPU runners compare all 1536 heap words (512 result words and 1024 unchanged input words);
the operands are loaded at run time, so neither the translator nor the driver can fold a compare. Run it alone with
`python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_cmp_f64 --require-pass`.
It is a wave32 test and no step of it needs a particular subgroup width, so it also runs on llvmpipe; the SGPR-pair
and constant operand forms are CPU-checked only (`tests/semantic/test_cmp_f64.py`). On an RTX 4070 Ti (NVIDIA
620.70.06, Linux) all 1536 words matched, and seven translator rules broken one at a time each failed it: no `-0`
canonicalization at word 206, a NaN test that ignores the low dword at word 28, an ordering key without the low
dword at word 70, the raw result written to an inactive lane's VCC at word 2, `v_cmpx_` replacing EXEC at word 3,
`abs` ignored and `nlt` lowered as the negation of `le` at word 0.
`cs_w32_round_f64` checks `v_trunc_f64`, `v_ceil_f64`, `v_rndne_f64` and `v_floor_f64`, which the translator gives
to the driver's double-precision `Trunc`, `Ceil`, `RoundEven` and `Floor` (`shaderFloat64`). 64 inputs are loaded at
run time: signed zeros, the smallest subnormals and normals, values around 0.5 and 1 (the largest value below 0.5
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,
the largest finite value, the infinities, and quiet and signalling NaNs. Each thread stores the four roundings,
`v_trunc_f64` with a `neg` source, `v_ceil_f64` with an `abs` source, a `v_floor_f64` whose destination pair overlaps
its source pair, and a `v_rndne_f64` run with the odd threads turned off, whose destination must keep the pair it
held. The expected words come from Python (`round_f64` in `check.py`: exact IEEE-754, the result keeping its
source's sign), and `tests/test_gpu_round_f64.py` checks that oracle against exact rational rounding. All 1152 heap
words are compared exactly, the 128 unchanged input words included: a NaN and a subnormal are rounded by the
translated code with integer ops and not by the driver, as the row in [design.md](design.md) says. (llvmpipe gets
one allowance, for what it does to `Trunc` and `RoundEven` on some CPUs; see below.) Run it alone with
`python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_round_f64 --require-pass`.
It needs `shaderFloat64`; a device without it reports a skip.
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
match. While those two kinds of input still went to the driver's function, 15 of the 512 results differed on the
4070 Ti, those of the two signalling NaNs, which came back quiet with sign and payload kept (`0x7ff0000000000001`
gave `0x7ff8000000000001`), and five more on llvmpipe, which read the two smallest subnormals as zero (`v_ceil_f64`
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
time each failed the test on both devices: a NaN left to the driver (word 784), the NaN and subnormal tests ignoring
the low dword, `v_ceil_f64` or `v_floor_f64` lifting the subnormal of the wrong sign (words 34 and 38), a subnormal's
result losing its sign (word 40), a NaN's low word dropped (word 784), `rndne` lowered as `floor(x + 0.5)` (word 20,
the sign of -0), `trunc` or `ceil` lowered as `Floor`, the `neg` or the `abs` source modifier ignored (words 8 and
26), the two result words swapped (word 8), and the fixture without its `v_cmpx` (word 30). Two changes are not
caught everywhere: a subnormal left to the driver fails on llvmpipe (word 34) and passes on the 4070 Ti, which keeps
binary64 denormals, and `RoundEven` replaced by GLSL `Round` changes nothing on either device, since both send a tie
to the even integer.
llvmpipe gave those results on a CPU with AVX-512. On one without it, `Trunc` and `RoundEven` of a double go through
the code llvmpipe has for a float, because its double vectors are twice its native width (512 bits at the usual 256)
and it only has the exact rounding for a width the CPU has an extension for. There a magnitude above 2^24 comes back
unchanged (`v_trunc_f64` of 123456789.0625 is 123456789.0625) and `RoundEven` of a smaller one can give the other
neighbouring integer (1 for 1.5, 0 for the value just above 0.5): 48 of the 512 results, the same 48 with Mesa
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
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
unchanged fixture passed or failed there by the machine it got. On llvmpipe the judge therefore lets `v_trunc_f64`
and `v_rndne_f64` return what that path can give, the source itself above 2^24 and either neighbouring integer
from 0.5 up to it, and nothing else (`ROUND_F64_FLOAT_PATH` in `check.py`); `v_floor_f64`, `v_ceil_f64`, the kept
pair and the inputs stay exact there, and no other device gets the allowance. `LP_NATIVE_VECTOR_WIDTH=128` makes
llvmpipe exact on a CPU with AVX.
## Wave64 pixel, vertex and geometry shaders (`w64_graphics.py`)
Graphics stages have no emulation: on a 32-wide subgroup a wave64 VS, PS or GS runs as two 32-lane halves, and the
translator marks each one tier A, B or C by whether that can change its results (`docs/design.md`, "Wave64 graphics:
partition invariance"). `runtime/test/shaders/w64_graphics.py` checks those tiers on a GPU by running each `ps_w64_*`,
`vs_w64_*` and `gs_w64_*` fixture at wave64 and at wave32: tier A and B must give the same words both ways, tier C
must differ. CI has no GPU, and the CPU wave interpreter (`tests/semantic/test_wave64_halves.py`) runs vertex shaders
only, so this comparison needs real hardware.
Vulkan can require a subgroup size for pixel shaders (`VKH_SUBGROUP_SIZE`) where the driver lists the fragment stage in
`requiredSubgroupSizeStages`, but not for vertex or geometry shaders, so those two use a RADV switch instead: on GFX10
and newer, RADV runs them as wave64 by default and as wave32 with `RADV_PERFTEST=gewave32`. The runner sets it itself
and checks the result with a probe fixture per stage (`vs_w64_c_lane_id`, `gs_w64_c_lane_id`): the largest lane id
must reach 32 at wave64 and stay below 32 at wave32. On other drivers (AMD Windows, NVIDIA, Intel) the probe sees no
change, and only the default-size checks run; tier C is then a `SKIP`, not a failure. Not every driver lists the
fragment stage either: on an RX 6800 (RDNA2) with AMD's Windows driver 26.11.2 the list is compute only, no size can
be requested for pixel shaders (they run at the 64-wide default), and the tier C pixel fixtures are a `SKIP` too
(2026-11-22, [d3d12_vulkan.md](d3d12_vulkan.md), "Subgroup size").
Build and run it on Linux with RADV, pinned to one GPU (`LEONIDA_VK_DEVICE`, see "Choosing the GPU"):
```sh
cmake -S runtime -B runtime/build/linux -G Ninja && cmake --build runtime/build/linux --target vk_harness
python3 -I runtime/test/shaders/build.py /tmp/w64g
LEONIDA_VK_DEVICE=9070 python3 -I runtime/test/shaders/w64_graphics.py /tmp/w64g runtime/build/linux
LEONIDA_VK_DEVICE=9070 python3 -I runtime/test/shaders/w64_graphics.py /tmp/w64g runtime/build/linux gs_w64_a_ring
```
Each line prints `ok`, a `SKIP` with its reason, or what differed. To add a fixture:
1. Write `runtime/test/shaders/{ps,vs,gs}_w64_<tier>_<name>.asm` with `; mattr: +wavefrontsize64,-wavefrontsize32`
and a header that says what every result word is. Vertex and geometry fixtures store four words per vertex or
per triangle to the heap record at `0x1000 + 16 * i`, and every word of a tier A or B fixture is a function of
`i` alone, never of the lane (copy the store from `vs_w64_a_skip` or `gs_w64_a_ring`).
2. Add it to `FIXTURES` in `w64_graphics.py` with its tier and a function that gives the expected words for record
`i` (`None` for a word that may depend on the wave size).
3. Add it to `EXPECT` in `tests/test_wave64_halves_fixtures.py` with the tier, reasons and idioms the translator
should give it, and run `python -m pytest tests/test_wave64_halves_fixtures.py`.
4. Run `w64_graphics.py` on a RADV GPU and say which GPU and Mesa version in the pull request.
## GPUs with 128 bytes of push constants (AMD RDNA2 iGPUs on Windows, some Intel Arc drivers)
The translated shaders take 144 bytes of push constants: s0..s31, then the heap base and the code base. A device whose
`maxPushConstantsSize` is 128, Vulkan's minimum, can't take that, so the texture tests and every test drawn through
`vk_harness` skip there (`unsupported: need 144 push constant bytes, device has 128`); `vulkaninfo` shows the limit.
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
7600's iGPU on 24.10.24); 26.11.2 reports 256 on a Radeon 610M, where these tests run without the variable below.
RADV reports more on the same chips.
To run them anyway, set `LEONIDA_PC_TAIL_UBO=1` **for both `build.py` and `check.py`** (or for
`run_gpu_tests.py`). The shaders are then translated with `--pc-tail-ubo`: s0..s31 stay in 128 push-constant bytes,
and the heap base and code base move to a uniform block at set 1 (`docs/design.md`, "Push-constant tail as a uniform
block"), which `vk_compute_test`, `vk_store_test`, `vk_harness`, `vk_texture_test`, `vk_sampler_test` and
`vk_bindless_test` bind (`runtime/test/vk_pc_tail.h`). If you set it
only for `check.py`, the shaders read the tail from push constants the programs no longer declare. `--mesh-compute`
(`LEONIDA_MESH_COMPUTE=1`) isn't combined with it yet: its vertex shader still reads the output address from push
constants, so those tests skip.
## Mesh shaders with their waves in series
`LEONIDA_MESH_SERIAL_WAVES=1` for `run_gpu_tests.py`, together with `LEONIDA_W64_EMULATE=1`, translates the mesh
shaders with `--mesh-serial-waves` (`docs/design.md`, "Mesh shaders with their waves in series"): the ones that
qualify run one pass per wave in 64 invocations. The `ms_*` tests must pass with and without it;
`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.
With `LEONIDA_MESH_COMPUTE=1` as well (below), the same tests run the passes in the `--mesh-compute` form.
## GPUs without mesh shaders (NVIDIA Pascal and older)
Without `VK_EXT_mesh_shader`, the `ms_*` tests are skipped; that's expected, not a failure. To test the path that
runs them anyway, set `LEONIDA_MESH_COMPUTE=1` for `run_gpu_tests.py`, together with `LEONIDA_W64_EMULATE=1` on a
32-wide GPU (every mesh shader is wave64). The mesh shaders are then translated with `--mesh-compute`, dispatched as
compute and drawn by a generated vertex shader (`docs/design.md`, "Mesh shaders as compute"), so the device needs
`bufferDeviceAddress` instead, and `shaderInt64` for a module that declares `Int64`. The standalone tools
(`vk_harness`, `vk_compute_test`, `vk_texture_test`, `vk_store_test`, `vk_bindless_test`) read the modules'
capabilities first: they enable `shaderInt64` only for one that declares `Int64` (or `Int64Atomics`), and report 77
(SKIP, with the reason) when the device lacks it.
## Without a GPU: Mesa llvmpipe
Mesa's llvmpipe is a software Vulkan driver (`mesa-vulkan-drivers` on Debian and Ubuntu). `.github/workflows/runtime.yml`
can run the legacy C++ `runtime/` suite on it via manual `workflow_dispatch` (automatic runs are disabled while the
legacy C++ `runtime/` is deprecated), and you can do the same locally on Linux without a GPU:
```sh
sudo apt-get install -y libvulkan-dev mesa-vulkan-drivers vulkan-tools spirv-tools llvm-21
cmake -S runtime -B runtime/build/linux && cmake --build runtime/build/linux --parallel
python -I scripts/run_gpu_tests.py --build runtime/build/linux --llvm-mc /usr/lib/llvm-21/bin/llvm-mc
LEONIDA_W64_EMULATE=1 python -I scripts/run_gpu_tests.py --build runtime/build/linux \
--llvm-mc /usr/lib/llvm-21/bin/llvm-mc --filter cs_
LEONIDA_BARY_FALLBACK=1 python -I scripts/run_gpu_tests.py --build runtime/build/linux \
--llvm-mc /usr/lib/llvm-21/bin/llvm-mc
```
With Mesa 25.2 (llvmpipe, LLVM 20) the first run passes 52 of 88 and skips 36, the second passes 37 of 39 and
skips 2. The skips are expected: llvmpipe has 8-wide subgroups (so every wave64 test skips without emulation, and
the 32-lane tests `ps_bitmask_perm`, `cs_wqm_w32` and `cs_w32_lane_wrap` skip in both runs), no
`VK_KHR_fragment_shader_barycentric` (`ps_bary`, `ps_persp_bary`, `ps_uniform_branch`, `ps_scc_mask32`) and no
`VK_KHR_maintenance8` (`ps_texoff`). The third run draws those four barycentric tests through the fallback below
(with Mesa 26.0.8 it passes 123 of 189, the first run 120), and CI fails it unless every shader that got a fallback
geometry shader passes. With
`LEONIDA_W64_EMULATE=1` the mesh tests fail on llvmpipe, which is why the second run is limited to compute. This is
an llvmpipe bug, not the translator's (TEST-782, #3127): llvmpipe stores a mesh shader's per-primitive
`CullPrimitiveEXT` by bitcasting the boolean (`<N x i1>`) to a float vector, an invalid LLVM cast
(`emit_store_mesh_chan` in `lp_bld_nir_soa.c`, Mesa 26.3.1 and `main`). A constant cull flag is folded away before
that, so the native mesh tests pass; the emulated ones carry it through memory, so it reaches the cast. What the
cast becomes depends on the backend: on x86_64 at 256 bits, LLVM aborts ("LLVM ERROR: Cannot emit physreg copy
instruction"); at 128 bits (`LP_NATIVE_VECTOR_WIDTH=128`) some draw correctly and some draw nothing (with Mesa
26.0.3, `ms_tri`, `ms_w64x_ballot`, `ms_clip` and `ms_f16_pack` pass, while `ms_wave_info_s3` and `ms_v5_workgroup`
stay at the clear color); on arm64 (128 bits) `ms_tri`'s primitive comes out culled, so nothing is drawn. Storing a
constant `false` there instead makes the emulated `ms_tri` draw a frame byte-identical to RADV's (Mesa 26.3.1), and
`ms_tri`, `ms_wave_info_s3`, `ms_w64x_ballot` and `ms_v5_workgroup` byte-identical to NVIDIA's at both widths (Mesa
26.0.3, [measured by @TreXito](https://github.com/ItsNotRexed/Leonida/pull/3838#issuecomment-7086696759), with a 42-line reduced
reproducer). llvmpipe is not a substitute for a result from a
real GPU in [gpu-test-results/](../gpu-test-results/): it catches regressions, not hardware
differences.
## Macs in CI
The `macos` job in `.github/workflows/runtime.yml` is currently disabled: the suite passes on real Apple Silicon
hardware, while the hosted `macos-26` arm64 VM runner hits MoltenVK/paravirtual-device failures and macOS CI is
deferred for now. When enabled, it builds the runtime on `macos-26` and runs `ctest` and `run_gpu_tests.py` on
MoltenVK. The runner is a VM whose Metal device is "Apple Paravirtual device" (Metal family Mac2, not Apple7):
MoltenVK runs on it with 32-wide subgroups, so the wave64 and "32 lanes on request" tests skip there (about 75 of
190 in November 2026), and Mesa's KosmicKrisp finds no device. `macos-15` can't build the runtime: Xcode 16's libc++
has no floating-point `std::from_chars`. A test known to fail on MoltenVK is listed in the step's `EXPECTED_FAILURES`
with the pull request or coordination-issue finding that tracks it; it still runs, and
`scripts/ci_expected_failures.py` fails the step on any other failure. It takes `FAILED_LIST EXIT_STATUS [EXPECTED ...]`,
answers `--help`, and reports a list it cannot read or a non-numeric status as one line with exit code 2.
## GPUs without fragment barycentrics (NVIDIA Volta, Pascal and older)
`ps_bary`, `ps_persp_bary`, `ps_uniform_branch` and `ps_scc_mask32` read raw barycentrics, which need
`VK_KHR_fragment_shader_barycentric`. NVIDIA has it from Turing on; Volta (V100, Titan V) and older lack it, as do
llvmpipe and some other drivers. Where the device lacks it those four are skipped; that's expected, not a failure.
To test the fallback that runs them anyway, set `LEONIDA_BARY_FALLBACK=1`, **for both `build.py` and `check.py`**
(or for `run_gpu_tests.py`; CI does this on llvmpipe). The shaders are then translated with `--bary-fallback` and
drawn through a pass-through geometry shader that supplies the barycentrics (`docs/design.md`, "Barycentric
fallback"), so the device needs geometry shaders instead.
`ps_interp_f16_high` and `ms_f16_pack` read 16-bit interpolants as `PerVertexKHR` inputs, which need the extension
too and which `--bary-fallback` can't express. With `LEONIDA_F16_INTERP_FALLBACK=1` they read halves the producer
exports decoded instead (see Macs, below) and run with or without the bary fallback; `run_gpu_tests.py`, `build.py`
and `check.py` turn that on by themselves where the device lacks the extension. Under the bary fallback without it
they skip.
Intel Arc with Mesa ANV currently advertises the native barycentric feature but has a driver bug where translated
pixel shaders can read `BaryCoordKHR.i` as zero (SHADER-925). `make_game.py` detects ANV and automatically translates
with `--bary-fallback`; both entry points accept `LEONIDA_BARY_FALLBACK=1` to force it and
`LEONIDA_BARY_FALLBACK=0` to force native barycentrics. The CLI `--bary-fallback` flag also remains available for
game builds and other manually built fixtures.
AMD's Windows driver on gfx90c iGPUs (Renoir, Lucienne, Cezanne, Barcelo: Ryzen 4000/5000 mobile and 5000G, GCN 5)
also advertises the feature but returns a wrong third `BaryCoordKHR` component, about 0.99 where a small value is
expected (#5933: Vega 8, PCI 1002:15E7, driver 31.0.21921.13001). `ps_bary`, `ps_persp_bary` and `ps_ij_computed`
fail natively; through the fallback `ps_bary` and `ps_persp_bary` pass. `tools/vk_subgroup_info.py` reports
`barycentric_fallback` for these PCI IDs under `VK_DRIVER_ID_AMD_PROPRIETARY`, so `make_game.py` and
`run_gpu_tests.py` turn the fallback on by themselves there, with the same `LEONIDA_BARY_FALLBACK` override. RADV
(Mesa 26.2.6) on the same Vega 8 doesn't list `VK_KHR_fragment_shader_barycentric` at all, though it sets the
`fragmentShaderBarycentric` feature, so the four raw-barycentric tests skip there and pass with
`LEONIDA_BARY_FALLBACK=1`, and `ps_interp_f16_high` passes through the f16 fallback that `run_gpu_tests.py` turns on
by itself ([#166 entry](https://github.com/ItsNotRexed/Leonida/issues/166#issuecomment-7109387712)). Other GCN 5 GPUs
are not covered: none has been measured.
The same driver on a Raphael iGPU (Ryzen 7000 desktop, PCI 1002:164E, RDNA 2) also reads a wrong third `BaryCoordKHR`
component in `ps_bary` (0.992 where 0.0039 is expected) under driver 31.0.22044.1 (Vulkan `driverVersion` 2.0.283, compiler
23.20.44), and passes through `LEONIDA_BARY_FALLBACK=1`. `barycentric_fallback` is true there only up to and including
driverVersion 2.0.283; newer drivers keep native barycentrics, and `LEONIDA_BARY_FALLBACK=0` turns the fallback off.
## Macs: 16-bit interpolation without PerVertexKHR
`ps_interp_f16_high` (and `ms_f16_pack`) normally read 16-bit interpolants through `PerVertexKHR` inputs, which
MoltenVK can't convert to Metal ("PerVertexKHR decoration is not supported in MSL"). `run_gpu_tests.py` asks
`tools/vk_subgroup_info.py` whether the device can take them and, on MoltenVK, translates with
`--f16-interp-fallback` by itself: the vertex or mesh shader then also exports the decoded f16 halves
(`docs/design.md`, "16-bit interpolation without `PerVertexKHR`"). `build.py` and `check.py` ask the same question,
so the two-step form translates and judges the shaders the same way: `ps_interp_f16_high` passes and `ps_ij_computed`,
whose computed I/J pair needs those inputs, is left out and reported as `SKIP`. `LEONIDA_F16_INTERP_FALLBACK=1` or `0`
forces the fallback on or off in all three; set it for `build.py` and `check.py` alike. `ms_f16_pack` also runs
on a Mac with `LEONIDA_MESH_COMPUTE=1 LEONIDA_W64_EMULATE=1`.
## GPUs without VK_KHR_maintenance8 (NVIDIA Pascal and older)
`ps_texoff` and `ps_texoff_implicit` sample with a run-time texel offset, which needs `VK_KHR_maintenance8`;
without it they're skipped, which is expected, not a failure. To test the fallback, set `LEONIDA_TEXOFF_FALLBACK=1`
**for both `build.py` and `check.py`** (or for `run_gpu_tests.py`): the offset is then folded into the coordinate
(`docs/design.md`, "Texel offsets"), and the +16/-32 sample is judged on every device.
## Fused multiply-add: GLSL Fma or OpFmaKHR
`cs_fma_fused` checks that `v_fma_f32`, `v_fmac_f32`, `v_fmaak_f32`, `v_fmamk_f32` (and one `v_fma_f16`) round once, on
operands taken from user SGPRs so the driver cannot fold them. Run it with default `--fma glsl` (GLSL.std.450 `Fma`) or
with `LEONIDA_FMA=khr` **for `build.py`** (or for `run_gpu_tests.py`), which emits `OpFmaKHR`.
That needs `VK_KHR_shader_fma` with `shaderFmaFloat32`; the test programs enable it when the device has it and exit
77 (a SKIP) for a module that needs it on a device without it. The Vulkan specification allows a driver to split GLSL
`Fma` into two roundings, which is why `khr` exists: on AMD Windows (26.11.2) and NVIDIA (617.42) GLSL `Fma` stayed
fused, whereas **Mesa RADV (Linux)** splits several of the 7 f32 ops under `--fma glsl` — the exact split count varies
by GPU, Mesa/ACO version, and execution modes (4 of 7 on RX 6800 / Mesa 26.2.6-arch3.1 and RX 7600 / Mesa 27.0.0-devel
with `SignedZeroInfNanPreserve 32`, 5 of 7 on RX 6800 before float controls, 7 of 7 on Radeon Pro V540 RDNA1 / Mesa
25.2.8) — while returning 8/8 fused exact under `LEONIDA_FMA=khr` where supported. Under default `--fma glsl`,
`check.py` and `run_gpu_tests.py` therefore accept either the fused or the exact split word independently for each of
the 7 f32 outputs while still requiring exact f16 round-to-odd (`0x00007351`); under `LEONIDA_FMA=khr`, all 8 words
must be strictly fused. Two drivers give the split value in words 0, 2, 3 and 5 (`v_fma_f32`, `v_fmaak_f32`,
`v_fmac_f32`):
- RADV (Mesa 26.3.1, RX 6700 XT, measured in #3004's review). It has `VK_KHR_shader_fma` since Mesa 26.2 (#1364), so
`khr` fixes it, and so does `exact`.
- The Intel UHD Graphics driver (Xe-LP, Windows 101.7088). It has no `VK_KHR_shader_fma`, so `khr` can't be used
there and only `exact` fixes it.
`LEONIDA_FMA=exact` (`--fma exact`) builds the single rounding from plain f32 operations and needs no extension; under
it, as under `khr`, all 8 words must be strictly fused, and they are on both of those, on an RTX 3050 Laptop (617.42),
an RTX 5060 Laptop (621.01), an RTX 5070 Ti (621.24) and a Radeon 780M (26.11.2).
## Hardware oracle (optional, AMD)
`valu_fuzz.py`, `lds_fuzz.py`, `f32_fuzz.py` and `image_fuzz.py` take `--oracle hw`: the same programs run as native
compute kernels on an AMD GPU (`tools/hw_oracle/`; setup in [shader_validation.md](shader_validation.md), "Hardware
oracle"). It needs AMD clang with the amdgcn target (`LEONIDA_AMD_CLANG`), the AMD driver's HIP runtime and a host C
compiler on Windows, or the libdrm launcher on Linux. Without them a run prints `hardware oracle unavailable: ...` and
exits 77, so CI skips it. `image_fuzz.py --oracle hw` loads a linear texture through a T# built for the GPU's family
(GFX11 on gfx11xx, GFX10 on gfx103x; `tests/test_image_fuzz_hw.py` has the exact words) and compares every texel with
its CPU model; add `--negative-control` to check that wrong models are caught. A gfx1150 (RDNA3.5) is not RDNA2: a
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.
## Model oracle on any Vulkan GPU (no AMD hardware)
`pk16_diff.py`, `vint_diff.py` and `sdwa_diff.py` judge their translated programs on a Vulkan GPU only against the words
a native AMD GPU produced (`--oracle hw,vk`). `tools/vk_model_fuzz.py` runs the same programs, for the same seed, on
whatever Vulkan GPU you have and judges them against the fuzzer's reference model instead:
```sh
python -I tools/vk_model_fuzz.py pk16_diff --programs 1500 --seed 11 --build runtime/build
```
`--build` is the folder with `vk_compute_test`; `llvm-mc` with the AMDGPU target is needed as for `valu_fuzz.py`. It exits
0 when every judged program matched, 1 on a mismatch (the first few programs are printed), 2 when `vk_compute_test` is
missing and 77 when nothing could be judged. A program the model declines counts as a skip. A mismatch here is the GPU
disagreeing with the model, which is a driver difference, a translator bug or a model bug: re-read the program with
the fuzzer itself (`pk16_diff.py --seed S --programs N`) before reporting it.
## Choosing the GPU
With more than one GPU, pick one through the Vulkan loader, for example
`VK_LOADER_DRIVERS_SELECT=*amd*` or `VK_LOADER_DRIVERS_SELECT=nv-vk*` (or `VK_DRIVER_FILES=<path to the ICD json>`).
`vulkaninfo --summary` shows which devices the loader then sees.
Two GPUs of one vendor share one driver, so the loader cannot tell them apart (an RTX 5070 Ti next to an RTX 3060,
say; without a choice the runtime and every test take the same one: a native driver over Microsoft's Dozen, discrete
over integrated, the first on a tie, `vulkan_device_rank` in `runtime/src/vulkan_device_filter.h`).
`LEONIDA_VK_DEVICE` names the GPU by part of its name, without case: `LEONIDA_VK_DEVICE=5070` or
`LEONIDA_VK_DEVICE=radeon`. The D3D12 tests (`vk_test_device.h`) and the layer's standalone device read it,
and a value that matches no device fails the run instead of testing
another GPU. For the host side of the comparison tests, `LEONIDA_HOST_ADAPTER` picks the D3D12 adapter the same way.
Unset, the host side is the adapter behind the layer's Vulkan device (`runtime/test/host_adapter.h`; `d3d12_buffer_tiles`
by the layer's `GetAdapterLuid()`), so on a PC with two GPUs the layer is compared with its own GPU's driver.
The GPU tools of `runtime/test/shaders` (`vk_compute_test`, `vk_harness`, ...) read it the same way through
`vk_device_pick.h`, and fail with a message naming the filter when it matches no device.
Two test settings make the layer's standalone device look like a GPU with fewer Vulkan queues, so D3D12 queues share
them (`docs/d3d12_vulkan.md` section 4.4) on any GPU: `LEONIDA_VK_MAX_QUEUES_PER_FAMILY=N` (1 to 16) creates at most
N Vulkan queues per queue family, and `LEONIDA_VK_GRAPHICS_FAMILY_ONLY=1` puts COMPUTE and COPY queues in the
graphics family, as on a GPU without async compute or transfer families. Both together give the shape of the Intel
UHD 770 on Windows and of lavapipe, one family with one queue; the `d3d12_queue_share_one_queue` and
`d3d12_queue_wait_one_queue` tests run that way, and any other test can be run so by hand. The device logs what it
applied; a queue count outside 1 to 16 is ignored, with a message. Only tests apply them: the device that
`gta6rt --run` creates for a game (`LEONIDA_D3D12=vulkan`) ignores both and prints `... is a test setting; the
game's device ignores it`, so leaving them set cannot slow a game down (`run_tiny_frame_queue_test_settings`).
## Known problems
| What you see | Cause | What to do |
|---|---|---|
| Under Wine 9.0 (Ubuntu 24.04's `wine`), a test or the runtime waits out every `std::condition_variable` timeout: `wait_registration_admission` ("native drainage complete"), `vk_presenter_sync` (`unblocked_during_present`), `frame_pacer`, `vk_fence_dispatcher_sync`, `context_concurrent_detach` | The STL's timed wait (`_Cnd_timedwait_for_unchecked`) is linked statically from `msvcprt.lib` and reads Windows' `_Mtx_t` layout, while `_Mtx_lock`/`_Mtx_unlock` come from Wine's builtin msvcp140, which used another layout until wine-10.1 (757bd7909fda); the wait never released the mutex (#3796) | Fixed in the build: `runtime/src/crt_timed_wait.cpp` routes the wait through msvcp140's own `_Cnd_timedwait` in every `/MD` binary, and `crt_timed_wait_test` checks it. A binary built before that fix still needs Wine 10.1 or newer (or Proton) |
| `ctest` passes but runs far fewer tests than expected (about 45 instead of 125 on Windows), no `d3d12_*` GPU tests, and `LEONIDA_D3D12=vulkan` does nothing | CMake found no Vulkan headers: `VULKAN_SDK` was not set in the environment that ran CMake (for example a user variable set after the terminal opened), and `CMakeCache.txt` keeps that failed lookup. The configure prints a `CMake Warning` "Vulkan headers not found" | Set `VULKAN_SDK` in that environment (or pass `-DLEONIDA_VULKAN_HEADERS_FETCH=ON`), delete `CMakeCache.txt` and configure again. `-DLEONIDA_REQUIRE_VULKAN=ON` makes this a configure error; CI and `scripts/build_runtime.ps1` (with `VULKAN_SDK` set) pass it |
| Windows refuses to start freshly built test programs ("An Application Control policy has blocked this file"), and the runner stops with a traceback | Smart App Control on Windows 11 | Turn Smart App Control off for the run |
| `tools/hw_oracle` works once, then stops with "hardware oracle unavailable: Windows Defender blocked the launcher ... (WinError 225)" (older runs: an `OSError: [WinError 225] ... contains a virus or potentially unwanted software` traceback) | Defender's machine-learning check flags the small unsigned `leonida_hw_oracle_<hash>.exe` that the runner builds in `%TEMP%` (seen as `Trojan:Win32/Bearfoos.A!ml`) and quarantines it; every later run rebuilds and loses it again | Add an exclusion for the build folder (`%TEMP%`) in Windows Security, Virus & threat protection, Manage settings, Exclusions, restore the file from Protection history if you want it back, and rerun. The program is built from `tools/hw_oracle/hw_oracle.c` and is a false positive |
| Validation errors without a VUID, or messages from a layer you didn't ask for | An implicit Vulkan layer from other software (Rockstar Social Club, ReShade, MangoHud, an overlay) | Set `VK_LOADER_LAYERS_DISABLE=~implicit~`. Overlays that hook the swapchain (RivaTuner `VK_LAYER_RTSS`, OBS `VK_LAYER_OBS_HOOK`) can stay loaded: see the next row |
| Validation errors that only your machine shows (e.g. `xbox_present`'s sRGB swapchain `STORAGE` message), with MSI Afterburner/RivaTuner or OBS installed | An overlay layer that hooks the swapchain: while RivaTuner Statistics Server is running, its `VK_LAYER_RTSS` adds `STORAGE` usage to it (OBS's `VK_LAYER_OBS_HOOK` injects `VK_IMAGE_USAGE_STORAGE_BIT` too). In an elevated (administrator) terminal the loader ignores `VK_LOADER_LAYERS_DISABLE` (`VK_LOADER_DEBUG=all` says so), so `~implicit~` leaves the layer in | Run the tests from a normal terminal, close the overlay application, or set the layer's own switch, which works elevated too: `DISABLE_RTSS_LAYER=1`, `DISABLE_VULKAN_OBS_CAPTURE=1` (OBS). Any other layer's switch is the `disable_environment` entry in its manifest (the JSON listed under `HKLM\SOFTWARE\Khronos\Vulkan\ImplicitLayers` or `HKCU\...`). `VK_LOADER_DEBUG=layer` prints the layers that were actually inserted |
| GPU tests crash with an access violation (`0xC0000005`, exit `-1073741819`) right after device creation, with no layer message and validation off (e.g. `d3d12_method_variants` 9 of 10 runs, `xbox_present` 10 of 10, on `main` 561b65a83, RTX 4070 Ti, NVIDIA 616.56) | An implicit layer from an overlay or game tool you did not install for these tests. FPS Monitor's `fpsmonvk64.json` (listed under `HKLM\SOFTWARE\Khronos\Vulkan\ImplicitLayers`) names itself `VK_LAYER_RENDERDOC_Capture`, so `DISABLE_VULKAN_OBS_CAPTURE=1` does not disable it | `VK_LOADER_DEBUG=layer` prints the layers that were actually inserted. That manifest's `disable_environment` is `DISABLE_LAYER=1`; `DISABLE_LAYER=1` or `VK_LOADER_LAYERS_DISABLE=~implicit~` gave 20 of 20 clean runs (a layer's own switch is its `disable_environment` entry, as the row above says) |
| `vk_sync_validation` fails with `LEONIDA_VK_VALIDATION=1` ("the write-after-write hazard was not reported") | Synchronization validation is off although the tests ask for it: an older layer, or a layer setting such as `VK_KHRONOS_VALIDATION_VALIDATE_SYNC=false` or a `vk_layer_settings.txt` that overrides it. Every other GPU test then reports "0 validation errors" without having been checked | Remove the override or update the Vulkan SDK, then rerun `ctest -R vk_sync_validation` until it passes |
| On RADV with Mesa 25.2 (Ubuntu 24.04's default; 25.2.8 measured) or 25.3 (from the source, not run), `cs_w32_salu64` fails with word 2 = `0` (want `0xFFFFFFFF`) and `cs_signed_zero_nan` fails with word 5 = `0` (want `1`). The `cs_signed_zero_nan` failure alone is also measured on RADV 25.0.7 (RX 7800 XT, Debian 13; @mrbean56, #4421) and on ANV 25.2.8 (Intel UHD 630; @theswiss24, #4571); llvmpipe on Mesa 26.0.8 (Ubuntu 26.04) still gives word 5 = `0`, which `check.py` does not judge there (`UNJUDGED_WORDS`) | Two Mesa bugs, not translator bugs (#166). `cs_w32_salu64`: ACO's `combine_add_sub_b2i` reads a temporary without counting the use, so dead-code elimination removes it (`ACO ERROR: ... never defined` with `MESA_SHADER_CACHE_DISABLE=true`); `RADV_DEBUG=llvm` passes. `cs_signed_zero_nan`: NIR's range analysis (`fmul_is_a_number`) calls `0 * x` a number when `x` may be infinite, so the `x != x` check folds to false despite `SignedZeroInfNanPreserve`. The same NIR code is behind llvmpipe's word 5 (#664) and ANV's, since both drivers run NIR; `cs_w32_salu64` is ACO's, so only RADV has it | Expected with these Mesa versions. From the source, the ACO function is gone from Mesa 26.0 and the NIR code was replaced in 26.1 (neither run); RADV from Mesa 26.3.1 passes both on an 8060S (gfx1151) |
| On an Intel iGPU with ANV from Mesa 25.2 (25.2.8 measured), `cs_fmt_int_narrow` fails with word 34 = `0x00000000` (want `0xFFFFFFFF`); the full dump also has words 49 and 129 = `0x80000000` (want `0x8000FFFF`), natively and under `LEONIDA_W64_EMULATE=1` alike (`check.py`'s comparison stops at the first mismatch, so its line names only word 34). Measured on Gen9 at subgroup sizes 8, 16 and 32 alike (UHD 630, CFL GT2; TEST-1000), and on an Arrow Lake-H Arc 140T (device subgroup 8–32; `Intel(R) Graphics (ARL)`, Xe2; ANV 25.2.8-0ubuntu0.24.04.5, Vulkan 1.4.318) | A Mesa bug, not a translator bug (TEST-1000). The fixture's second source dword `0x8000FFFF` reaches the SSBO as `0x80000000`: the translated module holds it as one `OpConstant %uint` stored by a single dword `OpStore` to PhysicalStorageBuffer, no float operation on the path, yet the raw buffer readback (word 129) shows its low halfword `0xffff` zeroed and its high halfword `0x8000` intact — the bit pattern is a negative f32 denormal and it comes back as `-0`, as if flushed. Words 34 and 49 are a correct `16_16_16_16_SINT` load of the corrupted dword (the neighbouring channels sign-extend correctly). The module requests `DenormPreserve 16` and `SignedZeroInfNanPreserve 32`, not `DenormPreserve 32`, and the same module passes 136/136 on gfx1036 (native `hw_oracle`), llvmpipe, an RTX 2060 SUPER, 5060 Laptop and 5080, an RX 7900 XTX under RADV, Xe-LP (UHD 770, ANV 26.3.1) and Meteor Lake (ANV 26.2.7); adding `OpExecutionMode DenormPreserve 32` by hand fixes all 136 words on both Gen9 and the Arc 140T | Expected with this Mesa. Don't add `DenormPreserve 32` to the translator for it: the game runs f32 denormals flushed (`denorm_mode_32 = 0`, docs/design.md) and the translator leaves denormal handling to the driver. A newer Mesa passes (26.2.7 on Meteor Lake, 26.3.1 on Xe-LP); Gen9 and the Arc 140T with a newer Mesa not run |
| Every test crashes inside `libnvidia-eglcore.so` | NVIDIA's 535 server driver (Ubuntu 24.04's default) | Use driver 615 or newer |
| The synthetic `cs_imgstore_cube` test reports 63 bad `r32 sint` texels on a Tesla V100-SXM2-16GB (Volta, NVIDIA 580.178.04, Linux; Vulkan 1.4.312; [#1492](https://github.com/ProjectLeonida/mandy/issues/1492)) | The signed 32-bit cube-storage-write failure is known on that reported host, but its cause has not been isolated. It passes on an RTX 5090 with NVIDIA 621.14 on Windows 11 | No workaround is confirmed. Keep the test's expected values; report the GPU, driver and output if you reproduce it on another setup |
| `build.py`: 0 translated, reason `.text` | An old `build.py` with LLVM 19 | Update to current `main` |
| `vk_harness` doesn't compile: `VK_KHR_maintenance8` names unknown | Vulkan headers older than the SDK the code was written against | Update to current `main` (the code now builds without it), or use current Khronos Vulkan-Headers; conda-forge's package is too old |
| Configure stops with "Vulkan headers too old: ... VK_HEADER_VERSION N" (before: the build stopped at `d3d12_com.h(42): error C3646: 'calibrated': unknown override specifier` and 100+ errors in `d3d12_vulkan_device.cpp`, or at `VkPhysicalDevicePipelineBinaryFeaturesKHR` in `vk_harness.cpp`) | The Windows runtime found Vulkan headers older than v1.3.294 (`runtime/cmake/vulkan_headers_version.cmake`). conda-forge's `vulkan-headers` resolves to 1.3.231 next to `llvm-tools`. Measured on MSVC 14.51: v1.3.294 builds every target, SDK 1.3.280.0 all but `vk_harness` (`VK_KHR_pipeline_binary` is new in v1.3.294), 1.3.231 stops in the D3D12 layer | Point `VULKAN_SDK` at a Vulkan SDK from 1.3.296.0 on or current Khronos Vulkan-Headers, then delete `CMakeCache.txt`; or pass `-DLEONIDA_VULKAN_HEADERS_FETCH=ON` with no other headers installed |
| `ps_bary` and `ps_uniform_branch` fail by about 0.9 | The GPU runs pixel shaders wave64 without fragment barycentrics (GCN3 and RDNA1 on RADV), or an old AMD Windows driver (22.40) | Current `main` skips them on such devices; on Windows, update the driver |
| `ps_bary`, `ps_persp_bary` and `ps_ij_computed` read the third barycentric as about 0.99 on a gfx90c iGPU (Vega 8, AMD Windows driver 31.0.21921.13001; #5933) | The driver's native `BaryCoordKHR` is wrong there: the same tests pass through `--bary-fallback`, and natively on RADV (Radeon 8060S) | `tools/vk_subgroup_info.py` turns the fallback on by itself for gfx90c under AMD's driver, and `make_game.py`, `run_gpu_tests.py`, `build.py` and `check.py` follow it when `LEONIDA_BARY_FALLBACK` is unset; `=1` forces the fallback and `=0` forces native barycentrics, where they still fail |
| `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 |
| `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). |
| `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") |
| `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 |
| `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 |
| 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` |
| `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 |
| `cs_dpp_ops` fails on a Mac with MoltenVK 1.4.2: `out[0..7] = 100 100 11 ...`, want `100 10 11 ...` | MoltenVK 1.4.2's SPIRV-Cross moves the DPP lowering's subgroup ballot and shuffle into a short-circuiting `&&` and `?:`, so only some lanes run them and lane 1 sees its source lane 0 as inactive. SPIRV-Cross `5c372ffb` (in MoltenVK `main`) keeps them out of `?:`; a ballot on the right of `&&` is still moved there in SPIRV-Cross `57e4efcc` | Fixed in the translator (SHADER-529, #3227): it stores the ballot and the shuffle to variables of their own, so the MSL that MoltenVK 1.4.2 generates (`MVK_CONFIG_DEBUG=1`) runs each as a statement in every lane. Translate again with current `main`; MoltenVK `main` and KosmicKrisp are no longer needed for it. A pass alone does not show the fix: an Apple M5 Pro (macOS 26.5.1) returns the right words with 1.4.2 even when the ballot is on the right of `&&` |
| On a Mac with MoltenVK 1.4.2, an f16 multiply-add whose three operands are all constants gives a wrong constant: while `cs_fma_fused` had literals there, its word 7 read `15360` (`0x3c00`), or `0` on an Apple M5 and M5 Pro, want `29521` (`0x7351`) | The f16 multiply-add (round to odd), evaluated at compile time. With any one of the three operands taken at run time the same translation gives `0x7351` (Apple M5). The MSL of 1.4.2 and of MoltenVK `main` differ only in SPIRV-Cross's precise-arithmetic helpers (`[[clang::optnone]]` and `fma(l, r, 0)` against `math_mode(safe)` and `fma(l, r, -0.0)`, the SHADER-182 / SHADER-234 change) | `cs_fma_fused` takes its f16 operands at run time since TEST-FMA-FUSED-F16-RUNTIME, as it does its f32 ones, and passes with MoltenVK 1.4.2 on an Apple M5 and on the `macos` job's runner (Apple Paravirtual device), which no longer lists it in `EXPECTED_FAILURES`. The all-literal form passes with MoltenVK `main` |
| `ps_imgatomic` fails in about two of three runs on a Mac with MoltenVK 1.4.2: 1 to 6 of the 256 image-atomic texels are wrong while the render target is exact, for example `2D umax texel 48: got 0x00000d45, want 0x00000dc7` | MoltenVK 1.4.2 lowers the four `OpAtomic*` on image texels to Metal's texture atomics (`atomic_fetch_max`, `atomic_fetch_min` and `atomic_fetch_or` on `access::read_write` textures), and the texels read back the way a read-modify-write that is not atomic between two groups of fragment threads leaves them. A wrong `umax` texel always holds the id of one of its own 64 pixels, the largest of only some of them: on an Apple M5 it was the last pixel of the texel's first four rows in 43 of 90 cases, with all 32 larger ids gone. A wrong `umin` texel mirrors that (the first pixel of its last four rows in 39 of 48). The `or` image did not differ in 150 runs there. It is not the translator's first-lane broadcast of the descriptor index (54 of 60 runs fail with the index used directly) and not the readback (42 of 60 fail with the copies in a submission of their own after the draw). Measured on an Apple M5 (macOS 27.2.1, 101 of 150 runs fail) and an M5 Pro (#543) | Expected with MoltenVK 1.4.2. KosmicKrisp passed the same module and binary 10 times of 10 on the M5 Pro (#543). The macOS CI job does not reach it: on the runner's paravirtual device the test skips because its bindless set does not fit the descriptor limits. Do not weaken the test's expected texels |
| `gs_tri` and `ms_tri` fail on a Mac | MoltenVK has no geometry stage and no `VK_EXT_mesh_shader` | Current `main` reports them as skipped |
| With `LEONIDA_W64_EMULATE=1` on llvmpipe, the `ms_*` tests fail. Measured with Mesa 26.3.1: on x86_64 at 256-bit vectors (the default there) all six abort with "LLVM ERROR: Cannot emit physreg copy instruction"; on arm64 (128-bit) `ms_tri` draws nothing (the frame stays at the clear color); on x86_64 at 128 bits (`LP_NATIVE_VECTOR_WIDTH=128`) `ms_tri` happened to draw correctly, but with Mesa 26.0.3 `ms_wave_info_s3` and `ms_v5_workgroup` draw nothing there (4 of 6 pass, [measured by @TreXito](https://github.com/ItsNotRexed/Leonida/pull/3838#issuecomment-7086696759)) ([measured runs](https://github.com/ItsNotRexed/Leonida/issues/3127#issuecomment-7086469679)) | An llvmpipe bug: a mesh shader's runtime `CullPrimitiveEXT` is stored through an invalid `bitcast <N x i1> to <N x float>` (TEST-782, #3127; see "Without a GPU: Mesa llvmpipe") | Run the mesh tests on llvmpipe without `LEONIDA_W64_EMULATE`, or add `LEONIDA_MESH_COMPUTE=1` (the compute fallback): with it all 6 `ms_*` pass emulated on llvmpipe (x86_64, 256-bit) |
| On a Mac, `valu_fuzz.py --family f16` reads `+0` where the model wants `-0`, from a multiply whose exact product is -0 (`v_mul_f16`, `v_pk_mul_f16`) or from an FMA whose product and addend are both -0 (`v_fma_f16`, `v_fmac_f16`, `v_pk_fma_f16`) | MoltenVK computes a `NoContraction` multiply as `fma(l, r, +0)`, which drops the sign. MoltenVK 1.4.2 and `main` up to at least `5189f8de` are affected (SHADER-182, [design notes](design.md#translator-status-and-runtime-contract)) | Expected with these MoltenVK versions. To run the rest of the fuzzer clean, add `--skip-op` for each of the five ops. To see them match, install Homebrew's `mesa` and use its KosmicKrisp driver: `LEONIDA_VULKAN_LOADER=/opt/homebrew/opt/vulkan-loader/lib/libvulkan.1.dylib VK_DRIVER_FILES=/opt/homebrew/share/vulkan/icd.d/kosmickrisp_mesa_icd.aarch64.json python3 -I tools/valu_fuzz.py --family f16 --build runtime/build/linux`. Or build MoltenVK with SPIRV-Cross `300681bb` or newer in `ExternalRevisions/SPIRV-Cross_repo_revision`, and point `LEONIDA_VULKAN_LOADER` at its `libMoltenVK.dylib` |
| A pixel shader exporting non-canonical f32 NaNs reads back `0x7fc00000` from an RGBA32F color attachment | KosmicKrisp (Mesa 26.3.1), reproduced on Apple M3 Max, M2 Ultra and M1 Pro ([#3125](https://github.com/ItsNotRexed/Leonida/issues/3125)): `nir_to_msl` emits `(NAN)` for `float`-typed NaN constants (`MESA_KK_DEBUG=msl`); MoltenVK 1.4.2 preserved both tested payloads on the same hardware | `ps_nan_payload` allows the measured canonical word only for the NaN channels and only when `vk_harness` reports `driver: KosmicKrisp`. Finite channels and other drivers still require exact words. Integer or storage-buffer readback still canonicalizes constants that NIR infers as `float` (see the `cs_bvh` row below). |
| `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 |
| `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 |
| `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 |
| `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 |
| `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` |
| 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 |
| `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 |
| `ctest` lists `fsr_dispatch` and `bvh_builder` as failed (`Not Run`) after clang-cl hits an internal compiler error in `fsr_dispatch_test.cpp` and `bvh_builder_test.cpp` | clang-cl 22.1.8 on Fedora (Linux cross-build) and Windows, plus 22.1.7 on Windows | Use clang-cl 23.1.6 (both files compile on Windows) |
| `d3d12_compute`, `d3d12_draw` or another test that writes a shader library under the temp directory fails now and then (a PSO creation `line N: SUCCEEDED(...)`, or exit 3 with no message) but passes when run alone | Two copies running at once (`ctest -j`, or two suites sharing one Wine prefix or `TMPDIR`) used the same `leonida_<test>` folder under the temp directory, and one copy deleted the shader modules the other was loading: 6 of 40 runs failed with four copies of `d3d12_compute` at once on a Mac under Wine | Current `main` gives each process its own folder (`<temp>/leonida_<test>_<pid>`) |
| A Windows CI artifact run under Wine by hand: `d3d12_compute` and the other tests that read `LEONIDA_TEST_*_SPV` end with exit 3 and no message | The `.spv` paths are compiled in as `D:/a/Leonida/Leonida/runtime/build/generated/...`; the prefix has no `D:` drive and the test isn't run from the artifact folder | Run it from the artifact folder (the tests then find `generated/<name>.spv` there) or through `scripts/run_wine_tests.py`, which maps that drive for the run; current `main` names the file it couldn't copy (`cannot copy ...: File not found`) |
| Linux cross-build: CMake can't find `clang-cl-19` (or another versioned `clang-cl-<N>`) although `clang-19` and `lld-19` are installed | On Debian and Ubuntu, the versioned `clang-cl-<N>` link is in the `clang-tools-<N>` package, not in `clang-<N>` (`/usr/lib/llvm-<N>/bin/clang-cl` comes from it too); `lld-link-<N>`, `llvm-lib`, `llvm-rc` and `llvm-mt` come from `lld-<N>` and `llvm-<N>` | `sudo apt-get install clang-tools-19 lld-19 llvm-19` (Ubuntu 24.04 has 19 and 20), then pass the versioned names as in [the cross-build](#the-windows-runtime-on-linux-under-wine-or-proton) |
| Under Ubuntu's Wine 9.0, `wineboot --init` (and every Wine program after it) stops at once with `free(): invalid pointer` or a segmentation fault, before printing anything else; the prefix holds only a `wineserver` file | That Wine opens `/run/user/<uid>` for its server directory, whether `XDG_RUNTIME_DIR` is set or not, and aborts when the folder doesn't exist. The login manager makes it for a desktop session; a container or a shell started without a login session (a root shell in Docker, a CI runner image) has none | Create it before starting Wine: `mkdir -p /run/user/$(id -u) && chmod 700 /run/user/$(id -u)` (setting `XDG_RUNTIME_DIR` alone doesn't help), delete the half-made prefix, and run `wineboot --init` again |
| `run_gpu_tests.py` fails on a `dict \| None` annotation | Python older than 3.10 | Use Python 3.12+ |
| `vulkaninfo` lists `Microsoft Direct3D12 (<gpu>)` next to the real GPU and the tests run on it | The Windows "OpenCL™, OpenGL® and Vulkan® Compatibility Pack" installs Mesa's Dozen, a Vulkan-on-D3D12 layer that reports `DISCRETE_GPU` like the native card | Current `main` prefers a native ICD over Microsoft's vendor (`0x1414`) in the runtime and every harness; set `LEONIDA_VK_DEVICE=<part of the real GPU name>` to select explicitly. See #915. |
| A GPU test that uses `image_load` (or lighting built from real shaders) reads zeros from its image; @Silliana saw every texel except pixel (0,0) come back zero in their own layer (#603, not reproduced here) | In this runtime the shader turns the T# words into an index through the descriptor hash table (`runtime/src/descriptor_table.h`: a miss gives index 0), and index 0 is a 1×1 image of zeros (`runtime/src/vulkan_bindless.h`), so a hand-built or zeroed T# that was never registered reads zeros even at (0,0). The translator does not compare coordinates with the T# size, and `cs_imgload.asm` only uses its T# words as a hash key | Register the descriptor through the runtime (for D3D12, create it with `CreateShaderResourceView`) so its T# hits the table, with the image's real width and height (stored as size − 1, see `runtime/src/gfx10_descriptors.h`) |
| `cs_sample_lz_int_d16`, `ps_sample_implicit_sint`, `ps_ssharp`, `ps_tex`, `ps_texture_mip0`, `ps_texture_sample` and `ps_texture_sample_d16` crash (exit -11 or 139) on an Intel GPU on Linux, while NVIDIA and llvmpipe pass them (TEST-399) | A bug in Mesa ANV's shader compiler: compiling these texture-sampling shaders, `nir_opt_gcm` (`nir_opt_gcm.c:430`, `gcm_schedule_early_src`) dereferences a phi source an earlier pass has freed. The SPIR-V passes `spirv-val`. Seen with Mesa 26.1.6 (Arrow Lake) and 26.2.7 (Iris Xe, ADL GT2); Mesa 26.3.1 and `main` (bb98606) pass the whole suite on the same Iris Xe | Use Mesa 26.3.1 or newer. To check a newer Mesa without installing it, build its Intel Vulkan driver and point `VK_DRIVER_FILES` at its `src/intel/vulkan/intel_devenv_icd.x86_64.json` |
| A test exits with `3221225477` (`0xC0000005`, an access violation) on AMD, only when `VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_api_dump` is set (`d3d12_sparse_queue_family_contract` sets it itself) | The Vulkan SDK's API dump layer (1.4.363.0) crashes the test process now and then: on an RX 9060 XT (RDNA4, Windows driver 32.0.32029.2010) `d3d12_buffer_tiles` and `d3d12_queue_wait` crashed in 1 and 4 of 8 runs in one session and in 3 and 1 of 30 in another; the layer's `detailed` and `pre_dump` settings make no difference. Not seen in 24 runs of those tests without the layer, nor in 8 runs each of the SDK's `vkcube` and `vulkaninfo` with it, so it is not simply the layer on that driver | Run the test again. Do not read a crash under the layer as a failure of the test: run the same program without the layer to check its result, and use `LEONIDA_VK_VALIDATION=1` (the Khronos layer) for validation messages |
| With GPU-assisted validation (`LEONIDA_VK_VALIDATION=1 VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1`), three runtime tests fail that pass without it: `vk_command_replay` (parts H and I end with "validation errors") and `depth24_convert` print `VUID-vkCmdCopyBufferToImage-pRegions-07931` ("has a float value at offset N that is not in the range [0, 1]") for depth data that is in range, `depth24_convert` then stops at its pipeline-statistics check (`value == 0`) and the layer reports the `VkQueryPool` that early exit leaves behind, and `pipeline_cache_seed` ends with "cache does not hit on the runtime's device" | The layer (`VK_LAYER_KHRONOS_validation` 1.4.357, measured on an RTX 3060 Ti with NVIDIA 621.14), not the tests. Its check of a buffer copied into a depth image (`layers/gpuav/validation_cmd/gpuav_copy_buffer_to_image.cpp`) uses `bufferRowLength`, a count of texels, as the byte distance between rows. With D3D12's 256-byte row pitch a 4-texel row has `bufferRowLength` 64, so the check reads rows 64 bytes apart, in the padding (the offsets reported in `vk_command_replay` are 64, 68, 72, 76, 128, ...). 1.4.357 also steps 5 bytes per texel through `D32_SFLOAT_S8_UINT` depth data, which is 4 bytes per texel in a depth-aspect copy (offsets 1925, 1930, 1935, ... in `depth24_convert`); the layer's `main` of 25 November 2026 has fixed that part and not the row distance. The check is a compute dispatch of the layer's own, and with it off the application's pipeline-statistics counters read 0 again. `pipeline_cache_seed` compares the runtime's pipelines with a cache `vk_pipeline_check` wrote, and GPU-assisted validation instruments the shader modules it sees | Turn the one check off for the run: `VK_KHRONOS_VALIDATION_GPUAV_BUFFER_COPIES=false` for `vk_command_replay` and `depth24_convert`, `VK_KHRONOS_VALIDATION_GPUAV_SHADER_INSTRUMENTATION=false` for `pipeline_cache_seed`. Each of the three then passes with GPU-assisted validation on and no validation message. Do not read these three as failures of a change under test |
| On an AMD integrated GPU (gfx1036) with AMD's Windows driver (`32.0.21042.62` and `32.0.21045.16010` measured), `crosslane_fuzz.py --wave 64 --w64-native --dpp --no-maskdata --seed 82001 --programs 600` reports one native mismatch: `cs_xl64_8200346406` differs in 96 words (32 lanes of each of its three waves), while `--wave64-emulate` and the hardware oracle match | AMD's Windows driver, not the translator (SHADER-705; the driver's generated code was not inspected). The same native wave64 SPIR-V is exact under RADV (Mesa 26.3.1) on another gfx1036 and on an RX 7900 XTX, and in the CPU interpreter. The wrong instruction is a `v_permlanex16_b32` that reads a register a DPP op with a partial `row_mask` has just written ([shader_validation.md](shader_validation.md), FUZZ-7) | Nothing to change in a build: no shader of the game has that shape (0 of 26,503; the two instructions meet in 6 shaders, all wave32 compute). `--wave64-emulate auto` stays native on this driver because of #857, and the emulated translation of the program matches there |
| With `--wave64-emulate` (or `LEONIDA_W64_EMULATE=1`) on an NVIDIA RTX 5080 with Windows driver 32.0.16.1692 (616.92), `crosslane_fuzz.py --seed 91001 --dpp --no-maskdata` reports a hard mismatch for `cs_xl64_9100373886`: after `s_xor_b64 s[16:17], vcc, vcc` (0 in every lane), the second of two nested `v_cndmask_b32_e64 … s[16:17]` returns the old register instead of the lane id | An NVIDIA driver miscompile, not the translator (SHADER-720). The same SPIR-V (spirv-val clean) matches the model on an RTX 3060 with 616.64, an RTX 5060 Ti (Blackwell) with 621.14, an RTX 5070 Ti with 621.24 and an RTX 5080 with the Linux 580.65.06 driver. Hand edits narrow it to a value selected through the `%active` gate of a store; on the Linux 580 driver a similar pattern, a subgroup shuffle selected by an `%active` that is false, still fails in three wave32 `v_permlane16`/`v_permlanex16` programs of the same seed (#3796, #3918) | Update the NVIDIA driver to 621.14 or newer on Windows. If a crosslane mismatch only shows on one driver, check another driver or GPU before changing the translator |
| `lds_fuzz.py --wave 64` (native, not `--emulate`) reports a `ds_bpermute_b32` mismatch on an AMD GPU on Windows, e.g. `cs_ldsfuzz_s7031_496_w64` (seed 7031): small values like `0x14` where the model wants another lane's data, while `--oracle hw` and `--emulate` on another GPU agree with the model | The AMD Windows driver (32.0.21042.62, gfx1036) miscompiles a native wave64 compute shader with two subgroup shuffles; a reduced SPIR-V module is in #4613 | Not a translator regression: check the same seed with `--oracle hw` and with `--emulate`. Native wave64 results on that driver need that cross-check |
| On AMD's Windows driver a compute pipeline creation takes tens of minutes: `vk_pipeline_check` prints `still compiling <name> after ...s` with one busy thread, or a compute PSO creation through the D3D12 layer seems never to return | The driver's compiler on one module in the dispatch-loop form (`"control_flow": "dispatch loop"` in the translated `index.json`). Measured on a Radeon gfx1036 iGPU, driver 32.0.21042.62 (SHADER-995): `XboxBvhBuilder.dll`'s `LeafRehydration` in that form (a 581-case switch in a loop) was created after 34 minutes of one busy thread (XXTESTING), while its structured module is created in 2.9 s and an RTX 3070 (NVIDIA 610.74) created the dispatch-loop one in 11 s. It is not every such module: ten other programs of that DLL compile in that form on the Radeon in 0.4 to 40 s ([embedded_shaders.md](embedded_shaders.md), section 7). Not tried on another AMD GPU or driver branch | Translate with current `main`. Since SHADER-427 only a tree nested deeper than 64, a graph that cannot be made reducible or `--dispatch-loop` gives that form, and none of that DLL's programs has it; the shaders stage translates again by itself when the translator changed. A wave64 compute shader that still has it comes out in another form with `--wave64-emulate on` (12.4 s for this program on that driver), which that driver can crash on for other programs (#857) |
| On an Intel Arc 140T (Xe2/ARL, ANV, Mesa 25.2.8, `LEONIDA_W64_EMULATE=1`), `cs_imgload_tfe` and `cs_imgload_d16_tfe` end `exit 1` after the `device: Intel(R) Graphics (ARL)` line, and `cs_w32_exec_computed` (`8192 8192 8192 7682 512 4100 0 3`) and `cs_w64_exec_computed` (`8224 8192 16384 16384 8192 4132 0 3`) return wrong words, at `main` `e56d97950` where the full suite read 218/248 passed, 23 skipped. `cs_fmt_int_narrow`'s word-34 mismatch (`0x00000000`, want `0xffffffff`) reproduces on the same rig (2026-11-23) | Not diagnosed; measured once on this one part and Mesa combo. The recorded Intel runs of the #8968 and #8995 fixtures are Xe-LP (UHD 770, Raptor Lake iGPU, ANV 26.3.1), which passes `exec_computed` with the SHADER-1264 fix, so ARL/Xe2 differs here in a way this row does not explain. `cs_signed_zero_nan` and `ms_wave_info_s3` failed on the same run as their existing rows record; `cs_w32_salu64` did not (ACO/RADV-only) | Data point for the #8968 and #8995 fixture owners; re-measure on a newer Mesa or another Xe2 part before treating it as a translator bug. Do not weaken the fixtures' expectations on this measurement alone |
### Signed zero in a float storage image (SHADER-605)
Build `vk_store_test` as above and put `spirv-as` and `spirv-val` on PATH. Run this standalone
probe from the repository root, passing the path to the executable you built:
```powershell
python -I runtime/test/shaders/probe_signed_zero.py runtime/build/vulkan/vk_store_test.exe
```
The probe assembles and validates two hand-written Vulkan 1.2 compute modules. Each requests
`SignedZeroInfNanPreserve 32` and executes three constant `OpImageWrite` instructions into
a `VK_FORMAT_R32G32B32A32_SFLOAT` image. Only the SPIR-V image format changes (`Unknown` or
`Rgba32f`). The harness copies the images back, issues a transfer-write to host-read barrier,
waits for completion, and compares all 768 words, including 756 prefilled guard words.
A bit mismatch prints the word index and returns exit code 1. Both variants run even if the
first comparison fails.
On a GeForce RTX 5070 with Windows driver 616.56, both formats matched 765/768 words.
In the first texel, `(-0, +0, +0, +0)`, word 0 read back as positive zero. The second texel,
`(-0, 1, +0, +0)`, retained every bit. In the third, `(-0, -0, +0, +0)`, words 8 and 9 both
read back as positive zero. All guards matched. This reproduces the discrepancy independently
of RDNA translation. Independent runs of the same probe reproduced those three mismatches on
a Linux RTX 5090 (595.99.02). On Windows, a Ryzen 7 9800X3D Radeon iGPU (25.10.30.02),
an RTX 3080 (616.64) and an RTX 3060 (621.14) preserved all 768 words in both formats.
The device reports are in [PR #3260](https://github.com/ItsNotRexed/Leonida/pull/3260).
### Which known problems the game's shaders reach
Several rows of the table above are tied to particular instructions. A GPU test or fuzzer that hits one does
not by itself mean the game does. The counts below say how many of the 26,503 1.0.2.1 shaders (`shaders.rpf`,
LLVM gfx1013) contain those instructions, by stage and by the wave size their FSSM header gives. They are
counts of instructions over the program up to each listing's last `s_endpgm`. They are not reproductions: a
shader that contains an instruction does not have to take the exact path a row describes.
```sh
python -I tools/op_reach.py <work>/shaders/dxbc/disasm --index <work>/shaders/dxbc/index.json \
--fssm <work>/shaders/dxbc/fssm s_bfe_i64 '*_dpp' v_permlanex16_b32 ds_bpermute_b32 v_mul_f16 ...
```
The corpus has 2,662 wave32 shaders (1,535 CS, 1,127 PS) and 23,841 wave64 shaders (every VS, GS and MS, 1,154
CS, 10,974 PS).
| Row | What the game's shaders contain (1.0.2.1) |
|---|---|
| `cs_w32_salu64` on RDNA1 / RADV 25.2.8 (the high word of `s_bfe_i64`) | **No shader uses `s_bfe_i64`** (nor `s_bfe_u64`). The fixture's failure does not reach a game shader. |
| `lds_fuzz.py --wave 64` `ds_bpermute_b32` on AMD's Windows driver | **No wave64 shader uses `ds_bpermute_b32`**: it occurs in 5 wave32 CS (74 instructions), and `ds_permute_b32` in none. |
| `crosslane_fuzz.py --wave 64` on an AMD iGPU (a `v_permlanex16_b32` after a partial-`row_mask` DPP) | DPP in 4,313 shaders, 2,496 of them wave64 (2,364 PS, 113 CS, 17 MS, 2 VS). `v_permlanex16_b32` in 2,293 shaders, 561 of them wave64. Whether any of them pairs the two with a partial `row_mask` is not counted, so these are upper bounds. |
| `cs_dpp_ops` on MoltenVK 1.4.2 | DPP (any `*_dpp`) in 4,313 shaders (66,354 instructions): 1,817 wave32, 2,496 wave64. |
| `valu_fuzz.py --family f16` signed zero on MoltenVK | `v_mul_f16` 124 shaders, `v_fma_f16` 124, `v_fmac_f16` 130, `v_pk_mul_f16` 55, `v_pk_fma_f16` 47, mostly PS (113–115 for the scalar forms). |
| `ps_interp_f16_high` on MoltenVK (16-bit interpolation) | `v_interp_p1ll_f16` / `v_interp_p2_f16` in 4,776 PS (679 wave32, 4,097 wave64), 59,367 instructions each. The count is the instruction, not the `high` operand. |
| `gs_tri` and `ms_tri` on a Mac | 195 GS and 9,282 MS, all wave64. |
## Posting your result
Submit a pull request adding a file under [`gpu-test-results/`](../gpu-test-results), using the existing files
there as format examples. Follow [CONTRIBUTING.md](../CONTRIBUTING.md) and claim the work in the
[coordination issue][claims] before opening the pull request.
Include your GPU, driver, subgroup range, OS, the commit you built, the tool versions, and the pass, skip and fail
counts each script printed. Label a single-test run clearly instead of presenting it as a full suite run.
Post counts and pass/fail lines only, never shaders or logs from the game. A failure that is not in the table
above gets its own issue, linked from your record.
Use your system's detected CPU, GPU, VRAM and RAM model names in your result record, 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/).
|