diff options
| author | NotRexed <therealnothingfn@gmail.com> | 2026-11-29 14:22:35 -0500 |
|---|---|---|
| committer | NotRexed <therealnothingfn@gmail.com> | 2026-11-29 14:22:35 -0500 |
| commit | d927eb1906bc2b8c10bd5dcb87c2bd32623f2dcd (patch) | |
| tree | e3203aff5811f9076935b11e918c9caba837a9b9 /docs | |
| parent | 9899a9801261e8675379939afda2db409654b13c (diff) | |
| parent | dd87aa405a0d48cbce4269c9d20e50c3ec8b5dbc (diff) | |
Merge remote-tracking branch 'origin/main' into next
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/README.md | 1 | ||||
| -rw-r--r-- | docs/boot.md | 4 | ||||
| -rw-r--r-- | docs/change_gate.md | 313 | ||||
| -rw-r--r-- | docs/d3d12_vulkan.md | 48 | ||||
| -rw-r--r-- | docs/descriptor_lookup_ampere.md | 68 | ||||
| -rw-r--r-- | docs/design.md | 2 | ||||
| -rw-r--r-- | docs/directstorage.md | 22 | ||||
| -rw-r--r-- | docs/testing.md | 3 |
8 files changed, 446 insertions, 15 deletions
diff --git a/docs/README.md b/docs/README.md index a0eeee400..1bb2ea02e 100644 --- a/docs/README.md +++ b/docs/README.md | |||
| @@ -77,6 +77,7 @@ method, scope and caveats. No game data is included. | |||
| 77 | | [modding.md](modding.md) | The mod format: a `mods/<folder>/mod.json` next to `gta6rt.exe` or under `--mods DIR`, swapping a named (or `joaat`) archetype for another; the `tools/leonida_mods.py` manager (`Mods.bat` on Windows, `Mods.sh` on Linux and macOS); load order, the start-up log, and the fact that a swap waits for the executable's archetype lookup address (RT-5). | | 77 | | [modding.md](modding.md) | The mod format: a `mods/<folder>/mod.json` next to `gta6rt.exe` or under `--mods DIR`, swapping a named (or `joaat`) archetype for another; the `tools/leonida_mods.py` manager (`Mods.bat` on Windows, `Mods.sh` on Linux and macOS); load order, the start-up log, and the fact that a swap waits for the executable's archetype lookup address (RT-5). | |
| 78 | | [descriptor_lookup_apple.md](descriptor_lookup_apple.md) | M3 Max GPU timings for texture and sampler descriptor lookups at 1k, 10k and 100k live entries. | | 78 | | [descriptor_lookup_apple.md](descriptor_lookup_apple.md) | M3 Max GPU timings for texture and sampler descriptor lookups at 1k, 10k and 100k live entries. | |
| 79 | | [descriptor_lookup_ada.md](descriptor_lookup_ada.md) | RTX 4070 SUPER (Ada, Windows) timings for the same lookups in VRAM, host-visible and ReBAR memory. | | 79 | | [descriptor_lookup_ada.md](descriptor_lookup_ada.md) | RTX 4070 SUPER (Ada, Windows) timings for the same lookups in VRAM, host-visible and ReBAR memory. | |
| 80 | | [descriptor_lookup_ampere.md](descriptor_lookup_ampere.md) | RTX 3070 (Ampere, Windows, PCIe 3.0 x16, ReBAR off) timings for the same lookups in VRAM, host-visible and 214 MiB BAR1 memory. | | ||
| 80 | | [descriptor_lookup_intel.md](descriptor_lookup_intel.md) | Intel UHD Graphics 770 (Xe-LP, Windows, driver 101.6129) timings for the same lookups at 1k–100k live entries; both memory placements within 0.6% of each other. | | 81 | | [descriptor_lookup_intel.md](descriptor_lookup_intel.md) | Intel UHD Graphics 770 (Xe-LP, Windows, driver 101.6129) timings for the same lookups at 1k–100k live entries; both memory placements within 0.6% of each other. | |
| 81 | | [d3d12_xs_surface.md](d3d12_xs_surface.md) | The 116-slot `d3d12_xs.dll` export surface; 83/83 standard GUIDs match the PC SDK. | | 82 | | [d3d12_xs_surface.md](d3d12_xs_surface.md) | The 116-slot `d3d12_xs.dll` export surface; 83/83 standard GUIDs match the PC SDK. | |
| 82 | | [xdxr.md](xdxr.md) | `BATCHED_DESC2` (`0x50`) and `XDXR_STREAM_DESC` (`0x10`) from `XboxBvhBuilder.dll`'s reads; stream records' offsets and defaults; offline statistics not in the package. | | 83 | | [xdxr.md](xdxr.md) | `BATCHED_DESC2` (`0x50`) and `XDXR_STREAM_DESC` (`0x10`) from `XboxBvhBuilder.dll`'s reads; stream records' offsets and defaults; offline statistics not in the package. | |
diff --git a/docs/boot.md b/docs/boot.md index 864ac0993..688d91dd1 100644 --- a/docs/boot.md +++ b/docs/boot.md | |||
| @@ -109,6 +109,10 @@ Useful switches: | |||
| 109 | read when the trace opens. | 109 | read when the trace opens. |
| 110 | Diagnostic only: a correct run reaches none, so each skipped address is a finding, not a fix. A failed guest file | 110 | Diagnostic only: a correct run reaches none, so each skipped address is a finding, not a fix. A failed guest file |
| 111 | open is always traced as `file_open_failed` (path, error, caller) when `--trace` is on. | 111 | open is always traced as `file_open_failed` (path, error, caller) when `--trace` is on. |
| 112 | * `LEONIDA_SKIP_ASSERTS=N` steps over up to N int3 in guest code, with or without `--trace`, and prints each one | ||
| 113 | as `[rt] LEONIDA_SKIP_ASSERTS: int3 at <module>+0x... stepped over (k of N)`; the next one after N ends the run as | ||
| 114 | before. An int3 in a host module is never stepped over. The same caveat: each skipped address is a finding | ||
| 115 | ([runtime/README.md](../runtime/README.md), "Guest asserts"). | ||
| 112 | * `LEONIDA_STUB_PIPELINES=1` creates a pipeline whose translated shader is missing (no shader library, or no entry | 116 | * `LEONIDA_STUB_PIPELINES=1` creates a pipeline whose translated shader is missing (no shader library, or no entry |
| 113 | for its program) as a stub instead of failing `CreateGraphicsPipelineState` / `CreateComputePipelineState`. | 117 | for its program) as a stub instead of failing `CreateGraphicsPipelineState` / `CreateComputePipelineState`. |
| 114 | A graphics pipeline with a vertex stage (MVP-GPU-04) is a real Vulkan pipeline built from the built-in stages in | 118 | A graphics pipeline with a vertex stage (MVP-GPU-04) is a real Vulkan pipeline built from the built-in stages in |
diff --git a/docs/change_gate.md b/docs/change_gate.md new file mode 100644 index 000000000..5b4dcb355 --- /dev/null +++ b/docs/change_gate.md | |||
| @@ -0,0 +1,313 @@ | |||
| 1 | # Proposal: a change gate for module boundaries, function complexity and doubled text | ||
| 2 | |||
| 3 | **Status: a proposal for the maintainer's decision; nothing on this page is implemented, and the pull request that | ||
| 4 | adds it changes no other file. The numbers were measured at `dde82f2` on the tree and on the 300 squash merges | ||
| 5 | that end with it (one merge round on 2026-11-23 in the original repository, whose history this one carries), with a standard-library prototype that is | ||
| 6 | not part of this pull request.** | ||
| 7 | |||
| 8 | GitHub's search counts 3,680 pull requests merged in the original repository from 2026-11-21 to 2026-11-23. [AGENTS.md](../AGENTS.md) is | ||
| 9 | written for the coding agents that many contributors use, and the template asks about them. Review and CI catch | ||
| 10 | what a diff shows and what a test exercises. Three things a diff does not show: a new dependency on another part of | ||
| 11 | the tree, hidden behind a `sys.path` insert; a function that has grown past the point where a person or an agent can | ||
| 12 | change it without breaking a case it did not look at; and text that a merge doubled. This page proposes one | ||
| 13 | deterministic check for those three. It compares a pull request with its base, blocks only what the pull request | ||
| 14 | adds, tolerates what is already on `main`, and tells the author why a finding matters and how to fix it. Because CI | ||
| 15 | had finished on few pull requests when they were merged (section 1.4), it runs where the code is written and in the | ||
| 16 | merge round as well as in CI. | ||
| 17 | |||
| 18 | Claims are marked: | ||
| 19 | |||
| 20 | - **Measured** — counted on the tree or the history at `dde82f2`; section 6 says how. | ||
| 21 | - **Proposed** — what this page asks the maintainer to accept. | ||
| 22 | - **Open** — a question for the maintainer, collected in section 5. | ||
| 23 | |||
| 24 | ## 1. What was measured | ||
| 25 | |||
| 26 | ### 1.1 Dependencies between parts of the tree | ||
| 27 | |||
| 28 | **Measured.** Python files reach each other through 1,262 `sys.path.insert` calls, which is why 1,527 imports carry | ||
| 29 | `# noqa: E402`. Resolving those paths gives 2,182 import edges between repository files. | ||
| 30 | These boundaries hold today with no exception: | ||
| 31 | |||
| 32 | - `make_game.py` imports only `tools/`. | ||
| 33 | - `viewer/` imports nothing from the repository. | ||
| 34 | - `tools/` never imports `scripts/`, `make_game.py` or `viewer/`; `scripts/` never imports `tests/`. | ||
| 35 | - No import cycle crosses two areas; inside `tools/` there are two, each of two files | ||
| 36 | (`tools/calibrated_texture.py` with `tools/ttpf_mips.py`, `tools/hw_oracle/drm.py` with `tools/hw_oracle/runner.py`). | ||
| 37 | - No production C++ file (`runtime/src`, `runtime/shims`, `runtime/xma_decoder`) includes a `runtime/test` file, and | ||
| 38 | no file-level `#include` cycle exists. | ||
| 39 | |||
| 40 | One boundary is crossed: production code imports test code through 39 edges from 32 files. 26 edges go from | ||
| 41 | `tools/` to `tests/`, 22 of them to `tests/semantic/spirv_mini_interp.py`, which is in effect a shared reference | ||
| 42 | interpreter kept in a test folder; 8 go from `tools/` and 5 from `scripts/` to the GPU fixture helpers in | ||
| 43 | `runtime/test/shaders`. The `scripts/` ones are test runners (`scripts/run_gpu_tests.py`, | ||
| 44 | `scripts/bench_wave64.py`) using the fixture helpers they run, and the rules below allow them. Two of the 300 merges | ||
| 45 | added another edge from `tools/`, both new tools that copied the pattern (`tools/wave_diff.py:53` in `db77244`, | ||
| 46 | `tools/div_fixup_diff.py:104` in `5e54bda`). | ||
| 47 | |||
| 48 | To be fair to the current setup: 31 of the 32 importing files are themselves imported by a test, so an edit to | ||
| 49 | `spirv_mini_interp.py` that breaks a tool makes a test fail once CI runs (section 1.4 shows how often it has not | ||
| 50 | run by the merge). What the edge costs even then is legibility. The file looks like test code, and nothing beside it says that 22 tools depend on | ||
| 51 | it; an author, human or agent, edits it with that context missing. | ||
| 52 | |||
| 53 | The C++ runtime has one directory-level cycle: `runtime/shims` includes `runtime/src` 27 times, and `runtime/src` | ||
| 54 | includes `runtime/shims` 7 times, all from `runtime/src/main.cpp` and `runtime/src/pe_loader.cpp`. Whether that is the | ||
| 55 | intended layering is question 5 in section 5. | ||
| 56 | |||
| 57 | ### 1.2 Function complexity | ||
| 58 | |||
| 59 | **Measured**, cyclomatic complexity (McCabe for Python, lizard's CCN for C++; section 6): | ||
| 60 | |||
| 61 | | Area | Functions | Complexity 11-20 | 21-50 | Above 50 | Largest | | ||
| 62 | |---|---|---|---|---|---| | ||
| 63 | | `tools/` (Python) | 5,579 | 774 | 399 | 95 | 1,261 | | ||
| 64 | | `make_game.py` and `scripts/` | 291 | 37 | 15 | 3 | 280 | | ||
| 65 | | `runtime/src` and `runtime/shims` (C++) | 2,514 | 165 | 88 | 27 | 370 | | ||
| 66 | |||
| 67 | The largest is `Gen._insn` in `tools/rdna2spirv.py` (line 6722): 4,889 lines and a complexity of 1,261 in an | ||
| 68 | 18,229-line file. One `if`/`elif` chain of 182 arms holds nearly all of that; section 2.3 judges such a function arm | ||
| 69 | by arm. | ||
| 70 | |||
| 71 | What the 300 merges did to production functions, checked with the rule proposed in section 2.3: | ||
| 72 | 89 findings in 48 pull requests. Each was labelled after reading its diff | ||
| 73 | (section 6 says by whom): 66 made a function measurably harder to change (new nested logic, a 9 -> 20 or 10 -> 27 | ||
| 74 | jump, an optional feature threaded through an existing function), 21 are correct measurements whose value is | ||
| 75 | arguable, and 2 are artefacts of the tool (section 2.3 lists them). Examples of the first kind: | ||
| 76 | |||
| 77 | | Commit | Function | Complexity before -> after | | ||
| 78 | |---|---|---| | ||
| 79 | | `0a8a552` | `export_bank` in `tools/awc_opus.py` | 19 -> 30 | | ||
| 80 | | `9a9ca1e` | `ExecuteIndirect` in `runtime/shims/d3d12_com.cpp` | 10 -> 27 | | ||
| 81 | | `21e72aa` | `scan_offsets` in `tools/smh_groom.py` | 9 -> 20 | | ||
| 82 | | `86d1c86` | `verify_manifest` in `tools/manifest_verifier.py` | 23 -> 33 | | ||
| 83 | | `c1aa89e` | `verify` in `tools/world_drawable_verify.py` (new) | 34 | | ||
| 84 | |||
| 85 | ### 1.3 Text doubled by a merge | ||
| 86 | |||
| 87 | **Measured.** Eight blocks of six or more lines repeat within the same file on `main`, the trace of a pull request | ||
| 88 | merged twice or a conflict resolved by keeping both sides (line numbers of the first and last non-blank line of each | ||
| 89 | copy; the last row is the first nine lines of the row four above it, which appear a third time): | ||
| 90 | |||
| 91 | | File | First copy | Second copy | | ||
| 92 | |---|---|---| | ||
| 93 | | `docs/models.md` | 568-651 | 653-736 | | ||
| 94 | | `docs/animation.md` | 971-1023 | 1052-1104 | | ||
| 95 | | `docs/animation.md` | 1025-1050 | 1106-1131 | | ||
| 96 | | `docs/shader_validation.md` | 1998-2040 | 2061-2103 | | ||
| 97 | | `docs/gbuffer.md` | 13-49 | 52-88 | | ||
| 98 | | `docs/testing.md` | 337-353 | 355-371 | | ||
| 99 | | `docs/design.md` | 576-590 | 592-606 | | ||
| 100 | | `docs/shader_validation.md` | 2061-2069 | 2174-2182 | | ||
| 101 | |||
| 102 | The existing guards pass on all of them: `tests/test_docs_repeated_lines.py` compares prose lines at most three lines | ||
| 103 | apart and `tests/test_docs_list_items.py` list items at most eight apart, which a doubled section of 84 lines never | ||
| 104 | is. `scripts/merge_check.py` finds the doubling when it is run before a merge round; nothing finds it after. No new | ||
| 105 | doubled block appeared in the 300 merges, so this part of the check guards a failure that is rare now, not frequent. | ||
| 106 | |||
| 107 | ### 1.4 Whether a check runs before the merge | ||
| 108 | |||
| 109 | **Measured** in the original repository. GitHub's search returned 1,000 of the 1,252 pull requests merged there on 2026-11-23 (it stops at 1,000); | ||
| 110 | all of them came from forks. The CI workflow on the head commit each was merged with had: | ||
| 111 | |||
| 112 | | CI workflow at merge | Pull requests | | ||
| 113 | |---|---| | ||
| 114 | | passed | 55 | | ||
| 115 | | failed | 282 | | ||
| 116 | | queued, pending or still running | 661 | | ||
| 117 | | cancelled, or no run | 2 | | ||
| 118 | |||
| 119 | After a merge the push run does not finish either: 164 of the last 165 CI runs for pushes to `main` were cancelled | ||
| 120 | by the next push, and the last one was still pending when read (2026-11-23, about 20:00 UTC). At `867d922` three | ||
| 121 | documentation tests fail on `main`. `tests/test_docs_cli_flags.py` and `tests/test_docs_links.py` have failed since `cc67780`, and later | ||
| 122 | merges changed the items they report; `tests/test_docs_design_rows.py` has failed since `0980bea` (both found with | ||
| 123 | `git bisect`). Neither pull request had a finished CI run when it was merged. | ||
| 124 | |||
| 125 | So a check that lives only in a CI job would have run before the merge for about one pull request in eighteen. This repository merges the same way: of | ||
| 126 | its 40 most recently merged pull requests (read on 2026-11-24 at about 03:20 UTC), 19 had no CI run at merge, 18 had | ||
| 127 | at least one failing CI job, 2 had jobs still pending and 1 had only passing or skipped jobs. | ||
| 128 | Section 2.1 therefore puts it where the code is written and where merges are decided, not only in CI. | ||
| 129 | |||
| 130 | ## 2. The proposed check | ||
| 131 | |||
| 132 | ### 2.1 How it runs | ||
| 133 | |||
| 134 | **Proposed.** One standard-library script under `scripts/`, run with `python -I` like the other tools. The same | ||
| 135 | command gives the same verdict in three places: | ||
| 136 | |||
| 137 | - **By the author, before opening or updating the pull request.** It compares the working tree with the merge base | ||
| 138 | of `origin/main`. [AGENTS.md](../AGENTS.md) gives an agent the command, and the pull request's `Tested` section | ||
| 139 | names the result, the way it names the tests that were run. | ||
| 140 | - **In the merge round, before the push.** One command takes the round's pull requests in merge order and checks each | ||
| 141 | against `main` plus the ones before it, the way `scripts/merge_check.py` checks a round for repeated merges. It | ||
| 142 | needs no runner, so it does not wait for CI approval or a free runner slot. | ||
| 143 | - **In CI, when the pull request's run is approved.** It compares the test merge with its first parent, as the | ||
| 144 | `change-scope` job of `ci.yml` already does. | ||
| 145 | - It looks only at what the pull request changed: the files it touched are parsed again, the import and include | ||
| 146 | graphs are re-linked, and the functions whose lines changed are measured on both sides. On the 300 merges the | ||
| 147 | prototype took 80 ms per pull request (90th percentile 170 ms, slowest 1.9 s); building the state | ||
| 148 | of a whole tree from cold takes 8.2 s, so a CI job without a cache costs about ten seconds. | ||
| 149 | - What is on the base is tolerated by construction, so there is no baseline list for every pull request to edit and | ||
| 150 | conflict on. The one shared file is the exception list (section 2.5), which changes only when a reviewer approves an | ||
| 151 | exception. | ||
| 152 | - No model, no network, no service: the verdict is the same on every machine. C++ complexity uses lizard, pinned in | ||
| 153 | the CI job; everything else is the standard library. | ||
| 154 | |||
| 155 | ### 2.2 The rules | ||
| 156 | |||
| 157 | **Proposed.** "Blocks" means the CI job fails; "reports" means the finding is listed and the job passes. | ||
| 158 | |||
| 159 | | ID | Rule | Kind | On `main` today | Findings in the 300 merges | | ||
| 160 | |---|---|---|---|---| | ||
| 161 | | P1 | `make_game.py` imports only `tools/` | blocks | 0 | 0 | | ||
| 162 | | P2 | `viewer/` imports nothing from the repository | blocks | 0 | 0 | | ||
| 163 | | P3 | `tools/` does not import `scripts/`, `make_game.py` or `viewer/` | blocks | 0 | 0 | | ||
| 164 | | P4 | `tools/` does not import `tests/` or `runtime/` | blocks | 34 edges, tolerated | 2 | | ||
| 165 | | P5 | `scripts/` does not import `tests/`, `make_game.py` or `viewer/` | blocks | 0 | 0 | | ||
| 166 | | P6 | no new or larger Python import cycle | blocks | 2 cycles, tolerated | 0 | | ||
| 167 | | C1 | production C++ does not include `runtime/test` | blocks | 0 | 0 | | ||
| 168 | | C2 | no new or larger `#include` cycle | blocks | 0 | 0 | | ||
| 169 | | D1 | no new block of six lines repeated within one Markdown file | blocks | 8 blocks, tolerated | 0 | | ||
| 170 | | X1 | a new production function has complexity 10 or lower | blocks | — | 44 in 23 pull requests | | ||
| 171 | | X2 | a changed production function at 10 or lower stays at 12 or lower (`main`: 15) | blocks | — | 4 in 4 pull requests | | ||
| 172 | | X3 | a changed production function above 10 grows by at most 2 (`main`: 5) | blocks | — | 41 in 31 pull requests | | ||
| 173 | | R1 | a block of six or more code lines that duplicates code elsewhere | reports | — | 138 | | ||
| 174 | | R2 | an added skip or suppression (`unittest.skip`, `# noqa` other than E402, `# type: ignore`, ...) | reports | — | 24 | | ||
| 175 | |||
| 176 | An edge counts as new when it exists in the pull request and not in its base; a cycle counts as new when it is not | ||
| 177 | contained in one cycle of the base. Existing edges and cycles are never reported again. | ||
| 178 | |||
| 179 | ### 2.3 The complexity rules in detail | ||
| 180 | |||
| 181 | **Proposed.** | ||
| 182 | |||
| 183 | - Production code only: `tools/`, `scripts/`, `make_game.py`, `viewer/`, `runtime/src`, `runtime/shims` and | ||
| 184 | `runtime/xma_decoder`. Tests are left out; a test that checks forty cases in a row is long, not tangled. | ||
| 185 | - Python complexity is McCabe's: one plus each `if`/`elif`, conditional expression, `for`, `while`, `except`, each | ||
| 186 | extra operand of `and`/`or`, each `for` and `if` of a comprehension, and each `case`. Nested functions are measured | ||
| 187 | on their own. C++ uses lizard's CCN. | ||
| 188 | - A function counts as changed when any of its lines changed; it is compared with the function of the same qualified | ||
| 189 | name in the base. | ||
| 190 | - Dispatch functions are judged one arm at a time. A function is a dispatch function when one `if`/`elif` chain | ||
| 191 | testing a single subject against constants (`op == "..."`, `name in (...)`, `isinstance(x, ...)`) has at least | ||
| 192 | eight arms and holds at least half of its decision points. A new arm then needs a complexity of 10 or lower, a | ||
| 193 | changed arm keeps the +2 allowance, and code outside the arms may grow by 2. Adding a translator rule as one more | ||
| 194 | arm of `Gen._insn` passes; adding a 14-branch arm does not. | ||
| 195 | - `main` and `wmain` may grow by 5 instead of 2, because argument and input checks land there. In the 300 merges | ||
| 196 | this let 18 additions through, all labelled arguable: argument and input checks, and one +3 of other logic in | ||
| 197 | `tools/hashdict.py`. `make_game.py` `main` going from 53 to 59 in one pull request still fails. | ||
| 198 | - Known artefacts, both from the 300 merges: `slot_name` in `runtime/shims/d3d12_xs_device.cpp` grew by five `case` | ||
| 199 | labels of a name table (a C++ function is judged whole, since lizard reports no arms); the `VulkanPresenter` | ||
| 200 | constructor in `runtime/src/vulkan_present.h` gained a parameter, so its name changed and it was judged as a new | ||
| 201 | function. A renamed or moved function is judged as new in the same way. | ||
| 202 | |||
| 203 | ### 2.4 What the author sees | ||
| 204 | |||
| 205 | **Proposed.** Every finding carries four parts: why the rule exists, exactly what triggered it, a fix chosen from the | ||
| 206 | shape of the change, and how to ask for an exception. The same findings are written three ways: a GitHub annotation on | ||
| 207 | the line in the pull request's diff, a job summary with the full text, and plain text for a local run. The prototype's | ||
| 208 | output for `0a8a552`, which grew `export_bank` from 19 to 30: | ||
| 209 | |||
| 210 | ```text | ||
| 211 | ERROR X3 tools/awc_opus.py:381 export_bank went from complexity 19 to 30; a changed function may end at 21 | ||
| 212 | why: A function this branchy is too large to change safely: neither a person nor a coding agent keeps all its cases in view, so an edit breaks a case it did not look at. | ||
| 213 | what: export_bank at tools/awc_opus.py:381-439: complexity 19 -> 30 (limit 10) | ||
| 214 | what: added lines that carry decision points (11 on 8 lines): 383, 385, 397, 403, 432-433, 435, 437 | ||
| 215 | what: tools/awc_opus.py:383 (+1): if cue_sheet: | ||
| 216 | what: tools/awc_opus.py:385 (+1): if os.path.exists(sheet): | ||
| 217 | what: tools/awc_opus.py:397 (+1): if cue_sheet: | ||
| 218 | what: tools/awc_opus.py:403 (+3): if cue_sheet and rate == 48000 and samples > 0: | ||
| 219 | what: tools/awc_opus.py:435 (+2): verified = {cid: limit for cid, limit in frame_limits.items() if channel_counts[cid] == 1} | ||
| 220 | fix: 4 of the added branches test `cue_sheet` (lines 383, 397, 403, 432): that is one optional feature threaded through export_bank. Put its steps into a function of their own and call it where the feature applies. | ||
| 221 | fix: It passes at complexity 21 or lower (now 30): moving 9 decision points out is enough. | ||
| 222 | else: If the rule is wrong for this case, add {"rule": "X3", "path": "tools/awc_opus.py", "key": "export_bank", "reason": "..."} to gate_rules.json in this pull request; it counts once a reviewer approves it. | ||
| 223 | |||
| 224 | ``` | ||
| 225 | |||
| 226 | and for `5e54bda`, the second of the two new imports of test code: | ||
| 227 | |||
| 228 | ```text | ||
| 229 | ERROR P4 tools/div_fixup_diff.py:104 new import tools/div_fixup_diff.py -> tests/semantic/spirv_mini_interp.py: tools/ must not import tests/ or runtime/ files (existing edges are tolerated, new ones are not) | ||
| 230 | why: Hidden cross-module coupling: the imported file is changed as if nothing on this side depended on it, so an edit there can break this file without the author or reviewer expecting it. | ||
| 231 | what: tools/div_fixup_diff.py:104 imports tests/semantic/spirv_mini_interp.py (import spirv_mini_interp) | ||
| 232 | fix: `spirv_mini_interp` is shared code kept in a test folder: 21 other tools/ files already import it (tools/buffer_swizzle_probe.py, tools/bvh_tri_probe.py, tools/f32_fuzz.py, ...). Move tests/semantic/spirv_mini_interp.py to tools/ in its own pull request (the tests then import it from tools/), and import it from there. | ||
| 233 | fix: Do not add tests/semantic to sys.path from tools/div_fixup_diff.py: that is the hidden edge this rule stops. | ||
| 234 | else: If the rule is wrong for this case, add {"rule": "P4", "path": "tools/div_fixup_diff.py", "key": "tests/semantic/spirv_mini_interp.py", "reason": "..."} to gate_rules.json in this pull request; it counts once a reviewer approves it. | ||
| 235 | |||
| 236 | ``` | ||
| 237 | |||
| 238 | ### 2.5 Exceptions | ||
| 239 | |||
| 240 | **Proposed.** A finding that is wrong for a case is not fixed by working around the check. The author adds an entry | ||
| 241 | with the rule, the path, the edge or function and a reason to one exception file at the repository root, in the same | ||
| 242 | pull request; the finding then turns into a note, and the entry is visible in the diff for the reviewer to approve or | ||
| 243 | refuse. An entry that no longer matches anything is reported so the file does not grow stale. | ||
| 244 | |||
| 245 | ## 3. What it does not do | ||
| 246 | |||
| 247 | - It changes no existing code and asks nobody to fix what is already on `main`. The 34 imports of test code from | ||
| 248 | `tools/`, the two import cycles and the eight doubled blocks stay until someone chooses to fix them (section 4). | ||
| 249 | - It does not judge whether code is correct; the tests and the reviewer still do that. | ||
| 250 | - It blocks nothing on code duplication or on skips: the tests copy their templates on purpose, and nearly every skip | ||
| 251 | added in the 300 merges was a missing tool, platform or numpy, which is legitimate. | ||
| 252 | - It needs no model and no service. The author adapted it from a gate they use in their own projects; there, a local | ||
| 253 | model chose which documents an agent should read before a change. That part is left out here: the rules file and | ||
| 254 | the messages say what applies to a change, and the same verdict comes out on every machine. | ||
| 255 | |||
| 256 | ## 4. Rollout | ||
| 257 | |||
| 258 | **Proposed**, each step its own pull request: | ||
| 259 | |||
| 260 | 1. This page, for the decision. | ||
| 261 | 2. The implementation: the script with its merge-round mode, the rules and exception files, a standard-library test | ||
| 262 | file under `tests/` (the CI loop picks it up, as `tests/test_ci_registration.py` requires), a job on | ||
| 263 | `ubuntu-24.04`, a few lines in [AGENTS.md](../AGENTS.md) that give an agent the local command and the map of which | ||
| 264 | area may import which, and one line in the pull request template for the result. | ||
| 265 | 3. Follow-up items for the coordination issue, for anyone to claim: move `tests/semantic/spirv_mini_interp.py`, | ||
| 266 | `tests/semantic/spirv_wave_interp.py` and `tests/spirv_interp.py` under `tools/` (removes 25 of the 34 imports | ||
| 267 | of test code from `tools/` at once); delete the second copy of each doubled block in section 1.3; split the largest production | ||
| 268 | functions, starting with those changed most often. | ||
| 269 | |||
| 270 | ## 5. Decisions for the maintainer | ||
| 271 | |||
| 272 | **Open.** | ||
| 273 | |||
| 274 | 1. Are the boundaries in section 2.2 the intended ones? In particular P4: should the reference interpreters move | ||
| 275 | under `tools/` (proposed), or should `tests/semantic` be declared a library that tools may import? | ||
| 276 | 2. Complexity: production code only, limit 10 for a new function, +2 for a changed one (+5 for `main`), dispatch | ||
| 277 | arms judged one by one — accept, or which number to change? | ||
| 278 | 3. Should the job block from the first day (proposed), given the 48 of 300 pull requests it would have | ||
| 279 | stopped and the share of those that were real? | ||
| 280 | 4. Should the merge round run it before each push (proposed, since CI has not finished for most merges; section 1.4), | ||
| 281 | and should a pull request whose author reports no result be sent back? Where should the CI job live, in `ci.yml` | ||
| 282 | or a workflow of its own, and who approves an entry in the exception file? | ||
| 283 | 5. `runtime/src` includes `runtime/shims` from `main.cpp` and `pe_loader.cpp`, and the shims include `runtime/src`: | ||
| 284 | is the loader the composition root that may include both, or should one direction be forbidden? | ||
| 285 | |||
| 286 | ## 6. How the numbers were measured | ||
| 287 | |||
| 288 | - Tree: `dde82f2`. History: the 300 single-parent squash merges that end with it (`dde82f2` and the 299 before it), | ||
| 289 | each compared with its parent; the commit below them is the root of the shallow clone and only served as a base. | ||
| 290 | - Python imports: resolved from the AST, through each file's own directory and every `sys.path` set-up it performs | ||
| 291 | (`insert`, `append`, slice assignment, `extend`, paths from `conftest.py` and from an imported helper). | ||
| 292 | `importlib` loads with a constant path count as edges. The resolver is a heuristic; it left no import of a | ||
| 293 | repository module unresolved in the measured areas. | ||
| 294 | - C++ includes: quoted includes only, resolved against the including file's directory and then the union of the | ||
| 295 | include directories in `runtime/CMakeLists.txt`. | ||
| 296 | - Complexity: Python on the AST with the definition in section 2.3; C++ with lizard 1.24.1. | ||
| 297 | - Duplication: windows of six significant lines (whitespace normalised; blank lines, comments and lines with fewer | ||
| 298 | than four non-space characters skipped). | ||
| 299 | - Every blocking finding was labelled by reading its diff, by one reader: the coding agent that ran the backtest. | ||
| 300 | Each label has a one-line reason (most generated from the label's class and the measured change, five written by | ||
| 301 | hand), and the list can be posted here on request. "Genuine" and "arguable" are a | ||
| 302 | judgement about value; every finding except the 2 artefacts is a correct measurement under the rule as written. | ||
| 303 | - Not measured: how often the rules with no finding in the window (P1 to P3, P5, P6, C1, C2, D1) would be wrong. | ||
| 304 | The prototype's own test builds a small repository in which every rule fires once. | ||
| 305 | - The 300 merges are one merge round of the original repository (committed between 09:35 and 11:23 UTC-6 on 2026-11-23) of pull requests opened | ||
| 306 | over a longer time; rates per pull request may differ in other rounds. | ||
| 307 | - The merge counts in the introduction come from GitHub's search (`is:pr is:merged merged:<date>`), read on | ||
| 308 | 2026-11-23 at about 20:00 UTC. | ||
| 309 | - Section 1.4: the GraphQL search for pull requests merged on 2026-11-23, with the check suites of each one's last | ||
| 310 | commit, taking the suite of the workflow named CI; the push runs from the Actions list for `main`; the first failing | ||
| 311 | commit of each documentation test by `git bisect` between the oldest commit of the window and `867d922`, and each | ||
| 312 | pull request's checks from its page. All read on 2026-11-23 at about 20:00 UTC, before that repository went private. The | ||
| 313 | figures for this repository come from the checks of its 40 most recently merged pull requests. | ||
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md index b6df484bc..2098e348b 100644 --- a/docs/d3d12_vulkan.md +++ b/docs/d3d12_vulkan.md | |||
| @@ -3291,7 +3291,7 @@ The console has two list topologies Vulkan lacks: rectangle list (`IASetPrimitiv | |||
| 3291 | 3291 | ||
| 3292 | | D3D12 / Xbox object | Vulkan / layer object | Notes | | 3292 | | D3D12 / Xbox object | Vulkan / layer object | Notes | |
| 3293 | |---|---|---| | 3293 | |---|---|---| |
| 3294 | | `ID3D12Device` … `ID3D12Device11` | one `Device` object with the public chain plus measured Xbox overrides | The shipped BVH builder names Device11; slots 1/15/18/19/27/38 matched desktop in prior art, slot 48 is called as `(desc, riid, out)` with `IID_ID3D12CommandQueue` (PC slot 48 is `OpenExistingHeapFromAddress`; the 32-byte desc is a PC `D3D12_COMMAND_QUEUE_DESC` plus four Xbox words, logged once, and the proxy takes the slot 8 path with the PC prefix and only `DISABLE_GPU_TIMEOUT` kept), slot 62 is called as `CreateComputePipelineState`, slot 76 is Xbox texture creation, and heap slots 9/10 return in RAX. Unknown Xbox IIDs/slots are logged and refused. | | 3294 | | `ID3D12Device` … `ID3D12Device11` | one `Device` object with the public chain plus measured Xbox overrides | The shipped BVH builder names Device11; slots 1/15/18/19/27/38 matched desktop in prior art, slot 48 is called as `(desc, riid, out)` with `IID_ID3D12CommandQueue` (PC slot 48 is `OpenExistingHeapFromAddress`; the 32-byte desc is a PC `D3D12_COMMAND_QUEUE_DESC` plus four Xbox words, logged once, and the proxy takes the slot 8 path with the PC prefix and only `DISABLE_GPU_TIMEOUT` kept), slot 62 is called at `0x14247FE66` as a create with `(desc, 0, 0, &riid, &out)` — five parameters with an explicit IID/out pair, where the PC method it forwards to, `CreateComputePipelineState`, takes three — and static Capstone disassembly over the executable's `.text` (following the device globals `0x148759D00` and `0x1475DF000`–`0x1475DF048` from renderer init `0x142478440`) finds no device call site for slot 76 (`+0x260`; none of the 57 indirect `call [reg+0x260]` sites in `.text` loads a device global); its only measured caller is the shipped FidelityFX upscaler, with the seven `CreateCommittedResource` arguments ([d3d12_command_objects.md](d3d12_command_objects.md) §3.5a), and heap slots 9/10 return in RAX. Unknown Xbox IIDs/slots are logged and refused. | |
| 3295 | | `ID3D12CommandQueue` | one leased `VkQueue` per live queue: direct queues on the graphics family, compute queues on an async-compute family and copy queues on a transfer-only (DMA) family when the GPU has them (`src/queue_families.h`), else graphics-family leases | Distinct Vulkan queues allow cross-queue waits and signals to make progress. With more than one family in use, buffers, images, the arena and staging are created `VK_SHARING_MODE_CONCURRENT` over those families, so no ownership transfers are needed. Barriers on copy and compute queues are narrowed to the stages their family has; render-target and depth clears are refused there (as in D3D12), and the D24/RGB96 copy conversions and bindless flushes stay off a transfer-only queue. Tested by `vk_queue_test`. `PresentX`, `SuspendX`, `ResumeX` are Xbox queue methods, not in the public vtable; public GDKX samples present only through them (§4.5). Call shapes known, slots **Open**. | | 3295 | | `ID3D12CommandQueue` | one leased `VkQueue` per live queue: direct queues on the graphics family, compute queues on an async-compute family and copy queues on a transfer-only (DMA) family when the GPU has them (`src/queue_families.h`), else graphics-family leases | Distinct Vulkan queues allow cross-queue waits and signals to make progress. With more than one family in use, buffers, images, the arena and staging are created `VK_SHARING_MODE_CONCURRENT` over those families, so no ownership transfers are needed. Barriers on copy and compute queues are narrowed to the stages their family has; render-target and depth clears are refused there (as in D3D12), and the D24/RGB96 copy conversions and bindless flushes stay off a transfer-only queue. Tested by `vk_queue_test`. `PresentX`, `SuspendX`, `ResumeX` are Xbox queue methods, not in the public vtable; public GDKX samples present only through them (§4.5). Call shapes known, slots **Open**. | |
| 3296 | | `ID3D12CommandAllocator` | IR arena + `VkCommandPool` | Reset only when the previous submission's fence is complete. | | 3296 | | `ID3D12CommandAllocator` | IR arena + `VkCommandPool` | Reset only when the previous submission's fence is complete. | |
| 3297 | | `ID3D12GraphicsCommandList` … `8` | `CommandList` with IR | Replay at `ExecuteCommandLists`; bundles inlined. Supports render passes, mesh dispatch, enhanced barriers; records the GCL8 front/back stencil references (applied only once a pipeline path consumes them). `Draw` views are inlined and moved into the command stream (D3D-289), eliminating per-draw heap allocations. | | 3297 | | `ID3D12GraphicsCommandList` … `8` | `CommandList` with IR | Replay at `ExecuteCommandLists`; bundles inlined. Supports render passes, mesh dispatch, enhanced barriers; records the GCL8 front/back stencil references (applied only once a pipeline path consumes them). `Draw` views are inlined and moved into the command stream (D3D-289), eliminating per-draw heap allocations. | |
| @@ -3709,7 +3709,8 @@ The console has two list topologies Vulkan lacks: rectangle list (`IASetPrimitiv | |||
| 3709 | the host refuses and the layer copies on purpose. | 3709 | the host refuses and the layer copies on purpose. |
| 3710 | - A driver can report `VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT` for a format, create the image with | 3710 | - A driver can report `VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT` for a format, create the image with |
| 3711 | host-transfer usage, and then give it no memory type (`memoryTypeBits = 0`). This was measured on a GTX 1050 Ti | 3711 | host-transfer usage, and then give it no memory type (`memoryTypeBits = 0`). This was measured on a GTX 1050 Ti |
| 3712 | with NVIDIA 582.78, and the validation layer of Vulkan SDK 1.4.363 reports nothing. Such a texture is made again | 3712 | with NVIDIA 582.78 and again with 582.66 on Windows 10 (#1364), where the same image without host-transfer usage |
| 3713 | takes device-local memory; the validation layer of Vulkan SDK 1.4.363 reports nothing. Such a texture is made again | ||
| 3713 | without host-transfer usage before it is bound, and takes the staging path. `d3d12_vulkan_device_test` and | 3714 | without host-transfer usage before it is bound, and takes the staging path. `d3d12_vulkan_device_test` and |
| 3714 | `d3d12_subresource_copy_test` force this branch on any GPU with `VulkanDeviceInfo::force_host_transfer_retry` | 3715 | `d3d12_subresource_copy_test` force this branch on any GPU with `VulkanDeviceInfo::force_host_transfer_retry` |
| 3715 | (their third CPU-copy path; the second compares it with the host runtime). | 3716 | (their third CPU-copy path; the second compares it with the host runtime). |
| @@ -3910,13 +3911,52 @@ The console has two list topologies Vulkan lacks: rectangle list (`IASetPrimitiv | |||
| 3910 | and 2^32 in alpha match WARP). `d3d12_clear_test` compares full and rectangular D3D12 readbacks with WARP across | 3911 | and 2^32 in alpha match WARP). `d3d12_clear_test` compares full and rectangular D3D12 readbacks with WARP across |
| 3911 | UNORM, SNORM, FLOAT, all 15 exposed UINT/SINT render targets (11 value vectors, including 8-/16-/10-/2-bit range | 3912 | UNORM, SNORM, FLOAT, all 15 exposed UINT/SINT render targets (11 value vectors, including 8-/16-/10-/2-bit range |
| 3912 | boundaries) and depth/stencil; `clear_color_test` checks both replay paths for 19 integer formats without a GPU, | 3913 | boundaries) and depth/stencil; `clear_color_test` checks both replay paths for 19 integer formats without a GPU, |
| 3913 | including unchanged float values. SRGB clears are omitted from the comparison: the | 3914 | including unchanged float values. SRGB clears are omitted from that comparison; `d3d12_clear_formats_test` |
| 3914 | linear→sRGB encoding rounds differently at the `.5` boundary on WARP vs Vulkan (a 1-ulp driver difference). | 3915 | compares them (next item). |
| 3915 | **Open:** on NVIDIA RTX 5080 (driver 616.56) clears that land exactly on a `.5` UNORM/SNORM step round down where | 3916 | **Open:** on NVIDIA RTX 5080 (driver 616.56) clears that land exactly on a `.5` UNORM/SNORM step round down where |
| 3916 | WARP rounds up: `R8G8B8A8_UNORM`/`SNORM` 0.5 store `7f`/`3f` vs WARP `80`/`40`, and a `D16_UNORM` 0.5 depth clear | 3917 | WARP rounds up: `R8G8B8A8_UNORM`/`SNORM` 0.5 store `7f`/`3f` vs WARP `80`/`40`, and a `D16_UNORM` 0.5 depth clear |
| 3917 | stores `0x7fff` vs WARP `0x8000` (all on `main` before this change; same 1-ulp class as SRGB, not addressed here). | 3918 | stores `0x7fff` vs WARP `0x8000` (all on `main` before this change; same 1-ulp class as SRGB, not addressed here). |
| 3918 | `D32_FLOAT` and `D32_FLOAT_S8X24_UINT` match WARP. | 3919 | `D32_FLOAT` and `D32_FLOAT_S8X24_UINT` match WARP. |
| 3919 | This does not add typed-view reinterpretation of typeless resources. | 3920 | This does not add typed-view reinterpretation of typeless resources. |
| 3921 | - **sRGB RTV clears (D3D-CLEAR-SRGB-ENCODE):** `ClearRenderTargetView` through an `R8G8B8A8_UNORM_SRGB` or | ||
| 3922 | `B8G8R8A8_UNORM_SRGB` view encodes the colour channels in the layer and hands Vulkan the linear value of the | ||
| 3923 | resulting code (`srgb8_from_linear` and `srgb8_linear` in `vulkan_replay.h`); alpha is linear and rounds like | ||
| 3924 | UNORM. Before, the linear float went to `vkCmdClearColorImage` or `vkCmdClearAttachments` as it was and the GPU | ||
| 3925 | encoded it, so the stored byte depended on the GPU: 0.5 was `bb` on an Intel Iris Xe and `bc` on WARP and an | ||
| 3926 | NVIDIA RTX 4060. **Measured** (Windows 11 build 26100, WARP 10.0.26100.5074, Iris Xe with Intel 32.0.101.7092, RTX | ||
| 3927 | 4060 Laptop with NVIDIA 616.92; a scratch program cleared 256-slice sRGB targets through the layer and through | ||
| 3928 | WARP, a whole view and a rectangle each, and bisected over float bit patterns): | ||
| 3929 | - No driver is wrong. D3D permits FLOAT → SRGB a tolerance of 0.6 of a step (Direct3D 11.3 functional | ||
| 3930 | specification, 3.2.3.8), and each implementation puts the 255 steps between two codes somewhere else: measured | ||
| 3931 | against the halfway point of the ideal curve, the Iris Xe's sit between 0.18 of a code below and 0.33 above, the | ||
| 3932 | RTX 4060's within 0.10 and WARP's between 0.29 below and 0.34 above. On each GPU both Vulkan commands have the | ||
| 3933 | same 255 steps. Of 60 000 random values (half uniform in 0..1, half log-uniform from 1e-6) the Iris Xe stored | ||
| 3934 | another byte than WARP for 6 649 and the RTX 4060 for 3 648, never more than one code away. | ||
| 3935 | - WARP takes the value to 12 bits first and encodes that: `j = floor(x * 4095 + 0.5)` with the product rounded to | ||
| 3936 | single precision, then the nearest code of the IEC 61966-2-1 curve at `j / 4095`. The 255 floats at which WARP's | ||
| 3937 | byte changes are the 255 this rule gives (with the product in exact arithmetic only 188 are: `0x3f018018` times | ||
| 3938 | 4095 is 2071.4999986, which a float rounds to 2071.5), and WARP agrees with it on 84 582 further values: every | ||
| 3939 | 12-bit value, five floats around each of the 4 095 places between two of them, the 60 000 random ones, 0, 1, | ||
| 3940 | values outside 0..1, NaN and both infinities. It is not the nearest code of the ideal curve for 2 852 of the | ||
| 3941 | 60 000 (0.0004 is 2, the curve gives 1.32). | ||
| 3942 | - WARP and both GPUs store the linear value of a code as that code, for all 256 codes and with both commands. That | ||
| 3943 | value is the one farthest from any implementation's steps, so it is what the layer hands over; a GPU whose | ||
| 3944 | encoding is more than half a code off at one of these values would still differ. | ||
| 3945 | - Each GPU's own D3D12 driver stores what its Vulkan driver stores (the same byte for 84 582 of 84 582 values, on | ||
| 3946 | both GPUs): the encoding is the hardware's. So the layer used to store the bytes of the D3D12 driver of the GPU it | ||
| 3947 | ran on, and now stores WARP's on every GPU, which differ from the Intel driver's for those 6 649 of 60 000 values | ||
| 3948 | and from the NVIDIA driver's for 3 648. That is the choice made before for the ties of UNORM clears and for D24: | ||
| 3949 | the layer converts, WARP is the reference, and a host driver that does otherwise is a host quirk. | ||
| 3950 | |||
| 3951 | `clear_color_test` (no GPU) pins 38 values to the bytes WARP stored, checks that every code encodes to itself and | ||
| 3952 | that the result is the same under each floating-point rounding mode. `d3d12_clear_formats_test` clears both formats | ||
| 3953 | to the UNORM colours, the value of every code and the value halfway between every two codes (176 colours each, as | ||
| 3954 | a whole view and as a rectangle): against WARP, 178 of the 352 cases differed on the Iris Xe and 170 on the RTX | ||
| 3955 | 4060 before, none after (the five UNORM colours alone differed in 10 of 10 cases on the Iris Xe and in none on the | ||
| 3956 | RTX 4060). `d3d12_state_sweep_test` compares with the D3D12 driver of the same adapter and cleared its sRGB targets | ||
| 3957 | to 0.2, 0.4 and 0.6, of which the first two are codes 124 and 170 on WARP and 123 and 169 on the Iris Xe; it now | ||
| 3958 | clears them to the values of codes 124, 170 and 203, so its eight sRGB cases compare the blending whichever way | ||
| 3959 | the host encodes. A draw into an sRGB target is still encoded by the GPU. | ||
| 3920 | - **Depth clears.** Microsoft documents a `[0, 1]` clamp. On Windows 11 build 26100, both WARP and native D3D12 on | 3960 | - **Depth clears.** Microsoft documents a `[0, 1]` clamp. On Windows 11 build 26100, both WARP and native D3D12 on |
| 3921 | an RTX 5070 Ti (610.74) preserved finite out-of-range `D32_FLOAT` values and quiet NaN in full and rectangle | 3961 | an RTX 5070 Ti (610.74) preserved finite out-of-range `D32_FLOAT` values and quiet NaN in full and rectangle |
| 3922 | clears. Replay preserves those values when the Vulkan device has enabled `VK_EXT_depth_range_unrestricted`. | 3962 | clears. Replay preserves those values when the Vulkan device has enabled `VK_EXT_depth_range_unrestricted`. |
diff --git a/docs/descriptor_lookup_ampere.md b/docs/descriptor_lookup_ampere.md new file mode 100644 index 000000000..440d7ec06 --- /dev/null +++ b/docs/descriptor_lookup_ampere.md | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | # Descriptor lookup cost on NVIDIA RTX 3070 (Ampere) | ||
| 2 | |||
| 3 | Divergent lookups in host-visible system RAM showed a steep cliff once the table reached 100,000 entries on this PCIe 3.0 x16 Ampere card with Resizable BAR off. On the GPU-only memory type, one million logical lane lookups took 270.3 µs at 1,000 live descriptors, 773.3 µs at 10,000 and 2,502.6 µs at 100,000 for divergent misses, and 73.0, 94.3 and 231.9 µs for divergent texture hits. The 214 MiB BAR1 memory type (`DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, exposed even with Resizable BAR disabled) stayed within 0.5% of GPU-only in every cell across all three sizes. By contrast, host-visible memory outside VRAM stayed within 10% of GPU-only at 1,000 entries and within 16% at 10,000, but at 100,000 entries it was 5.0× slower for uniform texture hits, 14.2× slower for divergent texture hits, 21.9× slower for divergent T#+S# pairs and 22.6× slower for divergent misses. These are synthetic compute results from one GeForce RTX 3070 on an idle Windows 11 desktop with NVIDIA driver 621.24. The benchmark ran unchanged at `5d74c27` (with the current default `--warmup-ms 300`). | ||
| 4 | |||
| 5 | ## Measurements | ||
| 6 | |||
| 7 | Each cell is gross GPU time in **µs per million logical lane lookups**, including key reads and result accumulation. The benchmark also prints a figure with a key-read baseline subtracted (summarised below). The table uses its gross column so it compares directly with the [RTX 4070 SUPER (Ada) run](descriptor_lookup_ada.md). | ||
| 8 | |||
| 9 | | Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss | | ||
| 10 | |---:|:---|---:|---:|---:|---:|---:| | ||
| 11 | | 1,000 | GPU-only | 15.0 | 15.1 | 73.0 | 68.2 | 270.3 | | ||
| 12 | | 1,000 | Host-visible | 16.5 | 16.4 | 71.3 | 69.9 | 267.6 | | ||
| 13 | | 1,000 | BAR1 (`host_device_local`) | 15.0 | 15.1 | 73.0 | 68.2 | 270.3 | | ||
| 14 | | 10,000 | GPU-only | 15.5 | 15.0 | 94.3 | 115.9 | 773.3 | | ||
| 15 | | 10,000 | Host-visible | 16.8 | 17.0 | 104.4 | 134.4 | 880.7* | | ||
| 16 | | 10,000 | BAR1 (`host_device_local`) | 15.5 | 15.0 | 94.4 | 115.4 | 771.7 | | ||
| 17 | | 100,000 | GPU-only | 21.7 | 15.7 | 231.9 | 216.6 | 2,502.6 | | ||
| 18 | | 100,000 | Host-visible | 108.0 | 18.4 | 3,290.5 | 4,734.5 | 56,519.6* | | ||
| 19 | | 100,000 | BAR1 (`host_device_local`) | 21.7 | 15.8 | 231.8 | 216.7 | 2,499.3 | | ||
| 20 | |||
| 21 | \* Shortened by the benchmark's Windows timeout guard in all 12 rounds (see Method). | ||
| 22 | |||
| 23 | Net timings (after subtracting the matching key-read baseline) at 100,000 entries were: GPU-only `14.6`, `8.6`, `207.6`, `204.5`, `2,478.3`; BAR1 `14.6`, `8.6`, `207.5`, `204.6`, `2,475.1`; Host-visible `101.0`, `11.5`, `3,265.5`, `4,722.4`, `56,495.1*` µs per million. | ||
| 24 | |||
| 25 | At 100,000 entries on type 1 (GPU-only), a divergent T# dispatch took 3.89 ms, a T#+S# dispatch took 7.27 ms and a divergent miss dispatch took 41.99 ms. Each paired iteration resolves two descriptors. | ||
| 26 | |||
| 27 | GPU-only is type 1, `DEVICE_LOCAL`, on heap 0 (8,018 MiB). Host-visible is type 3, `HOST_VISIBLE | HOST_COHERENT` without `HOST_CACHED`, on heap 1 (16,345 MiB, not device-local). BAR1 (`host_device_local`, selected by `--memory rebar`) is type 5, `DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, on heap 2 (214 MiB). Resizable BAR was **off**: `nvidia-smi` reported a 256 MiB BAR1 aperture (227 MiB used, 29 MiB free at idle), and every allocation on type 5 still succeeded up to the 20.0 MiB table. On this card, keeping the descriptor table out of non-device-local host-visible RAM matters far more at 100,000 entries than on the [Ada PCIe 4.0 + ReBAR card](descriptor_lookup_ada.md) (14.2×–22.6× penalty on divergent traffic here vs 1.45×–2.5× there), while the 214 MiB BAR1 heap remained within 0.5% of GPU-only VRAM in every cell whenever the table fit inside it. | ||
| 28 | |||
| 29 | At 100,000 entries on GPU-only and BAR1, the 12 round medians split deterministically by which table size ran first in the process: the four rounds that started with 1,000 entries (rounds 1, 5, 8 and 12) measured 167.4–167.9 µs per million for divergent T# hits and 1,791.5–1,791.9 for divergent misses; the four that started with 10,000 entries (rounds 3, 6, 7 and 10) measured 231.8–232.1 and 2,498.4–2,505.4; and the four that started with 100,000 entries (rounds 2, 4, 9 and 11) measured 232.2–232.9 and 2,581.9–2,591.8. The table medians follow the eight rounds that did not start at 1,000 entries. The cause was not measured. | ||
| 30 | |||
| 31 | The tables contain 90% T# texture keys and 10% S# sampler keys. Their allocations were 163,844, 2,621,444 and 20,971,524 bytes (0.156, 2.50 and 20.0 MiB). The capacities were 4,096, 65,536 and 524,288 slots, at 24.4%, 15.3% and 19.1% load. At 100,000 entries the ordinary uniform hit runs covered all 90,000 textures or all 10,000 samplers. Each workgroup shared a key for each iteration. The separate hot-key control (`uniform_hot_tsharp`) reused one texture and measured 12.8–13.1 µs per million gross (5.7–6.8 µs net) across all three memory types and sizes. Divergent misses visited 1,024, 16,384 and 131,072 distinct absent keys across the three sizes. Cache residency and memory traffic were unmeasured. | ||
| 32 | |||
| 33 | ## Method and replay | ||
| 34 | |||
| 35 | Each dispatch used 4,096 groups of 64 lanes and 64 iterations. The RTX 3070 reported 32-lane subgroups (`minSubgroupSize = maxSubgroupSize = 32`). The denominator was 16,777,216 logical lookups per single-key dispatch and 33,554,432 per paired dispatch, counting the texture and sampler separately. Vulkan timestamps bracketed one dispatch. The compute queue advertised 64 valid bits and a 1 ns tick period. | ||
| 36 | |||
| 37 | Each cell is the median of 12 process medians, each from 25 timed dispatches after five warmups plus the default `--warmup-ms 300` clock-warmup window (TEST-277). The 11 scenarios ran in the benchmark's fixed order. There were 36 processes: three memory types in each of 12 rounds. Across them there were 29,124 timed dispatches. Every process exited 0, wrote nothing to stderr and reported `timing_status` `ok` on all 1,188 rows. The run used the default Windows Vulkan loader with validation layers off and `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` set to keep overlay layers out of the run; desktop GPU utilization at idle was 2% (993 MiB VRAM used, P5). | ||
| 38 | |||
| 39 | As in the [Ada run](descriptor_lookup_ada.md), this run kept the default `--max-dispatch-ms 120` guard to stay clear of the Windows 2 s GPU timeout (TDR). Only host-visible cells were shortened, all 12 of 12 rounds: at 10,000 entries, `divergent_miss` ran with 13–26 iterations (median dispatch 4.38 ms, range 1.60–6.37 ms); at 100,000 entries, `divergent_miss` ran with 19 iterations in all 12 rounds (median dispatch 281.51 ms, range 276.11–285.21 ms) and `latency_divergent` (outside the summary table; gross median 8,135.0 µs per million) ran with 26 iterations in all 12 rounds (median dispatch 55.45 ms, range 47.57–56.15 ms). | ||
| 40 | |||
| 41 | From a Leonida checkout on Windows, with Visual Studio C++ tools, CMake + Ninja, Windows SDK 10.0.26100+ and Vulkan headers (`VULKAN_SDK` or `-DLEONIDA_VULKAN_HEADERS_FETCH=ON`): | ||
| 42 | |||
| 43 | ```powershell | ||
| 44 | runtime\build\vk_descriptor_bench.exe --list-devices | ||
| 45 | runtime\build\vk_descriptor_bench.exe --self-test | ||
| 46 | $env:DISABLE_RTSS_LAYER = "1" | ||
| 47 | $env:DISABLE_VULKAN_OBS_CAPTURE = "1" | ||
| 48 | foreach ($memory in 'device', 'host', 'rebar') { | ||
| 49 | runtime\build\vk_descriptor_bench.exe --device 0 --memory $memory --sizes 1000,10000,100000 ` | ||
| 50 | --groups 4096 --iters 64 --warmup 5 --reps 25 --warmup-ms 300 --csv | ||
| 51 | } | ||
| 52 | ``` | ||
| 53 | |||
| 54 | Device 0 was the RTX 3070, the only Vulkan device. For the full 12-round series, let A, B and C denote 1k, 10k and 100k. The rounds used the same size orders and starting memory types as the [M3 Max](descriptor_lookup_apple.md) and [Ada](descriptor_lookup_ada.md) runs: the first six size orders were ABC, CBA, BAC, CAB, ACB and BCA, starting with `device`, `host`, `device`, `device`, `host` and `host` respectively; the next six reversed the sequence of rounds and swapped the starting memory type in each, with `rebar` third in every round. | ||
| 55 | |||
| 56 | ## System | ||
| 57 | |||
| 58 | | | | | ||
| 59 | |:---|:---| | ||
| 60 | | GPU | NVIDIA GeForce RTX 3070 (Ampere), 8,192 MiB (discrete) | | ||
| 61 | | PCI id | `0x10de:0x2488`, subsystem `0x404e1458` | | ||
| 62 | | Link | PCIe 3.0 x16 (current and maximum reported by `nvidia-smi`; B450 AORUS M) | | ||
| 63 | | Resizable BAR | Off (BAR1 aperture 256 MiB, `nvidia-smi -q -d MEMORY`; Vulkan heap 2 reports 214 MiB `DEVICE_LOCAL \| HOST_VISIBLE \| HOST_COHERENT`) | | ||
| 64 | | Subgroup size | 32 | | ||
| 65 | | Driver | NVIDIA 621.24 (`nvidia-smi`), Vulkan API 1.4.357 | | ||
| 66 | | OS | Windows 11 Pro 26H2, build 26300.9974 | | ||
| 67 | | Vulkan headers | 1.4.363.0 (`-DLEONIDA_VULKAN_HEADERS_FETCH=ON`) | | ||
| 68 | | Compiler | Visual Studio 18 Professional (MSVC 19.51.36260.0), `RelWithDebInfo` via CMake + Ninja | | ||
diff --git a/docs/design.md b/docs/design.md index fa7e34a4e..d11c33206 100644 --- a/docs/design.md +++ b/docs/design.md | |||
| @@ -300,7 +300,7 @@ How the generated SPIR-V expects the runtime to work: | |||
| 300 | |---|---| | 300 | |---|---| |
| 301 | | Heap-relative buffer device addresses | `Gen.host_addr` sign-extends the low 48 bits of the effective VA after adding any byte offset, then adds `%heap_base`. The runtime stores `device_address - heap_base` in a V#'s 48-bit base field. NVIDIA's Windows driver can place an imported buffer below the heap, so that offset is negative. Zero extension made the resulting device address too high by `2^48`. Console user-mode VAs below `2^47` and full-width root descriptor addresses already within the signed 48-bit range retain their values. A 64-bit base-plus-offset sum gives the correct address for effective VAs in that range, including when the sum crosses zero. Each new shader's `index.json` entry carries `"vsharp_base_sign_extended": true`. Check the field on all loaded entries before enabling below-arena imports for a library, because older modules can share an index with newly translated ones. `tests/semantic/test_vsharp_sext48.py` checks the emitted shifts, both reads against synthetic memory, and the metadata field. | | 301 | | Heap-relative buffer device addresses | `Gen.host_addr` sign-extends the low 48 bits of the effective VA after adding any byte offset, then adds `%heap_base`. The runtime stores `device_address - heap_base` in a V#'s 48-bit base field. NVIDIA's Windows driver can place an imported buffer below the heap, so that offset is negative. Zero extension made the resulting device address too high by `2^48`. Console user-mode VAs below `2^47` and full-width root descriptor addresses already within the signed 48-bit range retain their values. A 64-bit base-plus-offset sum gives the correct address for effective VAs in that range, including when the sum crosses zero. Each new shader's `index.json` entry carries `"vsharp_base_sign_extended": true`. Check the field on all loaded entries before enabling below-arena imports for a library, because older modules can share an index with newly translated ones. `tests/semantic/test_vsharp_sext48.py` checks the emitted shifts, both reads against synthetic memory, and the metadata field. | |
| 302 | | Null sources in 64-bit integer VALU compares | `v_cmp` and `v_cmpx` relations `eq`, `ne`, `lt`, `le`, `gt`, `ge` on `u64` and `i64` read `null` as the 64-bit value 0 in either source, like immediate `0`. Register pairs and immediates retain their existing semantics; `v_cmp` writes the active lane's comparison to VCC/SGPR, while `v_cmpx` narrows EXEC without changing VCC. Source: RDNA2 ISA special operand `null` reads zero; LLVM `llvm-mc -mcpu=gfx1013` accepts the encoding. CPU-checked by `tests/semantic/test_vcmp64_null_src.py` (both sources, signed/unsigned ordering, equality, e32/e64, EXEC and inactive lanes); **not GPU-verified, no corpus count**. | | 302 | | Null sources in 64-bit integer VALU compares | `v_cmp` and `v_cmpx` relations `eq`, `ne`, `lt`, `le`, `gt`, `ge` on `u64` and `i64` read `null` as the 64-bit value 0 in either source, like immediate `0`. Register pairs and immediates retain their existing semantics; `v_cmp` writes the active lane's comparison to VCC/SGPR, while `v_cmpx` narrows EXEC without changing VCC. Source: RDNA2 ISA special operand `null` reads zero; LLVM `llvm-mc -mcpu=gfx1013` accepts the encoding. CPU-checked by `tests/semantic/test_vcmp64_null_src.py` (both sources, signed/unsigned ordering, equality, e32/e64, EXEC and inactive lanes); **not GPU-verified, no corpus count**. | |
| 303 | | `s_load_dword*` with `vcc` 64-bit base pointer | SMEM `s_load_dword*` accepts `vcc` (`{vcc_lo, vcc_hi}`, hardware `s[106:107]`) as its 64-bit base pointer in `Gen.scalar_load`, loading `%vcc` as the low dword and `%vcc_hi` as the high dword; `s_buffer_load*` still requires a 4-dword V# and rejects 2-dword `vcc`. Source: RDNA2 ISA SMEM `SBASE` encoding (`sbase = 53` -> `s[106:107] = vcc`). Confirmed by corpus count over the 2,684-shader pipeline library compute corpus (79 shaders use `vcc` as the `s_load` base: 72 `s_load_dwordx4 sgpr, vcc`, 6 `s_load_dwordx8 sgpr, vcc`, 1 `s_load_dwordx4 slist, vcc`; all 79 translate and pass `spirv-val` under `--wave64-emulate`) and CPU-checked by `tests/semantic/test_sload_vcc_base.py` (`spirv-as` + `spirv-val`) and `tests/semantic/test_scalar_mem_smem.py` (both halves and the resulting addresses); **not GPU-verified**: the synthetic `runtime/test/shaders/cs_smem_vcc_base.asm` reads back eight seeded words through the pair in the standard GPU runner. | | 303 | | `s_load_dword*` with `vcc` 64-bit base pointer | SMEM `s_load_dword*` accepts `vcc` (`{vcc_lo, vcc_hi}`, hardware `s[106:107]`) as its 64-bit base pointer in `Gen.scalar_load`, loading `%vcc` as the low dword and `%vcc_hi` as the high dword; `s_buffer_load*` still requires a 4-dword V# and rejects 2-dword `vcc`. Source: RDNA2 ISA SMEM `SBASE` encoding (`sbase = 53` -> `s[106:107] = vcc`). Confirmed by corpus count over the 2,684-shader pipeline library compute corpus (79 shaders use `vcc` as the `s_load` base: 72 `s_load_dwordx4 sgpr, vcc`, 6 `s_load_dwordx8 sgpr, vcc`, 1 `s_load_dwordx4 slist, vcc`; all 79 translate and pass `spirv-val` under `--wave64-emulate`) and CPU-checked by `tests/semantic/test_sload_vcc_base.py` (`spirv-as` + `spirv-val`) and `tests/semantic/test_scalar_mem_smem.py` (both halves and the resulting addresses); **GPU-checked** with the synthetic `runtime/test/shaders/cs_smem_vcc_base.asm`, which reads back the eight seeded words through the pair in the standard GPU runner (`0x7210..0x7217`): on an AMD Radeon gfx1036 iGPU (Ryzen 7 7800X3D, Windows 11, driver 32.0.21045.29003) and, under `LEONIDA_W64_EMULATE=1`, on an NVIDIA GeForce RTX 4090 (Windows 11, driver 32.0.16.2124); without the emulation the fixture skips on the 4090 (no 64-wide compute subgroup). Still not measured: those eight words of one fixture are the whole hardware check, the 79-program corpus count stays a translation count, and there is no native 32-wide-subgroup run of this form. | |
| 304 | | Execution model | One invocation = one lane. Compute and mesh waves derive lanes from the workgroup-local index; other stages use the subgroup lane. A wave = a subgroup, so cross-lane ops (`ds_swizzle`, `v_permlane*`, `v_readlane`/`v_writelane`, `v_mbcnt`) become subgroup shuffles. Wave32 pixel shaders split a 64-lane physical subgroup into two logical waves: lane IDs are `SubgroupLocalInvocationId & 31`, shuffle sources retain the current half (`& 32`), and ballots/votes use that half's 32-bit word. A value the translator knows is uniform (the bindless descriptor index) is read from the half's first running lane, never from a fixed lane, which need not be running (SHADER-1016). Other stage/wave combinations still require subgroup size == wave size or wave64 emulation. **Requires subgroup size == wave size** (wave32 maps directly onto NVIDIA GPUs; wave64 shaders need a 64-wide subgroup or emulation). `v_readlane_b32`/`v_writelane_b32` mask the lane select with 63 in wave64 (`S1[5:0]`) and 31 in wave32 (`S1[4:0]`); until SHADER-52 both used 63, so a wave32 select ≥ 32 pointed past a 32-wide subgroup. GPU-checked with `cs_w32_lane_wrap.asm` (lane 40 → 8). For the fragment-half rule, `ps_bitmask_perm` produced 4096/4096 exact pixels on an AMD Radeon RX 5700 XT; Vulkan reported a default subgroup size of 64 (range 32..64), but does not permit pinning fragment subgroup size on this device. CPU semantic tests compare a 64-lane wave32 pixel subgroup against two 32-lane subgroups for reads/writes, permutations, ballots, and votes. | | 304 | | Execution model | One invocation = one lane. Compute and mesh waves derive lanes from the workgroup-local index; other stages use the subgroup lane. A wave = a subgroup, so cross-lane ops (`ds_swizzle`, `v_permlane*`, `v_readlane`/`v_writelane`, `v_mbcnt`) become subgroup shuffles. Wave32 pixel shaders split a 64-lane physical subgroup into two logical waves: lane IDs are `SubgroupLocalInvocationId & 31`, shuffle sources retain the current half (`& 32`), and ballots/votes use that half's 32-bit word. A value the translator knows is uniform (the bindless descriptor index) is read from the half's first running lane, never from a fixed lane, which need not be running (SHADER-1016). Other stage/wave combinations still require subgroup size == wave size or wave64 emulation. **Requires subgroup size == wave size** (wave32 maps directly onto NVIDIA GPUs; wave64 shaders need a 64-wide subgroup or emulation). `v_readlane_b32`/`v_writelane_b32` mask the lane select with 63 in wave64 (`S1[5:0]`) and 31 in wave32 (`S1[4:0]`); until SHADER-52 both used 63, so a wave32 select ≥ 32 pointed past a 32-wide subgroup. GPU-checked with `cs_w32_lane_wrap.asm` (lane 40 → 8). For the fragment-half rule, `ps_bitmask_perm` produced 4096/4096 exact pixels on an AMD Radeon RX 5700 XT; Vulkan reported a default subgroup size of 64 (range 32..64), but does not permit pinning fragment subgroup size on this device. CPU semantic tests compare a 64-lane wave32 pixel subgroup against two 32-lane subgroups for reads/writes, permutations, ballots, and votes. | |
| 305 | | DPP | VOP1/VOP2 `_dpp` applies to src0. DPP16 controls (`quad_perm`, `row_shl/shr/ror/share/xmask/mirror/half_mirror`) and DPP8 (`dpp8` + `fi`) select the source lane, then `row_mask` (one bit per 16-lane row) and `bank_mask` (one bit per 4-lane bank) decide which destination lanes update. A lane whose row/bank is off is not written. A source lane outside the row is invalid: `bound_ctrl` 1 uses 0 as src0, otherwise the lane is not written. Hardware applies src0 float modifiers (`neg`/`abs`) after the invalid-lane zero selection, so `-src0` on an invalid lane yields `-0.0f` (`0x80000000`) and `\|src0\|` yields `+0.0f` (HW-DPP-NEG-INVALID-LANE, measured on RDNA3 (gfx1101) RX 7800 XT, RDNA2 not measured; tested by `tests/semantic/test_dpp_bound_ctrl_modifiers.py`). A source lane inactive under EXEC is used when `fi` is 1; otherwise `bound_ctrl` decides. DPP8 always writes an enabled lane: `fi` 1 reads the inactive source, `fi` 0 uses 0. DPP16/8 never leaves its 16/8-lane group, so this is exact on every subgroup at least that wide; under `--wave64-emulate` the exchange goes through the workgroup buffer like the other cross-lane ops. GPU-checked with `runtime/test/shaders/cs_dpp*.asm` on an RTX 3070 and hardware-measured on an RX 6800. On an RX 6700 XT (gfx1031), `tools/crosslane_fuzz.py --dpp-sweep --oracle hw` checks every DPP16 control × `bound_ctrl` × `fi`, every `row_mask`/`bank_mask` pair and the DPP8 selects in wave32 and wave64: 14,412 cases, all matching these rules (BUILD-162, `docs/shader_validation.md` FUZZ-7). The ballot of the source lanes' EXEC bits and the shuffle are each stored to a Function variable of their own (`Gen.eager`): SPIRV-Cross (MoltenVK) inlines a single-use result into the expression that uses it, which put the ballot on the right of a short-circuiting `&&` and the shuffle in a ternary's arm, so lanes out of their row skipped the ballot and row_shr:1's lane 1 found lane 0 inactive (`cs_dpp_ops` on MoltenVK; SHADER-529). A store is a statement every lane runs. For native FI=0, the source-lane ballot bit also selects the shuffle index: an absent or EXEC-off source is redirected to the current subgroup lane before `OpGroupNonUniformShuffle`, because masking an undefined shuffle result afterwards is not sufficient; FI=1 is unchanged. CPU-checked by `tests/semantic/test_dpp_eager_subgroup.py::test_fi0_shuffle_index_is_ballot_safe` with a hand-written `quad_perm` case whose active lane 6 reads absent lane 7 in a seven-invocation wave; **not GPU-verified**. Checked in SPIRV-Cross 1.3.239's MSL for the `cs_dpp*` tests (each op is now its own statement) and by `tests/semantic/test_dpp_eager_subgroup.py`; not yet run on a Mac. Semantics from the RDNA2 ISA, AMD LLVM modifier syntax and the GPUOpen DPP notes. | | 305 | | DPP | VOP1/VOP2 `_dpp` applies to src0. DPP16 controls (`quad_perm`, `row_shl/shr/ror/share/xmask/mirror/half_mirror`) and DPP8 (`dpp8` + `fi`) select the source lane, then `row_mask` (one bit per 16-lane row) and `bank_mask` (one bit per 4-lane bank) decide which destination lanes update. A lane whose row/bank is off is not written. A source lane outside the row is invalid: `bound_ctrl` 1 uses 0 as src0, otherwise the lane is not written. Hardware applies src0 float modifiers (`neg`/`abs`) after the invalid-lane zero selection, so `-src0` on an invalid lane yields `-0.0f` (`0x80000000`) and `\|src0\|` yields `+0.0f` (HW-DPP-NEG-INVALID-LANE, measured on RDNA3 (gfx1101) RX 7800 XT, RDNA2 not measured; tested by `tests/semantic/test_dpp_bound_ctrl_modifiers.py`). A source lane inactive under EXEC is used when `fi` is 1; otherwise `bound_ctrl` decides. DPP8 always writes an enabled lane: `fi` 1 reads the inactive source, `fi` 0 uses 0. DPP16/8 never leaves its 16/8-lane group, so this is exact on every subgroup at least that wide; under `--wave64-emulate` the exchange goes through the workgroup buffer like the other cross-lane ops. GPU-checked with `runtime/test/shaders/cs_dpp*.asm` on an RTX 3070 and hardware-measured on an RX 6800. On an RX 6700 XT (gfx1031), `tools/crosslane_fuzz.py --dpp-sweep --oracle hw` checks every DPP16 control × `bound_ctrl` × `fi`, every `row_mask`/`bank_mask` pair and the DPP8 selects in wave32 and wave64: 14,412 cases, all matching these rules (BUILD-162, `docs/shader_validation.md` FUZZ-7). The ballot of the source lanes' EXEC bits and the shuffle are each stored to a Function variable of their own (`Gen.eager`): SPIRV-Cross (MoltenVK) inlines a single-use result into the expression that uses it, which put the ballot on the right of a short-circuiting `&&` and the shuffle in a ternary's arm, so lanes out of their row skipped the ballot and row_shr:1's lane 1 found lane 0 inactive (`cs_dpp_ops` on MoltenVK; SHADER-529). A store is a statement every lane runs. For native FI=0, the source-lane ballot bit also selects the shuffle index: an absent or EXEC-off source is redirected to the current subgroup lane before `OpGroupNonUniformShuffle`, because masking an undefined shuffle result afterwards is not sufficient; FI=1 is unchanged. CPU-checked by `tests/semantic/test_dpp_eager_subgroup.py::test_fi0_shuffle_index_is_ballot_safe` with a hand-written `quad_perm` case whose active lane 6 reads absent lane 7 in a seven-invocation wave; **not GPU-verified**. Checked in SPIRV-Cross 1.3.239's MSL for the `cs_dpp*` tests (each op is now its own statement) and by `tests/semantic/test_dpp_eager_subgroup.py`; not yet run on a Mac. Semantics from the RDNA2 ISA, AMD LLVM modifier syntax and the GPUOpen DPP notes. | |
| 306 | | DPP on a VOPC compare | A VOPC compare whose src0 field is a DPP marker (250 for DPP16, 233/234 for DPP8) takes src0 through the DPP lane selection of the row above and writes VCC: a lane's bit is `compare(src0 of the selected lane, its own src1)`, with 0 for src0 when the selected lane is out of its row or inactive (`bound_ctrl` 1, or DPP8 with `fi` 0). The second word has the layout of a VOP2's DPP word. `llvm-mc` has no decoding for it on gfx10 (LLVM 21.1.8 rejects the first word for `gfx1013`; LLVM defines the form from GFX11 on), so `tools/shader_disasm.py` prints it: it decodes the pair with the first word turned into `v_max_f32` into `v0`, which takes the same second word, and gives the line the compare's name, a `vcc_lo` destination and the real encoding back (`with_vopc_dpp`); `tools/rdna2_decode.py` decodes it directly. **Only the forms where every lane writes its bit are translated**: `row_mask` and `bank_mask` 0xF and either `bound_ctrl` 1 or DPP8. Any other form is refused (`DPP compare with lanes DPP leaves unwritten`), because what such a lane writes is measured only on RDNA3, not on RDNA2. On RDNA3 (gfx1101, RX 7800 XT, `tools/hw_oracle`, wave32 and wave64; [measurement](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161289307)) a lane DPP leaves unwritten does not keep its bit: `v_cmp` writes 0 to its VCC bit and `v_cmpx` turns it off in EXEC. That holds for an invalid source with `bound_ctrl` 0, and for a lane `row_mask` or `bank_mask` turns off, even with `bound_ctrl` 1. Translating these forms on RDNA2 (gfx1013) would need the same measurement there. `v_cmpx` in DPP form takes the same lane selection and the same forms, and writes EXEC as the plain `v_cmpx` does (a lane that was off stays off); it prints no destination, so its src0 is the first operand (SHADER-VOPCX-DPP). Found in 3 of the 2,684 pipeline-library compute programs of 1.0.2.1: 4 `v_cmp_gt_f32` each, with `quad_perm:[1,0,3,2]`, `quad_perm:[2,3,0,1]`, `row_ror:8` (all `bound_ctrl:1`, masks 0xF) and `dpp8:[4,5,6,7,0,1,2,3]`, beside `v_min/max_f32_dpp` and `v_mov_b32_dpp` on the same lanes. `v_cmpx` in DPP form is in 78 of the 18,837 graphics programs of the pipeline library (all pixel shaders, 113 instructions), all `v_cmpx_gt_f32_dpp vN, -vM quad_perm:[2,3,0,1] row_mask:0xf bank_mask:0xf bound_ctrl:1 fi:1`, a compare against the lane two above or below in its quad. **Not measured on RDNA2 hardware**: the rule follows from the encoding, from LLVM's GFX11 definition of the same form and from the VOP2 DPP rules measured in the row above; the sweep that measured those (`tools/crosslane_fuzz.py --dpp-sweep --oracle hw`) does not cover compares. The RDNA3 measurement above also ran the translated forms (`bound_ctrl` 1, masks 0xF): an invalid source lane gets the compare of a 0 source, as the rule says. Lane values are checked in `tests/semantic/test_dpp_compare.py` (the SPIR-V interpreter) and on a GPU with `runtime/test/shaders/cs_dpp_cmp.asm` and, for `v_cmpx`, `cs_dpp_cmpx.asm` (RTX 4070 Laptop, native wave32 and `--wave64-emulate`). | | 306 | | DPP on a VOPC compare | A VOPC compare whose src0 field is a DPP marker (250 for DPP16, 233/234 for DPP8) takes src0 through the DPP lane selection of the row above and writes VCC: a lane's bit is `compare(src0 of the selected lane, its own src1)`, with 0 for src0 when the selected lane is out of its row or inactive (`bound_ctrl` 1, or DPP8 with `fi` 0). The second word has the layout of a VOP2's DPP word. `llvm-mc` has no decoding for it on gfx10 (LLVM 21.1.8 rejects the first word for `gfx1013`; LLVM defines the form from GFX11 on), so `tools/shader_disasm.py` prints it: it decodes the pair with the first word turned into `v_max_f32` into `v0`, which takes the same second word, and gives the line the compare's name, a `vcc_lo` destination and the real encoding back (`with_vopc_dpp`); `tools/rdna2_decode.py` decodes it directly. **Only the forms where every lane writes its bit are translated**: `row_mask` and `bank_mask` 0xF and either `bound_ctrl` 1 or DPP8. Any other form is refused (`DPP compare with lanes DPP leaves unwritten`), because what such a lane writes is measured only on RDNA3, not on RDNA2. On RDNA3 (gfx1101, RX 7800 XT, `tools/hw_oracle`, wave32 and wave64; [measurement](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161289307)) a lane DPP leaves unwritten does not keep its bit: `v_cmp` writes 0 to its VCC bit and `v_cmpx` turns it off in EXEC. That holds for an invalid source with `bound_ctrl` 0, and for a lane `row_mask` or `bank_mask` turns off, even with `bound_ctrl` 1. Translating these forms on RDNA2 (gfx1013) would need the same measurement there. `v_cmpx` in DPP form takes the same lane selection and the same forms, and writes EXEC as the plain `v_cmpx` does (a lane that was off stays off); it prints no destination, so its src0 is the first operand (SHADER-VOPCX-DPP). Found in 3 of the 2,684 pipeline-library compute programs of 1.0.2.1: 4 `v_cmp_gt_f32` each, with `quad_perm:[1,0,3,2]`, `quad_perm:[2,3,0,1]`, `row_ror:8` (all `bound_ctrl:1`, masks 0xF) and `dpp8:[4,5,6,7,0,1,2,3]`, beside `v_min/max_f32_dpp` and `v_mov_b32_dpp` on the same lanes. `v_cmpx` in DPP form is in 78 of the 18,837 graphics programs of the pipeline library (all pixel shaders, 113 instructions), all `v_cmpx_gt_f32_dpp vN, -vM quad_perm:[2,3,0,1] row_mask:0xf bank_mask:0xf bound_ctrl:1 fi:1`, a compare against the lane two above or below in its quad. **Not measured on RDNA2 hardware**: the rule follows from the encoding, from LLVM's GFX11 definition of the same form and from the VOP2 DPP rules measured in the row above; the sweep that measured those (`tools/crosslane_fuzz.py --dpp-sweep --oracle hw`) does not cover compares. The RDNA3 measurement above also ran the translated forms (`bound_ctrl` 1, masks 0xF): an invalid source lane gets the compare of a 0 source, as the rule says. Lane values are checked in `tests/semantic/test_dpp_compare.py` (the SPIR-V interpreter) and on a GPU with `runtime/test/shaders/cs_dpp_cmp.asm` and, for `v_cmpx`, `cs_dpp_cmpx.asm` (RTX 4070 Laptop, native wave32 and `--wave64-emulate`). | |
diff --git a/docs/directstorage.md b/docs/directstorage.md index d6272e588..10b9390cb 100644 --- a/docs/directstorage.md +++ b/docs/directstorage.md | |||
| @@ -273,16 +273,18 @@ shim beyond the size check it already does. The last one is behaviour the first | |||
| 273 | 256 blocks of a stream. It combines adjacent mips from the same layer with full-stream index anchor | 273 | 256 blocks of a stream. It combines adjacent mips from the same layer with full-stream index anchor |
| 274 | and shared-p-bit constraints. A shared p-bit can relate low red endpoint bits even when its sibling | 274 | and shared-p-bit constraints. A shared p-bit can relate low red endpoint bits even when its sibling |
| 275 | mip supplies only the leading bits. These local fits preserve the recorded precision and exact reference | 275 | mip supplies only the leading bits. These local fits preserve the recorded precision and exact reference |
| 276 | bits. A packed tail whose larger mips are BCPack-coded too has no raw or zlib sibling, so a history field that | 276 | bits. A packed tail whose larger mips are BCPack-coded too has no adjacent raw or zlib sibling, so a history |
| 277 | only such tails use stayed unknown: in the game runs of 2026-11-25 two BC7 tail streams of one pool failed | 277 | field that only such tails use stayed unknown: in the game runs of 2026-11-25 two BC7 tail streams of one pool |
| 278 | with `missing-endpoint` (alpha fields of two history entries). For the streams that still start a chain at a | 278 | failed with `missing-endpoint` (alpha fields of two history entries). For streams that still start a chain at a |
| 279 | missing field, the fitter now decodes the nearest BCPack sibling with the profile so far and fits against it, | 279 | missing field after adjacent-mip fitting, the fitter first pairs their mips with the closest raw or zlib mip on |
| 280 | repeating while a round adds fields. The sibling may sit in the same refused BC7 stream: every block whose | 280 | the same layer across multi-level mip distances, then decodes the nearest BCPack sibling with the profile so far |
| 281 | chains start elsewhere is still determined, and the undetermined ones are left out of the reference. Those | 281 | and fits against it, repeating while a round adds fields. The sibling may sit in the same refused BC7 stream: |
| 282 | fields are fitted, never confirmed, and fill only what the other fits left empty. On the 1.0.2.1 package this | 282 | every block whose chains start elsewhere is still determined, and the undetermined ones are left out of the |
| 283 | raised the BC7 endpoint fields from 4,228 to 4,406 of 6,144; the runtime decoder then refuses 8 of 5,167 BC7 | 283 | reference. Those fields are fitted, never confirmed, and fill only what the earlier fits left empty. On the |
| 284 | streams instead of 60 (both failing requests decode), and the 268 BC6H streams are unchanged (10 refused; a | 284 | 1.0.2.1 package this raised BC6H coverage from 210 to 226 of 256 endpoint rows and 249 to 251 of 256 index rows |
| 285 | refused BC6H sibling is not used as a reference yet). A profile can still lack endpoint values or exceed the reference consistency tolerance. Such a request reports a decompression error before publication. | 285 | (0 of 268 BC6H streams refused instead of 10) and raised BC7 endpoint fields from 4,228 to 4,406 of 6,144 (8 of |
| 286 | 5,167 BC7 streams refused instead of 60; both failing requests decode). A profile can still lack endpoint values | ||
| 287 | or exceed the reference consistency tolerance. Such a request reports a decompression error before publication. | ||
| 286 | - The four swizzle modes interleave stripes from request-wide component planes into 16 KiB (mode 1) or | 288 | - The four swizzle modes interleave stripes from request-wide component planes into 16 KiB (mode 1) or |
| 287 | 32 KiB (modes 2–4) groups. The enum names give the successive stripe widths. The shipped BC4 sample | 289 | 32 KiB (modes 2–4) groups. The enum names give the successive stripe widths. The shipped BC4 sample |
| 288 | separates its endpoint planes from indices across the inflated source. The title's compute shader does | 290 | separates its endpoint planes from indices across the inflated source. The title's compute shader does |
diff --git a/docs/testing.md b/docs/testing.md index d62a0cf99..ec95d8244 100644 --- a/docs/testing.md +++ b/docs/testing.md | |||
| @@ -899,6 +899,7 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin | |||
| 899 | | 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) | | 899 | | 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) | |
| 900 | | 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 | | 900 | | 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 | |
| 901 | | Every test crashes inside `libnvidia-eglcore.so` | NVIDIA's 535 server driver (Ubuntu 24.04's default) | Use driver 615 or newer | | 901 | | Every test crashes inside `libnvidia-eglcore.so` | NVIDIA's 535 server driver (Ubuntu 24.04's default) | Use driver 615 or newer | |
| 902 | | 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/ubiquitarianism/leonida/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 | | ||
| 902 | | `build.py`: 0 translated, reason `.text` | An old `build.py` with LLVM 19 | Update to current `main` | | 903 | | `build.py`: 0 translated, reason `.text` | An old `build.py` with LLVM 19 | Update to current `main` | |
| 903 | | `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 | | 904 | | `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 | |
| 904 | | 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 | | 905 | | 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 | |
| @@ -918,6 +919,8 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin | |||
| 918 | | 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` | | 919 | | 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` | |
| 919 | | 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). | | 920 | | 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). | |
| 920 | | `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 | | 921 | | `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 | |
| 922 | | `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 | | ||
| 923 | | `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 | | ||
| 921 | | `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` | | 924 | | `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` | |
| 922 | | 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 | | 925 | | 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 | |
| 923 | | `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 | | 926 | | `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 | |