From 457735ca8a12b811219cafc4c86cf27dff5f3f1d Mon Sep 17 00:00:00 2001 From: Jan Trencansky Date: Tue, 1 Dec 2026 07:44:31 -0500 Subject: [PATCH 1/3] docs: fix stale repo references and add coding-agent engineering bar --- AGENTS.md | 92 +++++++++++++++++++++++++++++-------- CONTRIBUTING.md | 25 ++++++---- README.md | 4 +- docs/README.md | 2 +- docs/agent_collaboration.md | 4 +- docs/testing.md | 16 +++---- 6 files changed, 102 insertions(+), 41 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index addaff81fa..1fa9f41896 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,17 +6,38 @@ tends to get wrong. ## What this is -A port template for the Xbox Series build of GTA VI, built on the player's PC from their own copy: -`make_game.py` carves and translates the shaders (RDNA2 → SPIR-V), exports the assets and builds `runtime/`, a PE -loader that maps the game's executable and resolves its imports to shims. Nothing of the game is in the repository. +A port of the Xbox Series build of GTA VI that runs on the player's PC from their own copy, with **two runtimes** in +this repository: + +- **`d3d12/` (`leonida.exe`, Rust)** — the playable Direct3D 12 runtime that translates the game's shaders and runs + the game on Windows (and on Linux through Wine/Proton with VKD3D-Proton), launched via `Launcher.bat`, + `scripts/play-d3d12.ps1` or `scripts/play-linux.sh`. +- **`make_game.py` + `runtime/` (`gta6rt.exe`, C++20)** — the offline RDNA2 → SPIR-V shader translator, asset exporter + and recompiled PE loader that maps the game's executable and resolves its imports to shims (including a D3D12 → + Vulkan layer). + +Nothing of the game is in the repository. ## Where things are +- `d3d12/` is the playable Rust Direct3D 12 runtime workspace (`leonida.exe` and its crates), with its measured notes + in [d3d12/docs/findings.md](d3d12/docs/findings.md) and runtime variables in + [d3d12/docs/switches.md](d3d12/docs/switches.md). +- `runtime/` is the C++ PE loader, import shims and D3D12 → Vulkan layer (`gta6rt.exe`), plus CTest suites and GPU + test harnesses in `runtime/test/`. +- `launcher/` holds the web launcher (`index.html`, `serve.py`) and the optional Rust native launcher + (`launcher/native/`); `Launcher.bat` runs `tools/leonida_launcher.py`. `mods/` holds Lua, camera and archetype-swap + mods. - The notes under `docs/` record measured formats, indexed by [docs/README.md](docs/README.md); `docs/design.md` is the one quoted most. -- `scripts/` holds the GPU/Wine test runners (`run_gpu_tests.py`, `run_wine_tests.py`), the translator suite runner - `run_semantic_tests.py`, `check_no_game_data.py` (see the first hard rule below) and PowerShell build helpers. -- `viewer/` is the map viewer: `index.html` plus `serve.py`, a local-only server for the exported world. -- `third_party/` holds the `rpf9-explorer` submodule (`tools/rpf9dump` needs `git submodule update --init`), the vendored `xtaskqueue` the `xgameruntime` shim links and the vendored `bcpack-rs` rANS decoder of the BCPack calibration tools. +- `scripts/` holds the launchers (`play-d3d12.ps1`, `play-linux.sh`), the GPU/Wine test runners (`run_gpu_tests.py`, + `run_wine_tests.py`), the translator and standalone test runners (`run_semantic_tests.py`, `run_standalone_tests.py`), + the red/green verifier (`red_green.py`), `check_no_game_data.py` (see the first hard rule below) and PowerShell build + helpers. +- `viewer/` is the map and asset viewer: `index.html`, `studio.html` and `serve.py`, a local-only server for the + exported world. +- `third_party/` holds the `rpf9-explorer` submodule (`tools/rpf9dump` needs `git submodule update --init`), the + vendored `xtaskqueue` the `xgameruntime` shim links, the vendored `bcpack-rs` rANS decoder of the BCPack calibration + tools, and the license notice for the Cargo `xma` crate linked by `runtime/xma_decoder` (`third_party/xma/`). - `game/xbox-1.0.2.1.json` is the per-file size and SHA-256 manifest of the Xbox package — hashes only, no game content. - `tests/semantic/` is the translator regression suite; a new translator rule comes with a small hand-written `.asm` fixture there. @@ -34,6 +55,20 @@ loader that maps the game's executable and resolves its imports to shims. Nothin contract table in `docs/design.md` with how it was confirmed (a GPU test, a Mesa/LLVM reference, or a count over the corpus). +## Engineering bar + +- **Fix the root cause, never stack workarounds.** Trace bugs, mismatches and regressions to their real cause rather + than layering patches, special cases or silent fallbacks on top of earlier patches. +- **Keep code simple, clean, modular, maintainable and performant.** Structure changes into small, cohesive modules and + functions with clear ownership — no spaghetti control flow, dead code or duplicated logic. On hot paths (frame + submission, command replay, descriptor management, shader translation), be mindful of allocations, copies and + repeated linear scans. +- **Run a separate, read-only reviewer agent before every pull request.** Always invoke an independent read-only + reviewer agent (using one of the code-review models listed in + [CONTRIBUTING.md](CONTRIBUTING.md#ai-assisted-contributions)) to audit the full diff, edge cases, red/green tests and + clean-room rules before opening or updating a pull request. Address its findings and re-run it after non-trivial + edits. + ## Claim before you start - Work is claimed in the coordination issue before a pull request is opened: the open issue titled "Coordinating @@ -41,7 +76,7 @@ loader that maps the game's executable and resolves its imports to shims. Nothin number: ```sh - gh issue list -R ubiquitarianism/leonida --state open --search "Coordinating who works on what in:title" + gh issue list -R ProjectLeonida/mandy --state open --search "Coordinating who works on what in:title" ``` With no `gh` auth, the search link in [CONTRIBUTING.md](CONTRIBUTING.md) works in a browser; say so when you cannot @@ -59,8 +94,8 @@ loader that maps the game's executable and resolves its imports to shims. Nothin - The original repository (`ItsNotRexed/Leonida`) went private on 23 November 2026. A `#N` written before that is an old number and links nowhere: do not cite one as if it could be read, and do not run `gh` against that repository. The old open issues are indexed by title in - [#18](https://github.com/ubiquitarianism/leonida/issues/18) and the old open pull requests are kept as - `old-pr/` branches ([#17](https://github.com/ubiquitarianism/leonida/issues/17)). + [#18](https://github.com/ProjectLeonida/mandy/issues/18) and the old open pull requests are kept as + `old-pr/` branches ([#17](https://github.com/ProjectLeonida/mandy/issues/17)). ## Before you guess, look @@ -71,33 +106,51 @@ loader that maps the game's executable and resolves its imports to shims. Nothin function before measuring it, and measure as [docs/measuring_fps.md](docs/measuring_fps.md) says (a switch by turns inside one run). The variables are listed in [d3d12/docs/switches.md](d3d12/docs/switches.md). - Show the test **fails without the fix**, not just that it passes with it. Run the new case on `main`, or revert - only the source the change touches and run again: a test that has never seen the old behaviour proves the test - compiles, nothing about the fix. Say which of the two you did. + only the source the change touches and run again (for D3D12 Rust crates and Python `tests/`, + `python -I scripts/red_green.py ` automates this): a test that has never seen the old behaviour proves the + test compiles, nothing about the fix. Say which of the two you did. - Check the instrument before trusting the number: rebuild before `ctest` after switching branches (a stale binary is indistinguishable from a bug), compare the **change** between two branches rather than the file (a file diff carries their different bases), and read the test's own header before describing what it proves. ## Test without the game first -None of these need game files. Most run in seconds - the translator suite takes a few minutes (465 files and 6 108 -tests in 297 s on 16 cores on Windows 11) and the two builds longer - so run one translator test file while you -iterate and the whole suite once before the pull request: +None of these need game files. Most run in seconds — the translator suite (over 550 files) takes a few minutes on a +multi-core machine, and the native builds take longer — so run the targeted test file or crate while you iterate and +the relevant full suite once before the pull request: ```powershell +python -I scripts/check_no_game_data.py # every tracked file (or pass explicit paths) python -m compileall -q make_game.py tools tests python -I make_game.py --help python -I scripts/run_semantic_tests.py tests/semantic # translator suite, one file per core; no LLVM, SPIR-V tools or GPU needed python -m unittest discover -s tests/semantic -p test_.py # one translator test file python -I tests/test_.py # standalone standard-library unit test -node --test tests/test_viewer_streaming.cjs # viewer streaming; needs Node 22+ +python -m unittest discover -s tests -p "test_docs_*.py" -v # documentation and repo-hygiene checks +node --test tests/test_*.cjs # viewer streaming & studio tests; needs Node 22+ dotnet build tools/rpf9dump/rpf9dump.csproj -c Release cmake -S runtime -B runtime/build; cmake --build runtime/build --config RelWithDebInfo ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure ``` -`gta6rt` and the shims are Windows-only, so Linux and macOS configure the portable subset of the runtime tests. The +For the Rust D3D12 runtime (`d3d12/`, currently Windows-only; toolchain pinned in `d3d12/rust-toolchain.toml`): + +```powershell +cargo build --workspace --all-targets --locked +cargo test --workspace --exclude xtask --locked -- --skip depth_bounds_pipeline_loads_and_filters_draws +cargo test -p leonida-gpu --features diagnostics --test replay --locked +``` + +Run those from `d3d12/`. (The `--skip` avoids a software-adapter mismatch on Windows CI runners; run +`cargo test -p --locked` while iterating on a single crate.) For the optional Rust native launcher +(`launcher/native/`, Windows and Linux), run `cargo clippy --locked --all-targets -- -D warnings` and +`cargo test --locked` from `launcher/native/`. + +`gta6rt` and the shims are Windows-only, so Linux and macOS configure the portable subset of the `runtime/` tests +(macOS CI in `.github/workflows/runtime.yml` is currently disabled). The runtime tests that need the retail package read `LEONIDA_GAME_DIR` (and `LEONIDA_MOVIE`) and print `SKIP` when -unset; `loader_test` writes small PE images to `%TEMP%\leonida_loader_test`, which antivirus can block. +unset; `loader_test` writes small PE images to `%TEMP%\leonida_loader_test`, which antivirus can block (set +`LEONIDA_TEST_DIR` to a folder it skips). For pytest-based tests (the test files with `import pytest`, or no `__main__` block: they fail to import under `python -I`), use a virtual environment and install the pinned dependencies in @@ -140,6 +193,7 @@ Shard runs write `index.part*.json`; merge them into `index.json` with `--merge` - A text file a tool writes names its line ending - `open(path, "w", encoding="utf-8", newline="\n")` - so the same input gives the same bytes on every platform; `tests/test_text_write_line_endings.py` catches a writer that forgets. - Keep `make_game.py` working on Windows first: paths through `os.path`, no bash in the build. -- In the pull request, say that it was AI-assisted, what you tested and on which GPU and driver. +- In the pull request, say that it was AI-assisted, which specific models were used (including the separate reviewer + agent), what you tested and on which GPU and driver. - How agents share results, ask each other for a test on a machine they do not have and say how sure a claim is: [docs/agent_collaboration.md](docs/agent_collaboration.md). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 94b5dda1a0..24b5e41d9a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,19 +26,21 @@ number and links nowhere now, including the two this page used to send you to: # (the D3D12 → Vulkan page). - The titles of the issues that were open there are indexed in - [#18](https://github.com/ubiquitarianism/leonida/issues/18). To carry one on, open it again here and link the + [#18](https://github.com/ProjectLeonida/mandy/issues/18). To carry one on, open it again here and link the index. - The pull requests that were open there are kept as `old-pr/` branches, listed in - [#17](https://github.com/ubiquitarianism/leonida/issues/17). To carry one on, rebase it on `main`, keep its + [#17](https://github.com/ProjectLeonida/mandy/issues/17). To carry one on, rebase it on `main`, keep its author's commits and open a pull request here. - A GPU test result is a pull request that adds a file to [`gpu-test-results/`](gpu-test-results) in the format of the files there; [docs/testing.md](docs/testing.md) has how to run the tests. - The plan and status of the D3D12 → Vulkan layer are in [docs/d3d12_vulkan.md](docs/d3d12_vulkan.md). -[claims]: https://github.com/ubiquitarianism/leonida/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22 +[claims]: https://github.com/ProjectLeonida/mandy/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22 ## Working on the code +- Fix root causes instead of stacking workarounds, and keep changes simple, clean, modular, maintainable and + performant (see [AGENTS.md](AGENTS.md#engineering-bar)). - Python tools run with `python -I` and use only the standard library unless a file says otherwise. - A text file a tool writes (JSON, CSV, a manifest, an assembly listing) names its line ending: `open(path, "w", encoding="utf-8", newline="\n")` (the same for `Path.open`, `Path.write_text` and a text-mode @@ -55,12 +57,16 @@ number and links nowhere now, including the two this page used to send you to: # files with no `__main__` block or an `import pytest` (they need the packages in `tests/requirements.txt`) run with `python -m pytest tests/test_.py` instead, as [AGENTS.md](AGENTS.md) describes; under `python -I` they fail to import or run nothing. -- Runtime tests: `cmake -S runtime -B runtime/build`, `cmake --build runtime/build --config RelWithDebInfo`, then +- D3D12 runtime tests (Rust workspace in `d3d12/`, currently Windows-only, toolchain pinned in + `d3d12/rust-toolchain.toml`): from `d3d12/`, run `cargo build --workspace --all-targets --locked` and + `cargo test --workspace --exclude xtask --locked` (see `.github/workflows/d3d12.yml`). +- Recompiled runtime tests (`runtime/`): `cmake -S runtime -B runtime/build`, `cmake --build runtime/build --config RelWithDebInfo`, then `ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure`. The CPU tests that need no game data are configured - on Windows; Linux and macOS configure the portable subset (`gta6rt` and the shims are Windows-only). Tests that need the retail package read `LEONIDA_GAME_DIR` (and `LEONIDA_MOVIE` for the Bink + on Windows; Linux and macOS configure the portable subset (`gta6rt` and the shims are Windows-only; macOS CI in + `.github/workflows/runtime.yml` is currently disabled). Tests that need the retail package read `LEONIDA_GAME_DIR` (and `LEONIDA_MOVIE` for the Bink decode test) in place and print `SKIP` when the variable is unset; never copy or commit those files. -- Viewer streaming tests: `node --test tests/test_viewer_streaming.cjs` (Node.js 22+, CI tests 24 LTS; no packages, - browser, network or game data). These execute the viewer streaming code with a synthetic loader and clock. +- Viewer tests: `node --test tests/test_*.cjs` (Node.js 22+, CI tests 24 LTS; no packages, + browser, network or game data). These execute the viewer streaming and studio code with synthetic fixtures. - `loader_test` writes small PE images to a `leonida_loader_test` folder in `%TEMP%`. Antivirus that blocks newly written executables makes it stop with that reason; exclude the folder or set `LEONIDA_TEST_DIR` to one it skips. - Tool checks: `python -m compileall -q make_game.py tools tests`. The optional @@ -82,8 +88,9 @@ match the model to the work and review its output independently: - **New code and reviews:** Claude Opus or Fable; GPT Sol or Astra; Gemini Neon or Carbon. - **Documentation and simple fixes:** at least Claude Sonnet or better, GPT Terra or better, Gemini Hydrogen or better, Muse Wonder or better, DeepSeek v4.1 or better, Kimi K3.1 Pro or better, or Qwen 4 Max or better. -- **Separate reviewer agent:** Run a separate reviewer agent (using one of the models listed for new code and reviews - above) to independently review AI-written changes before opening a pull request. +- **Separate reviewer agent:** Always run a separate, read-only reviewer agent (using one of the models listed for new + code and reviews above) to independently audit diffs, edge cases, tests and clean-room rules before opening or + updating a pull request. - **Disclosure and verification:** Note in the pull request that the change was AI-assisted, and what specific models were used, along with what you tested (and on which GPU and driver when GPU tests apply), as described in [AGENTS.md](AGENTS.md). diff --git a/README.md b/README.md index a5fe604767..377982cf7f 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ game's shaders itself: you need neither the large shader and asset build nor the > from your game and stays on your PC. Never share those files. > [!NOTE] -> **This is a continuation of [NotRexed's Leonida project](https://github.com/ProjectLeonida/Leonida).** The original +> **This is a continuation of NotRexed's Leonida project (`ItsNotRexed/Leonida`, now private).** The original > author has left the project, and development continues here with its full commit history. Credit for the work up to > that point belongs to NotRexed and the contributors listed in the history. @@ -217,7 +217,7 @@ files, extracted assets, generated shaders or logs that quote them to issues or ## Credits -- [Leonida](https://github.com/ItsNotRexed/Leonida) by NotRexed and contributors: the original project, which this +- Leonida (`ItsNotRexed/Leonida`, now private) by NotRexed and contributors: the original project, which this repository continues. - The Direct3D 12 runtime is a tree of other people's work: [VIctory](https://github.com/Marvisak/VIctory) by Marvisak and its contributors (the loader, the runtime services, the Direct3D 12 back end and the shader diff --git a/docs/README.md b/docs/README.md index 860f7ef8ad..41fda19019 100644 --- a/docs/README.md +++ b/docs/README.md @@ -20,7 +20,7 @@ method, scope and caveats. No game data is included. | [progress_dashboard.md](progress_dashboard.md) | A local page of what works, what changed since it last passed and what blocks next: unit and runtime tests, the translator contract by confirmation method, measured imports, corpus counts and, with `--github`, CI and the D3D- items (`tools/progress_dashboard.py`). | | [dev-tools.md](dev-tools.md) | The development CLI `scripts/dev.py`: `discover` (text or `--json`, schema version 1) lists the boot-trace analyzer and the guest-scene runner with their help commands and prerequisites, without running them; live attach, pause, step and screenshots are not available through it. | | [agent_collaboration.md](agent_collaboration.md) | How contributors' coding agents work together through GitHub: which machine profile takes which work, the `AGENT-MSG`, `RUN`, `PICTURE` and `TEST-WANTED` blocks (`PICTURE` from `tools/picture_metrics.py`: a frame's luma, dark regions, lattice and block detectors, an 8x8 diff and a defect class, numbers only), and the evidence tags. A convention, not a measurement. | -| [history/README.md](history/README.md) | The original repository's surviving history as portable, hashed text: the 251 `old-pr/*` branch tips and the 135 indexed old issues, with the script that regenerates them ([#563](https://github.com/ubiquitarianism/leonida/issues/563)). | +| [history/README.md](history/README.md) | The original repository's surviving history as portable, hashed text: the 251 `old-pr/*` branch tips and the 135 indexed old issues, with the script that regenerates them ([#563](https://github.com/ProjectLeonida/mandy/issues/563)). | | [port_status.md](port_status.md) | Where the port stands: Leonida's runtime and shader pipeline as the base, what was patched in from VIctory, and what is still open. | | [port_plan.md](port_plan.md) | What the title needs that Leonida's runtime does not do yet, taken from VIctory, in the order the title hits it and where each fix lands. | diff --git a/docs/agent_collaboration.md b/docs/agent_collaboration.md index 67f7325e5f..a26d3910b1 100644 --- a/docs/agent_collaboration.md +++ b/docs/agent_collaboration.md @@ -13,7 +13,7 @@ with fixed fields, and how sure a claim is. It adds to [CONTRIBUTING.md](../CONT - At the start of a session an agent reads the coordination issue and the open pull requests of its topic ([AGENTS.md](../AGENTS.md#claim-before-you-start)), then [running.md](running.md) and [`gpu-test-results/`](../gpu-test-results). -- The coordination issue has a comment cap and is already in its second thread. A block goes on the pull request or +- The coordination issue has a comment cap and moves to a new thread when full. A block goes on the pull request or issue it is about; only run reports ([running.md](running.md#reporting)) and `claiming:` / `done:` / `finding:` lines go in the coordination issue. @@ -22,7 +22,7 @@ with fixed fields, and how sure a claim is. It adds to [CONTRIBUTING.md](../CONT | Profile | Machine | Work it is best placed for | |---|---|---| | L | 24 GB of video memory or more | Long runs into the world, the large ray-tracing programs described in [running.md](running.md), the control arm of an A/B test | -| M | 8 GB to under 24 GB | Stalls and timing limits, such as the driver's time on pipeline creation (reported by others on one 8 GB laptop card: [#2415, comment](https://github.com/ubiquitarianism/leonida/pull/2415#issuecomment-7206470912)), reproducing a reported failure, what fails when video memory is short | +| M | 8 GB to under 24 GB | Stalls and timing limits, such as the driver's time on pipeline creation (reported by others on one 8 GB laptop card: [#2415, comment](https://github.com/ProjectLeonida/mandy/pull/2415#issuecomment-7206470912)), reproducing a reported failure, what fails when video memory is short | | S | Integrated, older, Intel, Apple | The GPU test suite ([testing.md](testing.md)) and a file in `gpu-test-results/`, driver-specific problems | | F | Several GPUs in one machine | Disjoint shards and pull request checks ([multi_gpu_validation.md](multi_gpu_validation.md)) | | Z | No free GPU, or one busy with a long run | The translator suite, unit tests, docs, tools, pull request review | diff --git a/docs/testing.md b/docs/testing.md index d4974e4057..77442402b4 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -9,7 +9,7 @@ issue][claims] helps more. This page collects the setup steps and the problems testers have run into so far. -[claims]: https://github.com/ubiquitarianism/leonida/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22 +[claims]: https://github.com/ProjectLeonida/mandy/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22 ## Quick start on Windows @@ -27,8 +27,8 @@ problems testers have hit; the steps below link to them. 2. Open a new PowerShell window (so it sees the new `PATH`), clone the repository and build the test programs: ```powershell - git clone --recursive https://github.com/ubiquitarianism/leonida - cd leonida + git clone --recursive https://github.com/ProjectLeonida/mandy + cd mandy powershell -ExecutionPolicy Bypass -File scripts\build_runtime.ps1 ``` @@ -123,8 +123,8 @@ Reading the result: open the `windows` job, step "CPU runtime tests" `k/T Test #i: .... Passed` (or `***Failed`, `***Not Run (Disabled)`); the summary is `100% tests passed out of R`, then the tests that did not run and, on a failure, `The following tests FAILED:`. `R` excludes disabled tests, so report "R/R passed, D disabled (out of T)". A threaded timing test can fail once -on a shared runner: rerun that side before calling it a regression. Other jobs (`macos`, `linux-gpu-tools`, -`wine`) can be red on `main` too; compare with `main`'s latest Runtime run before blaming the pull request. +on a shared runner: rerun that side before calling it a regression. Other jobs (`linux-gpu-tools`, `wine`; `macos` is +currently disabled) can be red on `main` too; compare with `main`'s latest Runtime run before blaming the pull request. Comment on the pull request with the two run links, the `main` commit, and per side the test's own line and the summary (red: ...; green: ...). @@ -517,13 +517,13 @@ of those fail for that reason. ### Run a Windows CI artifact under Wine -The [Runtime workflow](https://github.com/ubiquitarianism/leonida/actions/workflows/runtime.yml) uploads +The [Runtime workflow](https://github.com/ProjectLeonida/mandy/actions/workflows/runtime.yml) uploads `runtime-windows` for seven days. It contains the Windows executables, DLLs, synthetic test shaders, CTest inventory and the path of the Windows checkout. From a clean checkout of the commit used by the Windows job, set `run_id` to the Actions run ID and download the artifact to `runtime/build`: ```sh -gh run download "$run_id" --repo ubiquitarianism/leonida --name runtime-windows --dir runtime/build +gh run download "$run_id" --repo ProjectLeonida/mandy --name runtime-windows --dir runtime/build WINE=wine WINEPREFIX="$(mktemp -d)" WINEDLLOVERRIDES="mscoree,mshtml=" WINEDEBUG=-all \ bash scripts/run_wine_session.sh python3 -I scripts/run_wine_tests.py \ @@ -983,7 +983,7 @@ game's device ignores it`, so leaving them set cannot slow a game down (`run_tin | On RADV with Mesa 25.2 (Ubuntu 24.04's default; 25.2.8 measured) or 25.3 (from the source, not run), `cs_w32_salu64` fails with word 2 = `0` (want `0xFFFFFFFF`) and `cs_signed_zero_nan` fails with word 5 = `0` (want `1`). The `cs_signed_zero_nan` failure alone is also measured on RADV 25.0.7 (RX 7800 XT, Debian 13; @mrbean56, #4421) and on ANV 25.2.8 (Intel UHD 630; @theswiss24, #4571); llvmpipe on Mesa 26.0.8 (Ubuntu 26.04) still gives word 5 = `0`, which `check.py` does not judge there (`UNJUDGED_WORDS`) | Two Mesa bugs, not translator bugs (#166). `cs_w32_salu64`: ACO's `combine_add_sub_b2i` reads a temporary without counting the use, so dead-code elimination removes it (`ACO ERROR: ... never defined` with `MESA_SHADER_CACHE_DISABLE=true`); `RADV_DEBUG=llvm` passes. `cs_signed_zero_nan`: NIR's range analysis (`fmul_is_a_number`) calls `0 * x` a number when `x` may be infinite, so the `x != x` check folds to false despite `SignedZeroInfNanPreserve`. The same NIR code is behind llvmpipe's word 5 (#664) and ANV's, since both drivers run NIR; `cs_w32_salu64` is ACO's, so only RADV has it | Expected with these Mesa versions. From the source, the ACO function is gone from Mesa 26.0 and the NIR code was replaced in 26.1 (neither run); RADV from Mesa 26.3.1 passes both on an 8060S (gfx1151) | | On an Intel iGPU with ANV from Mesa 25.2 (25.2.8 measured), `cs_fmt_int_narrow` fails with word 34 = `0x00000000` (want `0xFFFFFFFF`); the full dump also has words 49 and 129 = `0x80000000` (want `0x8000FFFF`), natively and under `LEONIDA_W64_EMULATE=1` alike (`check.py`'s comparison stops at the first mismatch, so its line names only word 34). Measured on Gen9 at subgroup sizes 8, 16 and 32 alike (UHD 630, CFL GT2; TEST-1000), and on an Arrow Lake-H Arc 140T (device subgroup 8–32; `Intel(R) Graphics (ARL)`, Xe2; ANV 25.2.8-0ubuntu0.24.04.5, Vulkan 1.4.318) | A Mesa bug, not a translator bug (TEST-1000). The fixture's second source dword `0x8000FFFF` reaches the SSBO as `0x80000000`: the translated module holds it as one `OpConstant %uint` stored by a single dword `OpStore` to PhysicalStorageBuffer, no float operation on the path, yet the raw buffer readback (word 129) shows its low halfword `0xffff` zeroed and its high halfword `0x8000` intact — the bit pattern is a negative f32 denormal and it comes back as `-0`, as if flushed. Words 34 and 49 are a correct `16_16_16_16_SINT` load of the corrupted dword (the neighbouring channels sign-extend correctly). The module requests `DenormPreserve 16` and `SignedZeroInfNanPreserve 32`, not `DenormPreserve 32`, and the same module passes 136/136 on gfx1036 (native `hw_oracle`), llvmpipe, an RTX 2060 SUPER, 5060 Laptop and 5080, an RX 7900 XTX under RADV, Xe-LP (UHD 770, ANV 26.3.1) and Meteor Lake (ANV 26.2.7); adding `OpExecutionMode DenormPreserve 32` by hand fixes all 136 words on both Gen9 and the Arc 140T | Expected with this Mesa. Don't add `DenormPreserve 32` to the translator for it: the game runs f32 denormals flushed (`denorm_mode_32 = 0`, docs/design.md) and the translator leaves denormal handling to the driver. A newer Mesa passes (26.2.7 on Meteor Lake, 26.3.1 on Xe-LP); Gen9 and the Arc 140T with a newer Mesa not run | | Every test crashes inside `libnvidia-eglcore.so` | NVIDIA's 535 server driver (Ubuntu 24.04's default) | Use driver 615 or newer | -| The synthetic `cs_imgstore_cube` test reports 63 bad `r32 sint` texels on a Tesla V100-SXM2-16GB (Volta, NVIDIA 580.178.04, Linux; Vulkan 1.4.312; [#1492](https://github.com/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 | +| The synthetic `cs_imgstore_cube` test reports 63 bad `r32 sint` texels on a Tesla V100-SXM2-16GB (Volta, NVIDIA 580.178.04, Linux; Vulkan 1.4.312; [#1492](https://github.com/ProjectLeonida/mandy/issues/1492)) | The signed 32-bit cube-storage-write failure is known on that reported host, but its cause has not been isolated. It passes on an RTX 5090 with NVIDIA 621.14 on Windows 11 | No workaround is confirmed. Keep the test's expected values; report the GPU, driver and output if you reproduce it on another setup | | `build.py`: 0 translated, reason `.text` | An old `build.py` with LLVM 19 | Update to current `main` | | `vk_harness` doesn't compile: `VK_KHR_maintenance8` names unknown | Vulkan headers older than the SDK the code was written against | Update to current `main` (the code now builds without it), or use current Khronos Vulkan-Headers; conda-forge's package is too old | | Configure stops with "Vulkan headers too old: ... VK_HEADER_VERSION N" (before: the build stopped at `d3d12_com.h(42): error C3646: 'calibrated': unknown override specifier` and 100+ errors in `d3d12_vulkan_device.cpp`, or at `VkPhysicalDevicePipelineBinaryFeaturesKHR` in `vk_harness.cpp`) | The Windows runtime found Vulkan headers older than v1.3.294 (`runtime/cmake/vulkan_headers_version.cmake`). conda-forge's `vulkan-headers` resolves to 1.3.231 next to `llvm-tools`. Measured on MSVC 14.51: v1.3.294 builds every target, SDK 1.3.280.0 all but `vk_harness` (`VK_KHR_pipeline_binary` is new in v1.3.294), 1.3.231 stops in the D3D12 layer | Point `VULKAN_SDK` at a Vulkan SDK from 1.3.296.0 on or current Khronos Vulkan-Headers, then delete `CMakeCache.txt`; or pass `-DLEONIDA_VULKAN_HEADERS_FETCH=ON` with no other headers installed | From 8246772326d76c92367395df7e0ea87b303d6504 Mon Sep 17 00:00:00 2001 From: Jan Trencansky Date: Tue, 1 Dec 2026 07:53:33 -0500 Subject: [PATCH 2/3] docs: deduplicate AGENTS/CONTRIBUTING and consolidate descriptor_lookup docs --- AGENTS.md | 182 ++++++++++++--------------- CONTRIBUTING.md | 96 ++++++--------- docs/README.md | 14 +-- docs/descriptor_lookup.md | 203 +++++++++++++++++++++++++++++++ docs/descriptor_lookup_ada.md | 70 ----------- docs/descriptor_lookup_ampere.md | 68 ----------- docs/descriptor_lookup_apple.md | 48 -------- docs/descriptor_lookup_intel.md | 39 ------ 8 files changed, 321 insertions(+), 399 deletions(-) create mode 100644 docs/descriptor_lookup.md delete mode 100644 docs/descriptor_lookup_ada.md delete mode 100644 docs/descriptor_lookup_ampere.md delete mode 100644 docs/descriptor_lookup_apple.md delete mode 100644 docs/descriptor_lookup_intel.md diff --git a/AGENTS.md b/AGENTS.md index 1fa9f41896..91a61306ba 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,59 +1,46 @@ # Guide for coding agents -Read this before changing anything here. [CONTRIBUTING.md](CONTRIBUTING.md) has the rules for every contributor and -[docs/design.md](docs/design.md) the formats and the translator's runtime contract; this file adds what an agent -tends to get wrong. +Read this alongside [CONTRIBUTING.md](CONTRIBUTING.md) (shared contributor, clean-room, claiming and AI-disclosure +rules) and [docs/design.md](docs/design.md) (measured formats and translator contract). This file covers repository +layout, the engineering bar, agent-specific traps, and the canonical no-game-files test commands. -## What this is +## Repository layout -A port of the Xbox Series build of GTA VI that runs on the player's PC from their own copy, with **two runtimes** in -this repository: +A port of the Xbox Series build of GTA VI running on the player's PC from their own copy, with **two runtimes** and +nothing of the game in the repository: -- **`d3d12/` (`leonida.exe`, Rust)** — the playable Direct3D 12 runtime that translates the game's shaders and runs - the game on Windows (and on Linux through Wine/Proton with VKD3D-Proton), launched via `Launcher.bat`, - `scripts/play-d3d12.ps1` or `scripts/play-linux.sh`. +- **`d3d12/` (`leonida.exe`, Rust)** — the playable Direct3D 12 runtime on Windows (and Linux via Wine/Proton + + VKD3D-Proton), launched via `Launcher.bat`, `scripts/play-d3d12.ps1` or `scripts/play-linux.sh`. Measured notes: + [d3d12/docs/findings.md](d3d12/docs/findings.md); variables: [d3d12/docs/switches.md](d3d12/docs/switches.md). - **`make_game.py` + `runtime/` (`gta6rt.exe`, C++20)** — the offline RDNA2 → SPIR-V shader translator, asset exporter - and recompiled PE loader that maps the game's executable and resolves its imports to shims (including a D3D12 → - Vulkan layer). - -Nothing of the game is in the repository. - -## Where things are - -- `d3d12/` is the playable Rust Direct3D 12 runtime workspace (`leonida.exe` and its crates), with its measured notes - in [d3d12/docs/findings.md](d3d12/docs/findings.md) and runtime variables in - [d3d12/docs/switches.md](d3d12/docs/switches.md). -- `runtime/` is the C++ PE loader, import shims and D3D12 → Vulkan layer (`gta6rt.exe`), plus CTest suites and GPU - test harnesses in `runtime/test/`. -- `launcher/` holds the web launcher (`index.html`, `serve.py`) and the optional Rust native launcher - (`launcher/native/`); `Launcher.bat` runs `tools/leonida_launcher.py`. `mods/` holds Lua, camera and archetype-swap - mods. -- The notes under `docs/` record measured formats, indexed by [docs/README.md](docs/README.md); `docs/design.md` is the one quoted most. -- `scripts/` holds the launchers (`play-d3d12.ps1`, `play-linux.sh`), the GPU/Wine test runners (`run_gpu_tests.py`, - `run_wine_tests.py`), the translator and standalone test runners (`run_semantic_tests.py`, `run_standalone_tests.py`), - the red/green verifier (`red_green.py`), `check_no_game_data.py` (see the first hard rule below) and PowerShell build - helpers. -- `viewer/` is the map and asset viewer: `index.html`, `studio.html` and `serve.py`, a local-only server for the - exported world. -- `third_party/` holds the `rpf9-explorer` submodule (`tools/rpf9dump` needs `git submodule update --init`), the - vendored `xtaskqueue` the `xgameruntime` shim links, the vendored `bcpack-rs` rANS decoder of the BCPack calibration - tools, and the license notice for the Cargo `xma` crate linked by `runtime/xma_decoder` (`third_party/xma/`). -- `game/xbox-1.0.2.1.json` is the per-file size and SHA-256 manifest of the Xbox package — hashes only, no game content. -- `tests/semantic/` is the translator regression suite; a new translator rule comes with a small hand-written `.asm` fixture there. + and recompiled PE loader with import shims and a D3D12 → Vulkan layer (`runtime/test/` has CTest and GPU harnesses). +- **`launcher/` & `mods/`** — web launcher (`index.html`, `serve.py`), optional Rust native launcher + (`launcher/native/`), `Launcher.bat` (`tools/leonida_launcher.py`), and Lua, camera and archetype-swap mods. +- **`docs/`** — measured format and runtime notes, indexed by [docs/README.md](docs/README.md); `docs/design.md` is + quoted most. +- **`scripts/`** — launchers (`play-d3d12.ps1`, `play-linux.sh`), GPU/Wine test runners (`run_gpu_tests.py`, + `run_wine_tests.py`), translator/standalone runners (`run_semantic_tests.py`, `run_standalone_tests.py`), red/green + verifier (`red_green.py`), `check_no_game_data.py` and PowerShell build helpers. +- **`viewer/`** — local-only map and asset viewer (`index.html`, `studio.html`, `serve.py`). +- **`third_party/`** — `rpf9-explorer` submodule (`tools/rpf9dump` needs `git submodule update --init`), vendored + `xtaskqueue` (`xgameruntime` shim), vendored `bcpack-rs` (BCPack calibration), and the Cargo `xma` license notice + (`third_party/xma/`, linked by `runtime/xma_decoder`). +- **`game/xbox-1.0.2.1.json`** — package size and SHA-256 manifest (hashes only, no game content). +- **`tests/semantic/`** — translator regression suite; a new translator rule comes with a small hand-written `.asm` + fixture there. ## Hard rules -- **No game data, ever**: no archives, executables, carved files, shaders in any form (DXBC, FSSM, disassembly, - SPIR-V), textures, audio, or logs and reports that quote them, in commits, issues, pull requests or test - fixtures. A test that needs a shader builds its input by hand or reads it from the user's work folder. - `python -I scripts/check_no_game_data.py ...` reads the first bytes of the files you name, so it catches a - renamed file the extension check in CI misses. -- **No keys, decryption or protection workarounds.** If a format turns out to be encrypted, write that down in - `docs/design.md` and stop there. -- **Nothing online**: no Xbox Live or Rockstar services or domains. -- **Fix, don't disable**: a shader the translator rejects gets a rule, not a skip list. A new rule goes into the - contract table in `docs/design.md` with how it was confirmed (a GPU test, a Mesa/LLVM reference, or a count over - the corpus). +Follow the clean-room rules in [CONTRIBUTING.md](CONTRIBUTING.md) (no game data, no keys/decryption/protection +workarounds, nothing online), plus these agent-specific rules: + +- **Verify clean-room before every commit:** run `python -I scripts/check_no_game_data.py` (or pass explicit paths) — + it inspects file header bytes and catches renamed files that CI's extension check misses. A test needing a shader + builds its input by hand or reads from the user's work folder. +- **Encrypted formats stop at documentation:** if a format turns out to be encrypted, record that in `docs/design.md` + and stop there. +- **Fix, don't disable:** a shader the translator rejects gets a rule, not a skip list. Add every new rule to the + contract table in `docs/design.md` with how it was confirmed (a GPU test, a Mesa/LLVM reference, or a corpus count). ## Engineering bar @@ -61,63 +48,51 @@ Nothing of the game is in the repository. than layering patches, special cases or silent fallbacks on top of earlier patches. - **Keep code simple, clean, modular, maintainable and performant.** Structure changes into small, cohesive modules and functions with clear ownership — no spaghetti control flow, dead code or duplicated logic. On hot paths (frame - submission, command replay, descriptor management, shader translation), be mindful of allocations, copies and + submission, command replay, descriptor management, shader translation), avoid unnecessary allocations, copies and repeated linear scans. - **Run a separate, read-only reviewer agent before every pull request.** Always invoke an independent read-only - reviewer agent (using one of the code-review models listed in - [CONTRIBUTING.md](CONTRIBUTING.md#ai-assisted-contributions)) to audit the full diff, edge cases, red/green tests and - clean-room rules before opening or updating a pull request. Address its findings and re-run it after non-trivial - edits. + reviewer agent (using one of the code-review models in [CONTRIBUTING.md](CONTRIBUTING.md#ai-assisted-contributions)) + to audit the full diff, edge cases, red/green tests and clean-room rules before opening or updating a pull request. + Address its findings and re-run it after non-trivial edits. ## Claim before you start -- Work is claimed in the coordination issue before a pull request is opened: the open issue titled "Coordinating - who works on what". It moves to a new issue when the thread gets long, so look it up instead of using an old - number: +Follow the claiming workflow and `ItsNotRexed/Leonida` archive pointers in +[CONTRIBUTING.md](CONTRIBUTING.md#before-you-start). Agent-specific rules: + +- Look up the active coordination issue before starting (never hardcode an old number): ```sh gh issue list -R ProjectLeonida/mandy --state open --search "Coordinating who works on what in:title" ``` - With no `gh` auth, the search link in [CONTRIBUTING.md](CONTRIBUTING.md) works in a browser; say so when you cannot - read the claims at all rather than guessing that a thing is unclaimed. - - Check its tables and the open pull requests first. If someone has claimed the item or has a pull request for it, - stop and tell the user instead of writing it a second time. -- Put the item ID from that issue in the pull request, and `Depends on: #N` for every pull request yours builds on. -- Found work you won't do yourself (a bug, a missing method, a stale doc, a follow-up of your own pull request)? - Post it in the coordination issue as `finding: `, followed by where it is (file and line), why it matters, - and whether it needs game files or particular hardware. The coordinator checks it and lists it for others. -- For the D3D12 → Vulkan layer (`runtime/shims/d3d12_*`, `runtime/src/vulkan_*`), also read - [docs/d3d12_vulkan.md](docs/d3d12_vulkan.md) and the open pull requests: most of that work builds on a few of - them. The page that tracked it, #313, was in the original repository and is gone. -- The original repository (`ItsNotRexed/Leonida`) went private on 23 November 2026. A `#N` written before that is - an old number and links nowhere: do not cite one as if it could be read, and do not run `gh` against that - repository. The old open issues are indexed by title in - [#18](https://github.com/ProjectLeonida/mandy/issues/18) and the old open pull requests are kept as - `old-pr/` branches ([#17](https://github.com/ProjectLeonida/mandy/issues/17)). + If you lack `gh` auth, tell the user instead of guessing an item is unclaimed. Check its tables and open pull + requests first; if claimed or already open, stop and tell the user rather than duplicating it. +- Include the item ID and `Depends on: #N` for every pull request yours builds on. Report unworked follow-ups as + `finding: ` with file, line, impact, and whether game files or specific hardware are needed. +- For the D3D12 → Vulkan layer (`runtime/shims/d3d12_*`, `runtime/src/vulkan_*`), read + [docs/d3d12_vulkan.md](docs/d3d12_vulkan.md) and the open pull requests first. +- Never run `gh` against the private `ItsNotRexed/Leonida` repo or cite a pre-23-November-2026 `#N` as readable. ## Before you guess, look - The format or behaviour may already be measured in `docs/design.md`. Quote the file and offset a claim comes from, or call it a hypothesis. - Count over the whole corpus, not a sample: a rule that holds for 400 shaders can fail on the other 26 000. -- Frame rates of the D3D12 runtime (`d3d12/`): search [d3d12/docs/findings.md](d3d12/docs/findings.md) for the switch or - function before measuring it, and measure as [docs/measuring_fps.md](docs/measuring_fps.md) says (a switch by turns - inside one run). The variables are listed in [d3d12/docs/switches.md](d3d12/docs/switches.md). +- Frame rates of the D3D12 runtime (`d3d12/`): search [d3d12/docs/findings.md](d3d12/docs/findings.md) for the switch + or function before measuring it, and measure as [docs/measuring_fps.md](docs/measuring_fps.md) says (a switch by + turns inside one run). The variables are listed in [d3d12/docs/switches.md](d3d12/docs/switches.md). - Show the test **fails without the fix**, not just that it passes with it. Run the new case on `main`, or revert only the source the change touches and run again (for D3D12 Rust crates and Python `tests/`, - `python -I scripts/red_green.py ` automates this): a test that has never seen the old behaviour proves the - test compiles, nothing about the fix. Say which of the two you did. -- Check the instrument before trusting the number: rebuild before `ctest` after switching branches (a stale binary - is indistinguishable from a bug), compare the **change** between two branches rather than the file (a file diff - carries their different bases), and read the test's own header before describing what it proves. + `python -I scripts/red_green.py ` automates this). Say which you did. +- Check the instrument before trusting the number: rebuild before `ctest` after switching branches, compare the + **change** between two branches rather than the file, and read the test's own header before describing what it proves. ## Test without the game first None of these need game files. Most run in seconds — the translator suite (over 550 files) takes a few minutes on a -multi-core machine, and the native builds take longer — so run the targeted test file or crate while you iterate and -the relevant full suite once before the pull request: +multi-core machine, and native builds take longer — so run the targeted test file or crate while iterating and the +relevant full suite once before the pull request: ```powershell python -I scripts/check_no_game_data.py # every tracked file (or pass explicit paths) @@ -127,13 +102,14 @@ python -I scripts/run_semantic_tests.py tests/semantic # translator suite, one python -m unittest discover -s tests/semantic -p test_.py # one translator test file python -I tests/test_.py # standalone standard-library unit test python -m unittest discover -s tests -p "test_docs_*.py" -v # documentation and repo-hygiene checks -node --test tests/test_*.cjs # viewer streaming & studio tests; needs Node 22+ +node --test tests/test_*.cjs # viewer streaming & studio tests; needs Node 22+ (CI runs 24 LTS) dotnet build tools/rpf9dump/rpf9dump.csproj -c Release cmake -S runtime -B runtime/build; cmake --build runtime/build --config RelWithDebInfo ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure ``` -For the Rust D3D12 runtime (`d3d12/`, currently Windows-only; toolchain pinned in `d3d12/rust-toolchain.toml`): +For the Rust D3D12 runtime (`d3d12/`, currently Windows-only; toolchain pinned in `d3d12/rust-toolchain.toml`), run +from `d3d12/`: ```powershell cargo build --workspace --all-targets --locked @@ -141,38 +117,32 @@ cargo test --workspace --exclude xtask --locked -- --skip depth_bounds_pipeline_ cargo test -p leonida-gpu --features diagnostics --test replay --locked ``` -Run those from `d3d12/`. (The `--skip` avoids a software-adapter mismatch on Windows CI runners; run -`cargo test -p --locked` while iterating on a single crate.) For the optional Rust native launcher -(`launcher/native/`, Windows and Linux), run `cargo clippy --locked --all-targets -- -D warnings` and -`cargo test --locked` from `launcher/native/`. +(The `--skip` avoids a software-adapter mismatch on Windows CI runners; run `cargo test -p --locked` while +iterating on one crate.) For the optional Rust native launcher (`launcher/native/`, Windows and Linux), run +`cargo clippy --locked --all-targets -- -D warnings` and `cargo test --locked` from `launcher/native/`. -`gta6rt` and the shims are Windows-only, so Linux and macOS configure the portable subset of the `runtime/` tests -(macOS CI in `.github/workflows/runtime.yml` is currently disabled). The -runtime tests that need the retail package read `LEONIDA_GAME_DIR` (and `LEONIDA_MOVIE`) and print `SKIP` when -unset; `loader_test` writes small PE images to `%TEMP%\leonida_loader_test`, which antivirus can block (set -`LEONIDA_TEST_DIR` to a folder it skips). +`gta6rt` and the shims are Windows-only, so Linux and macOS configure the portable subset of `runtime/` tests (macOS +CI in `.github/workflows/runtime.yml` is currently disabled). Runtime tests needing the retail package read +`LEONIDA_GAME_DIR` (and `LEONIDA_MOVIE`) in place and print `SKIP` when unset. `loader_test` writes small PE images to +`%TEMP%\leonida_loader_test`, which antivirus can block (exclude it or set `LEONIDA_TEST_DIR` to a folder it skips). -For pytest-based tests (the test files with `import pytest`, or no `__main__` block: they fail to import under -`python -I`), use a virtual environment and install the pinned dependencies in -[`tests/requirements.txt`](tests/requirements.txt). From the repository root, run `python -m pytest` with the -test file you want to check. +For pytest-based tests (files with `import pytest` or no `__main__` block, which fail or run nothing under `python -I`), +install [`tests/requirements.txt`](tests/requirements.txt) in a virtual environment and run from the repository root: ```powershell python -m pip install -r tests/requirements.txt python -m pytest tests/test_user_sgpr_census.py ``` -With a work folder already built, a translator change is checked on a slice before the full run, and the result is -compared with the run before it: +With a work folder already built, check a translator change on a slice before the full run and compare with the run +before it (merge `index.part*.json` into `index.json` with `--merge`; lowering translated or `spirv-val`-valid counts +is a regression): ```powershell python -I tools/rdna2spirv.py /shaders/dxbc/disasm --out --limit 200 python -I tools/rdna2spirv.py /shaders/dxbc/disasm --out --shard 0/8 # one of 8 parallel slices ``` -Shard runs write `index.part*.json`; merge them into `index.json` with `--merge`. Report translated and -`spirv-val`-valid counts before and after; a change that lowers either is a regression. - ## Runtime traps - **No `thread_local` with a destructor in `gta6rt.exe`.** It makes the loader register a thread-exit callback with @@ -190,10 +160,8 @@ Shard runs write `index.part*.json`; merge them into `index.json` with `--merge` `tile_probe.py`, `swizzle_search.py`, `tex_export.py`, `tex_mode_probe.py`, `calibrated_texture.py`, `world_grid_atlas.py`, `tex_headers.py` and `skinned_glb.py` (the last two fall back to the standard library when numpy is absent). -- A text file a tool writes names its line ending - `open(path, "w", encoding="utf-8", newline="\n")` - so the same - input gives the same bytes on every platform; `tests/test_text_write_line_endings.py` catches a writer that forgets. - Keep `make_game.py` working on Windows first: paths through `os.path`, no bash in the build. -- In the pull request, say that it was AI-assisted, which specific models were used (including the separate reviewer - agent), what you tested and on which GPU and driver. -- How agents share results, ask each other for a test on a machine they do not have and say how sure a claim is: +- Follow the shared coding, line-ending and report-path rules in [CONTRIBUTING.md](CONTRIBUTING.md#working-on-the-code), + and the AI-assistance/model disclosure rules in [CONTRIBUTING.md](CONTRIBUTING.md#ai-assisted-contributions). +- For multi-agent coordination (machine profiles, evidence tags and handoff blocks), see [docs/agent_collaboration.md](docs/agent_collaboration.md). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 24b5e41d9a..db7530fe56 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,9 +4,10 @@ Thanks for helping. A few rules keep the project safe to host: - **No game data, ever.** That covers archives, the executable, carved files, shaders (DXBC, FSSM, disassembly, SPIR-V), textures, models, audio, videos, and reports or logs that quote them. `.gitignore` blocks the common - types; check `git status` before you commit anyway. + types; check `git status` and run `python -I scripts/check_no_game_data.py` before committing. - **No keys, decryption or protection workarounds**, and no links to where to get them. The tools only read files that are already plain on disk. +- **Nothing online:** no Xbox Live or Rockstar services or domains. - Short excerpts needed to explain a format (a few header bytes, one instruction sequence) are fine in docs and comments. @@ -21,69 +22,47 @@ list for others. When two pull requests overlap anyway, the one that lands first rebase or close. Pull requests target `main`. The original repository (`ItsNotRexed/Leonida`) went private on 23 November 2026, and its issues and pull requests -went with it. A `#N` in the docs, in a code comment or in a commit message from before that date is an **old** -number and links nowhere now, including the two this page used to send you to: #166 (GPU test results) and #313 -(the D3D12 → Vulkan page). - -- The titles of the issues that were open there are indexed in - [#18](https://github.com/ProjectLeonida/mandy/issues/18). To carry one on, open it again here and link the - index. -- The pull requests that were open there are kept as `old-pr/` branches, listed in - [#17](https://github.com/ProjectLeonida/mandy/issues/17). To carry one on, rebase it on `main`, keep its - author's commits and open a pull request here. -- A GPU test result is a pull request that adds a file to [`gpu-test-results/`](gpu-test-results) in the format of - the files there; [docs/testing.md](docs/testing.md) has how to run the tests. +went with it. A `#N` from before that date is an **old** number and links nowhere now (including old #166 and #313): + +- Old open issues are indexed by title in [#18](https://github.com/ProjectLeonida/mandy/issues/18); open a new issue + here and link the index to carry one on. +- Old open pull requests are kept as `old-pr/` branches in + [#17](https://github.com/ProjectLeonida/mandy/issues/17); rebase on `main`, keep the author's commits and open a + pull request here. +- A GPU test result is a pull request adding a file to [`gpu-test-results/`](gpu-test-results); + [docs/testing.md](docs/testing.md) covers how to run the suite. - The plan and status of the D3D12 → Vulkan layer are in [docs/d3d12_vulkan.md](docs/d3d12_vulkan.md). [claims]: https://github.com/ProjectLeonida/mandy/issues?q=is%3Aissue%20is%3Aopen%20in%3Atitle%20%22Coordinating%20who%20works%20on%20what%22 ## Working on the code -- Fix root causes instead of stacking workarounds, and keep changes simple, clean, modular, maintainable and - performant (see [AGENTS.md](AGENTS.md#engineering-bar)). -- Python tools run with `python -I` and use only the standard library unless a file says otherwise. -- A text file a tool writes (JSON, CSV, a manifest, an assembly listing) names its line ending: `open(path, "w", - encoding="utf-8", newline="\n")` (the same for `Path.open`, `Path.write_text` and a text-mode - `tempfile.NamedTemporaryFile`), so the output is LF on Windows too and the same input gives the same bytes on every - platform. `tests/test_text_write_line_endings.py` fails for a writer that forgets it. -- A report writer refuses an output that names one of its inputs or another output, and asks - `tools/report_paths.same_report_path(a, b)` rather than deriving the answer again: it resolves both paths, - applies the volume's case rules and falls back to `os.path.samefile`, so a new tool reuses one answer - instead of a private copy. `tests/test_report_paths.py` covers it. -- `tools/rpf9dump` needs the submodule: `git submodule update --init`. -- A new shader-translator rule goes into the contract table in `docs/design.md`, with how it was confirmed: a GPU - test, a Mesa/LLVM reference, or a count over the corpus. -- `python -I tests/test_.py` runs one of the unit tests (standard library only; CI runs them all). The test - files with no `__main__` block or an `import pytest` (they need the packages in `tests/requirements.txt`) run with - `python -m pytest tests/test_.py` instead, as [AGENTS.md](AGENTS.md) describes; under `python -I` they fail - to import or run nothing. -- D3D12 runtime tests (Rust workspace in `d3d12/`, currently Windows-only, toolchain pinned in - `d3d12/rust-toolchain.toml`): from `d3d12/`, run `cargo build --workspace --all-targets --locked` and - `cargo test --workspace --exclude xtask --locked` (see `.github/workflows/d3d12.yml`). -- Recompiled runtime tests (`runtime/`): `cmake -S runtime -B runtime/build`, `cmake --build runtime/build --config RelWithDebInfo`, then - `ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure`. The CPU tests that need no game data are configured - on Windows; Linux and macOS configure the portable subset (`gta6rt` and the shims are Windows-only; macOS CI in - `.github/workflows/runtime.yml` is currently disabled). Tests that need the retail package read `LEONIDA_GAME_DIR` (and `LEONIDA_MOVIE` for the Bink - decode test) in place and print `SKIP` when the variable is unset; never copy or commit those files. -- Viewer tests: `node --test tests/test_*.cjs` (Node.js 22+, CI tests 24 LTS; no packages, - browser, network or game data). These execute the viewer streaming and studio code with synthetic fixtures. -- `loader_test` writes small PE images to a `leonida_loader_test` folder in `%TEMP%`. Antivirus that blocks newly - written executables makes it stop with that reason; exclude the folder or set `LEONIDA_TEST_DIR` to one it skips. -- Tool checks: `python -m compileall -q make_game.py tools tests`. The optional - `vk_pipeline_check [cache.bin] [--jobs N]` creates a module (and, for compute shaders, a - pipeline) for every translated shader and reports failures plus the saved cache path. -- GPU tests are small hand-written RDNA2 programs in `runtime/test/shaders`. `build.py` turns them into SPIR-V - using `llvm-mc` with the AMDGPU target (LLVM 21+). `check.py` runs them on your GPU and compares the results. - A new test gets its expected values in the comment at its top and a check in `check.py`. - [docs/testing.md](docs/testing.md) covers setup per OS, including native Windows options, and known problems. -- Say what you tested and on which GPU in the pull request. -- Run the translator tests with `python -I scripts/run_semantic_tests.py tests/semantic` (see `tests/semantic/README.md`). A new - translator rule should come with a small hand-written `.asm` fixture and its expected output words. +- **Engineering bar:** fix root causes instead of stacking workarounds, and keep changes simple, clean, modular, + maintainable and performant (see [AGENTS.md](AGENTS.md#engineering-bar)). +- **Python tools:** run with `python -I` and use only the standard library unless noted in + [AGENTS.md](AGENTS.md#conventions). +- **Deterministic line endings:** every text file a tool writes (JSON, CSV, manifests, assembly listings) must pass + `encoding="utf-8", newline="\n"` (`open`, `Path.open`, `Path.write_text`, text-mode `NamedTemporaryFile`) so Windows + and Unix produce identical bytes. `tests/test_text_write_line_endings.py` enforces this. +- **Report paths:** a report writer refuses an output naming one of its inputs or another output via + `tools/report_paths.same_report_path(a, b)` (`tests/test_report_paths.py`). +- **Submodule:** `tools/rpf9dump` needs `git submodule update --init`. +- **Shader-translator rules:** add every new rule to the contract table in `docs/design.md` with how it was confirmed + (GPU test, Mesa/LLVM reference, or corpus count), plus a small hand-written `.asm` fixture in `tests/semantic/` (see + `tests/semantic/README.md`). +- **Running no-game-files tests:** see [AGENTS.md](AGENTS.md#test-without-the-game-first) for the full command + reference covering Python stdlib (`python -I tests/test_.py`) vs `pytest` (`python -m pytest` for files using + `tests/requirements.txt` or without `__main__`), docs checks, viewer `.cjs` tests, the semantic translator suite, + `rpf9dump`, `runtime/` CMake/CTest, `d3d12/` Cargo, and `launcher/native/`. +- **GPU and pipeline tests:** small hand-written RDNA2 programs in `runtime/test/shaders` (`build.py` with `llvm-mc` + from LLVM 21+, `check.py` on your GPU; see [docs/testing.md](docs/testing.md)). The optional + `vk_pipeline_check [cache.bin] [--jobs N]` builds a module (and compute pipeline) for every translated + shader and reports failures. ## AI-assisted contributions -Read [AGENTS.md](AGENTS.md) before letting an agent edit the repository. When using AI models or coding agents here, -match the model to the work and review its output independently: +Read [AGENTS.md](AGENTS.md) before letting an agent edit the repository. Match the model to the work and review its +output independently: - **New code and reviews:** Claude Opus or Fable; GPT Sol or Astra; Gemini Neon or Carbon. - **Documentation and simple fixes:** at least Claude Sonnet or better, GPT Terra or better, Gemini Hydrogen or better, @@ -91,8 +70,8 @@ match the model to the work and review its output independently: - **Separate reviewer agent:** Always run a separate, read-only reviewer agent (using one of the models listed for new code and reviews above) to independently audit diffs, edge cases, tests and clean-room rules before opening or updating a pull request. -- **Disclosure and verification:** Note in the pull request that the change was AI-assisted, and what specific models were used, along with what you tested - (and on which GPU and driver when GPU tests apply), as described in [AGENTS.md](AGENTS.md). +- **Disclosure and verification:** Note in the pull request that the change was AI-assisted and which specific models + were used (including the reviewer agent), along with what you tested and on which GPU and driver. ## Pull requests @@ -101,7 +80,8 @@ match the model to the work and review its output independently: - Fill in the [template](.github/pull_request_template.md): the claim, `Depends on:`, `Fixes: #N` for an issue it closes, what you tested, `GPUs tested:` (vendor, model, driver and OS) and whether it was AI-assisted. - A pull request that conflicts with `main` is labeled `needs rebase` (`tools/pr_conflict_label.py`, run on every - push to `main` and hourly). Rebase it on `main` yourself; the label goes within the hour once it merges cleanly. Reviews start with the pull requests that do. + push to `main` and hourly). Rebase it on `main` yourself; the label goes within the hour once it merges cleanly. + Reviews start with the pull requests that do. ## Maintainer quick guide diff --git a/docs/README.md b/docs/README.md index 41fda19019..51a8b03d5d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -16,7 +16,6 @@ method, scope and caveats. No game data is included. | [running.md](running.md) | Running the game per platform and GPU (Linux/Wine with AMD, Linux/Proton and Windows with NVIDIA, Windows with AMD, Intel, macOS): build, shaders, pipeline pre-compile, driver settings, environment, what to expect; each value measured by us, reported by others (linked) or TBD. | | [testing.md](testing.md) | Running the GPU tests on your own GPU: setup per OS, wave64 emulation, running without a GPU on Mesa llvmpipe, and known problems. | | [gpu_test_results.md](gpu_test_results.md) | Published GPU test results by hardware, driver and commit, with pass, skip and failure counts. | -| [modding.md](modding.md) | The mod format: `mods//mod.json`, checked and loaded in name order by `gta6rt`; a swap takes effect once the game's archetype lookup is hooked (needs the executable, RT-5). A mod names game models and holds no game data. | | [progress_dashboard.md](progress_dashboard.md) | A local page of what works, what changed since it last passed and what blocks next: unit and runtime tests, the translator contract by confirmation method, measured imports, corpus counts and, with `--github`, CI and the D3D- items (`tools/progress_dashboard.py`). | | [dev-tools.md](dev-tools.md) | The development CLI `scripts/dev.py`: `discover` (text or `--json`, schema version 1) lists the boot-trace analyzer and the guest-scene runner with their help commands and prerequisites, without running them; live attach, pause, step and screenshots are not available through it. | | [agent_collaboration.md](agent_collaboration.md) | How contributors' coding agents work together through GitHub: which machine profile takes which work, the `AGENT-MSG`, `RUN`, `PICTURE` and `TEST-WANTED` blocks (`PICTURE` from `tools/picture_metrics.py`: a frame's luma, dark regions, lattice and block detectors, an 8x8 diff and a defect class, numbers only), and the evidence tags. A convention, not a measurement. | @@ -76,11 +75,7 @@ method, scope and caveats. No game data is included. | [boot.md](boot.md) | The first real boot: the `gta6rt --trace`/`--trace-d3d12` runbook, the startup + D3D12 trace summary (`tools/boot_trace.py`), the triage order and the Q1–Q22 checklist. | | [retail_boot_chain.md](retail_boot_chain.md) | How far `gta6rt --run` gets with the retail executable: the stops in order and what clears each, the physical-page export shapes, device slots 26, 48 and 73, and the device slots the executable calls, counted from the file (`tools/d3d12_device_calls.py`). | | [retail_boot_intel_host.md](retail_boot_intel_host.md) | The retail boot on an Intel host with 16 GB: which stops of the two boot pages hold there with #7111, the commit-limit stop at the 6.1 GiB physical-page request that #7556 clears, the frame loop to the 900 s timeout with stub pipelines, and what the layer refuses at that depth (the console mesh-shader subobject among it). | -| [modding.md](modding.md) | The mod format: a `mods//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). | -| [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. | -| [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. | -| [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. | -| [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. | +| [descriptor_lookup.md](descriptor_lookup.md) | `vk_descriptor_bench` GPU timings at 1k, 10k and 100k live entries across Apple M3 Max, RTX 4070 SUPER (Ada, ReBAR on), RTX 3070 (Ampere, ReBAR off / 214 MiB BAR1) and Intel UHD 770 (Xe-LP). | | [d3d12_xs_surface.md](d3d12_xs_surface.md) | The 116-slot `d3d12_xs.dll` export surface; 83/83 standard GUIDs match the PC SDK. | | [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. | | [d3d12_xs_console_abi.md](d3d12_xs_console_abi.md) | The D3D12.X console ABI the `d3d12_xs` shim must reproduce: device/queue/list vtable slots, command-list object fields and record encodings, root-argument SGPR rules, unified memory; sibling-layer measurements marked unverified here. | @@ -95,14 +90,14 @@ method, scope and caveats. No game data is included. | [directstorage.md](directstorage.md) | Console DirectStorage: the DLL and ABI the title is expected to use (`DStorageGetFactory`, `dstorage_xs`, `XCRDAPI`), how sure that is and the evidence for it, and what `runtime/shims/dstorage.cpp` serves on the PC. The executable's own imports are unmeasured. | | [cpu_features.md](cpu_features.md) | CPU instructions in the executable a desktop CPU may lack (`tools/cpu_feature_scan.py`): 19 SSE4a, 10 CLZERO and 4 MONITORX/MWAITX sites (AMD only) and 8 CLWB sites (Intel since Ice Lake), all real code; `#UD` on hosts without them. | | [xcl_compare.md](xcl_compare.md) | XCL's synthetic test title under `gta6rt --run` and under XCL (`tools/xcl_compare.py`): 5 of 50 checks pass here, both hangs are the documented manual-queue terminate deadlock, and each other difference mapped to an open item or a lead. | -| [gameinput.md](gameinput.md) | The GameInput shim on SDL3: `GameInputCreate` and the v0 `IGameInput`/`IGameInputDevice`/`IGameInputReading`/`IGameInputDispatcher` surface on any SDL gamepad, DualSense adaptive-trigger approximation and lightbar, force-feedback motors and trigger haptics through SDL's haptic API; without SDL3, one scripted pad for `LEONIDA_INPUT_SCRIPT`; 261 checks on virtual joysticks and a fake haptic backend; by hand on an Xbox Series X pad (Bluetooth) and a DualSense (USB). 261 checks on virtual joysticks and a fake haptic backend, not yet tried on a real pad. | +| [gameinput.md](gameinput.md) | The GameInput shim on SDL3: `GameInputCreate` and the v0 `IGameInput`/`IGameInputDevice`/`IGameInputReading`/`IGameInputDispatcher` surface on any SDL gamepad, DualSense adaptive-trigger approximation and lightbar, force-feedback motors and trigger haptics through SDL's haptic API; without SDL3, one scripted pad for `LEONIDA_INPUT_SCRIPT`; 261 checks on virtual joysticks and a fake haptic backend, plus real-hardware runs on an Xbox Series X pad (Bluetooth) and a DualSense (USB). | | [prompt_glyphs.md](prompt_glyphs.md) | The title's one button-prompt movie (a Scaleform GFX of 38 Xbox glyph sprites, `platform_xbsx.input_icons.Main_Button_`): where it is in `data.rpf`, its tags and canvas sizes, which N is which button, which class of the larger movies asks for a glyph and when, the original PlayStation-style replacement `tools/ps_prompt_glyphs.py` builds, the keyboard-and-mouse set `tools/pc_prompt_glyphs.py` draws itself (key caps fitted to the Xbox glyphs' size) or traces from the player's pictures, `tools/prompt_glyph_movies.py`, which builds both for the launcher and make_game.py, how the runtime serves the one for the device in use, and why the glyphs cannot follow a switch of device during play. | | [vi_patch.md](vi_patch.md) | ZiZc3's VI-Patch (game patches for the PS5 build) on the Xbox executable: the title's frame limiter and the 60 fps patch that is always on (RVAs `0x224359a`, `0x1e0fc62`), no vignette behind `LEONIDA_VIPATCH_NO_VIGNETTE=1` (the `spotmeter_aiming` and `spotmeter_fast` exposure profiles), and why the other six are not found or not ported; no licence, so only what each patch does is taken. | | [victory_gap_media.md](victory_gap_media.md) | VIctory's audio, DSP, media, speech and GameInput modules against Leonida, export by export: what was already the same, what `port/gap-media` ported (the XInput/keyboard GameInput shim for builds without SDL3, `#1` registration, silent speech, the local-only Media Foundation resolver) and what is left (Opus decoding, diagnostics aids). | | [victory_gap_gpu.md](victory_gap_gpu.md) | VIctory against Leonida on the console D3D12 surface (`d3d12x`, display, FidelityFX, DirectStorage, the GPU crate): what was the same, what `port/gap-gpu` ported and what is left. | | [victory_gap_system.md](victory_gap_system.md) | VIctory against Leonida in the system modules and the loader (kernel, xmem, files, lifecycle, xsystem, xpackage...): what `port/gap-system` ported, each piece naming its VIctory source. | | [saves.md](saves.md) | Save containers: `JSAV` (index + JSON story save, byte-exact rebuild), `ASAV` header, `SLAYER1` packed copy (not decoded); `tools/saves.py` and import into the offline `XGameSave` folder; key hashes are case-sensitive joaat (`tools/save_keys.py`). | -| [pipeline_check.md](pipeline_check.md) | Driver-level corpus check: the full corpus, 26,503 of 26,503 modules and pipelines, 0 failures (RTX 4060 Ti); an earlier 10/12-shard run, 22,092 modules and 2,217 compute pipelines, also had 0 failures. Driver-level corpus check: 10/12 shards, 22,092 modules, 2,217 compute pipelines, 0 failures. | +| [pipeline_check.md](pipeline_check.md) | Driver-level corpus check: the full corpus, 26,503 of 26,503 modules and pipelines, 0 failures (RTX 4060 Ti); an earlier 10/12-shard run (22,092 modules and 2,217 compute pipelines) also had 0 failures. | | [runtime_ctest_hosts.md](runtime_ctest_hosts.md) | The runtime ctest suite on two hosts, Wine and native Windows 10, on one Pascal card: the 19 failures that are Wine's host, the 5 that reproduce (ours), and the 6 that only fail natively, deterministic, including a SegFault. | | [multi_gpu_validation.md](multi_gpu_validation.md) | Running disjoint shards on eight identical RDNA1/RADV GPUs: PCI-BDF pinning, base controls, per-card logs, the V540 farm's aggregate results and its known driver limitations. | | [shader_validation.md](shader_validation.md) | Differential CPU/GPU validation design and the current CPU interpreter prototype. | @@ -111,7 +106,7 @@ method, scope and caveats. No game data is included. | [buffer_formats.md](buffer_formats.md) | Every GFX10 buffer data format a V# or MTBUF can name, loaded and stored, measured on a Radeon 880M (RDNA3.5, not RDNA2): 1.33 million validated elements, 0 mismatches; SCALED stores convert as NORM, float stores round toward zero. | | [fssm_crosscheck.md](fssm_crosscheck.md) | FSSM/RDNA2 facts cross-checked against SCARAB; code starts at `code_off + 0x28`. | | [fspx.md](fspx.md) | `FSPX`, the FidelityFX DLL's native compute programs (its shaders' `ACCC` part): directory as the DLL reads it, kind-0 dispatch state, the hash prologue, `gfx1030` for its `v_dot4` code; 20 of 29 translate and pass `spirv-val` with `tools/fspx_unpack.py` (the recount after SHADER-813 in fspx.md). | -| [first_light.md](first_light.md) | Draw an exported model's UVs or sample a supplied texture with `--dds`. The UV draw covered 78.1% on an RTX 2060 SUPER (4,213 vertices, 7,968 triangles). The first draw of a real game model with its own translated VS/PS on a GPU: 4,213 vertices / 7,968 triangles, 78.1% coverage on an RTX 2060 SUPER; `tools/first_light.py`, the `vk_harness` mesh mode, and the same draw through the D3D12 layer (`d3d12_first_light`). | +| [first_light.md](first_light.md) | First draw of an exported game model with its own translated VS/PS on a GPU (UV draw or `--dds` texture): 4,213 vertices, 7,968 triangles, 78.1% coverage on an RTX 2060 SUPER; `tools/first_light.py`, `vk_harness` mesh mode, and `d3d12_first_light`. | | [material_pass_replay.md](material_pass_replay.md) | How one authored mesh writes packed draw indices, how six compute programs read the layout, and which sibling passes read the surface material. | | [embedded_shaders.md](embedded_shaders.md) | DXBC containers embedded in the package's DLLs: 52 in `XboxBvhBuilder.dll` (console `FSSM` via the `XDAT`/`XBCH` record; 52/52 pass `spirv-val` today) and 29 `ACCC`/`FSPX` in the FidelityFX upscaler; the scan/extract tool, the rules the programs needed, and the build step and run-time lookup of the builder's programs (`/bvh/index.json`). | | [shader_library.md](shader_library.md) | The pipeline library in `shaders.rpf`'s zlib part, which the carve doesn't read: 25,471 graphics and 2,693 compute pipeline records (stage slots: PS, VS, MS) and 21,522 native programs, 21,509 of them pipeline builds of 6,522 carved shaders (named by their `HASH` digest); `tools/shader_library.py`. | @@ -131,6 +126,7 @@ method, scope and caveats. No game data is included. | [d3d12/docs/switches.md](../d3d12/docs/switches.md) | The `LEONIDA_*` variables the D3D12 runtime names, made from its sources (`tools/d3d12_switches.py`): how each is read, whether `LEONIDA_AB` can turn it, the sentence of the code's comment. | | [launcher.md](launcher.md) | The Leonida Launcher: the desktop window with navigation, a PLAY button, status line and pages; Leonida's own design, no game assets. | | [mod-menu.md](mod-menu.md) | The in-game trainer menu drawn by the D3D12 runtime (`d3d12/`): on by default, `LEONIDA_MENU=0` turns it off; single player only, nothing online. | +| [modding.md](modding.md) | Archetype-swap mod format (`mods//mod.json` next to `gta6rt.exe` or under `--mods DIR`), `tools/leonida_mods.py` manager (`Mods.bat` / `Mods.sh`), load order and start-up log (swaps wait for RT-5). | | [lua-modding.md](lua-modding.md) | Lua 5.4 mods in the D3D12 runtime: a folder in `mods\` with the same `mod.json` the mod manager lists, and a script next to it. | | [ultrawide.md](ultrawide.md) | How the output size goes from the window to the title and back to the screen, and what the opt-in 21:9 and 32:9 settings change; measured versus hypothesis marked. | | [test_inventory.md](test_inventory.md) | The subsystem test map and prerequisite catalog (`tools/test_inventory.py`, DX-10): how test modules across `tests/` and `runtime/test/` are discovered and grouped. | diff --git a/docs/descriptor_lookup.md b/docs/descriptor_lookup.md new file mode 100644 index 0000000000..87f67a2ab6 --- /dev/null +++ b/docs/descriptor_lookup.md @@ -0,0 +1,203 @@ +# Descriptor lookup cost (`vk_descriptor_bench`) + +Synthetic Vulkan compute timings for the eight-probe descriptor hash table +([docs/d3d12_vulkan.md §5.1](d3d12_vulkan.md#51-descriptor-hash-table-details)), measured across four GPUs: Apple M3 +Max, NVIDIA RTX 4070 SUPER (Ada), NVIDIA RTX 3070 (Ampere) and Intel UHD Graphics 770 (Xe-LP). + +## Shared benchmark method + +- **Workload:** 4,096 workgroups of 64 lanes, 64 iterations per lane (16,777,216 logical lane lookups per single-key + dispatch; 33,554,432 per paired T#+S# dispatch, counting texture and sampler separately). Tables hold 90% T# texture + keys and 10% S# sampler keys at 1,000 / 10,000 / 100,000 live entries (capacities 4,096 / 65,536 / 524,288 slots: + 0.156 / 2.50 / 20.0 MiB on desktop NVIDIA; 80 MiB at 100,000 on M3 Max). +- **Query schedule:** At 100,000 entries, ordinary uniform hits covered all 90,000 textures or all 10,000 samplers + (one shared key per workgroup per iteration), while the hot-key control (`uniform_hot_tsharp`) reused one texture. + Divergent misses exhausted the eight-probe search across 1,024 / 16,384 / 131,072 distinct absent keys. Cache + residency and memory traffic were unmeasured. +- **Timing & round order (Apple, Ada, Ampere):** Each cell is the median of 12 process medians, each from 25 timed + dispatches after 5 warmups across the 11 scenarios in fixed order (Vulkan timestamps around one dispatch, 64 valid + bits, 1 ns tick period, validation layers off). Letting A, B, C denote 1k, 10k, 100k, rounds 1–6 ran ABC, CBA, BAC, + CAB, ACB, BCA starting with `device`, `host`, `device`, `device`, `host`, `host` respectively; rounds 7–12 reversed + the order and swapped the starting memory type (with `rebar` third in every round on Ada and Ampere). +- **Windows TDR guard (Ada, Ampere):** Kept the default `--max-dispatch-ms 120` guard. Before each scenario, a + 64-group, 4-iteration probe estimates full dispatch time; if it exceeds 120 ms, iterations are scaled to aim at + 60 ms with 9 timed dispatches after 2 warmups. Shortened cells are marked `*`. +- **Replaying older runs:** The Apple and Ada runs predate `--warmup-ms` (TEST-277, default 300 ms). With a current + build, add `--warmup-ms 0` to match those runs as measured. + +--- + +## Apple M3 Max + +Divergent misses showed the largest change with table size: on GPU-only memory, one million logical lane lookups took +49 µs at 1,000 live descriptors, 156 µs at 10,000 and 479 µs at 100,000; divergent texture hits took 65, 68 and 74 µs. +Measured on one 40-core M3 Max on AC power (macOS 27.3, MoltenVK 1.4.0, 32-lane subgroups, commit `f165a13`, old +D3D-56 PR #639). + +Each cell is **gross** GPU time in **µs per million logical lane lookups** (including key reads and result +accumulation): + +| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss | +|---:|:---|---:|---:|---:|---:|---:| +| 1,000 | GPU-only | 20.8 | 23.2 | 65.0 | 64.0 | 49.3 | +| 1,000 | Host-visible | 20.8 | 23.2 | 65.1 | 64.0 | 49.3 | +| 10,000 | GPU-only | 21.3 | 20.8 | 67.6 | 67.4 | 155.9 | +| 10,000 | Host-visible | 21.3 | 20.8 | 67.7 | 67.4 | 155.8 | +| 100,000 | GPU-only | 20.8 | 20.5 | 73.9 | 74.7 | 479.3 | +| 100,000 | Host-visible | 20.9 | 20.5 | 73.8 | 74.7 | 482.7 | + +- At 100,000 entries on type 0, a divergent T# dispatch took 1.24 ms and a T#+S# dispatch took 2.51 ms. +- Both Vulkan memory types share the 128 GiB unified heap: type 0 is `DEVICE_LOCAL`; type 1 is + `DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT | HOST_CACHED`. At 100,000 entries, the 12 round medians for divergent + misses ranged from 467–525 µs/M on type 0 and 471–505 on type 1. +- Across both memory types and three sizes: 19,800 timed dispatches; a pre-timing dispatch verified 5,042 of 262,144 + lane accumulators against the CPU oracle for each case. + +Replay on macOS (Vulkan headers, CMake, Ninja, MoltenVK; ran without the TDR guard): + +```sh +cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo +cmake --build runtime/build --target vk_descriptor_bench +runtime/build/vk_descriptor_bench --self-test +runtime/build/vk_descriptor_bench --list-devices +for memory in device host; do + runtime/build/vk_descriptor_bench --device 0 --memory "$memory" --sizes 1000,10000,100000 \ + --groups 4096 --iters 64 --warmup 5 --reps 25 --max-dispatch-ms 0 +done +``` + +--- + +## NVIDIA RTX 4070 SUPER (Ada) + +On GPU-only VRAM, divergent misses took 150 µs at 1,000 entries, 657 µs at 10,000 and 998 µs at 100,000; divergent +texture hits took 39.7, 75.0 and 119.0 µs. ReBAR (`DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`) stayed within 0.5% of +GPU-only in every cell. Non-VRAM host-visible memory was within 8% at 1,000 entries, and at 100,000 was 2.5× slower +for divergent misses and 6.0× slower for uniform texture hits. Measured on Windows 11 with NVIDIA driver 621.01 +(commit `dcd8ecf`). + +Each cell is **gross** GPU time in **µs per million logical lane lookups**: + +| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss | +|---:|:---|---:|---:|---:|---:|---:| +| 1,000 | GPU-only | 8.6 | 8.3 | 39.7 | 40.3 | 150.0 | +| 1,000 | Host-visible | 9.2 | 9.0 | 39.9 | 40.4 | 150.6 | +| 1,000 | ReBAR | 8.6 | 8.3 | 39.6 | 40.3 | 149.9 | +| 10,000 | GPU-only | 8.7 | 8.5 | 75.0 | 89.4 | 657.4 | +| 10,000 | Host-visible | 11.5 | 10.1 | 90.0 | 106.3 | 886.8* | +| 10,000 | ReBAR | 8.7 | 8.5 | 75.2 | 89.3 | 658.8 | +| 100,000 | GPU-only | 9.1 | 9.1 | 119.0 | 167.1 | 998.4 | +| 100,000 | Host-visible | 54.4 | 13.9 | 172.4 | 236.6* | 2,460.9* | +| 100,000 | ReBAR | 9.1 | 9.1 | 119.3 | 166.8 | 1,002.1 | + +\* Shortened by `--max-dispatch-ms 120` in 11 or 12 of 12 rounds: 10k `divergent_miss` ran 17–20 iterations (11 +rounds), 100k `divergent_miss` 13–15 (12 rounds), 100k T#+S# pairs 25–31 (11 rounds); shortened medians 0.49–9.84 ms. + +- At 100,000 entries on type 1, a divergent T# dispatch took 2.00 ms and a T#+S# dispatch took 5.61 ms. The hot-key + control measured 7.2 µs/M on all three memory types and sizes. +- Memory types: GPU-only = type 1 (`DEVICE_LOCAL`, heap 0, 11,997 MiB); Host-visible = type 2 + (`HOST_VISIBLE | HOST_COHERENT`, non-cached, heap 1, 16,243 MiB); ReBAR = type 4 + (`DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, heap 0, 16,384 MiB BAR1). +- At 100,000 entries, the 12 GPU-only/ReBAR round medians split into two clusters: the four rounds starting with 10k + (rounds 3, 6, 7, 10) measured 293–299 µs/M (divergent miss) and 59.6–60.2 (divergent T# hit), while the other eight + measured 992–1,015 and 118.7–142.9 (cause unmeasured; table follows the eight). Host-visible divergent misses ranged + 1,870–2,810 µs/M; at 1k/10k, round spread was ≤10% on GPU-only/ReBAR and ≤37% on host-visible. +- 36 processes, 28,948 timed dispatches, all 1,188 rows `timing_status` `ok`. +- **System:** GeForce RTX 4070 SUPER 12,282 MiB (`0x10de:0x2783`, subsys `0x89521043`), PCIe 4.0 x16, ReBAR On + (16,384 MiB BAR1), subgroup size 32, NVIDIA 621.01 (Vulkan 1.4.357), Windows 11 Home 25H2 (26200.9974), Vulkan SDK + 1.4.363.1, VS 2022 Build Tools `RelWithDebInfo`. + +Replay on Windows: + +```powershell +powershell -ExecutionPolicy Bypass -File scripts\build_runtime.ps1 +runtime\build\vk_descriptor_bench.exe --list-devices +runtime\build\vk_descriptor_bench.exe --self-test +foreach ($memory in 'device', 'host', 'rebar') { + runtime\build\vk_descriptor_bench.exe --device 0 --memory $memory --sizes 1000,10000,100000 ` + --groups 4096 --iters 64 --warmup 5 --reps 25 --csv +} +``` + +--- + +## NVIDIA RTX 3070 (Ampere, ReBAR off) + +On this PCIe 3.0 x16 Ampere card with Resizable BAR disabled, host-visible system RAM hit a steep cliff at 100,000 +entries: 5.0× slower for uniform T# hits, 14.2× for divergent T# hits, 21.9× for divergent T#+S# pairs and 22.6× for +divergent misses (compared to 1.45×–2.5× on the Ada PCIe 4.0 + ReBAR card). The 214 MiB BAR1 memory type +(`DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, exposed even with ReBAR off) stayed within 0.5% of GPU-only in every +cell. Measured on an idle Windows 11 desktop with NVIDIA driver 621.24 (commit `5d74c27`, with `--warmup-ms 300`). + +Each cell is **gross** GPU time in **µs per million logical lane lookups**: + +| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss | +|---:|:---|---:|---:|---:|---:|---:| +| 1,000 | GPU-only | 15.0 | 15.1 | 73.0 | 68.2 | 270.3 | +| 1,000 | Host-visible | 16.5 | 16.4 | 71.3 | 69.9 | 267.6 | +| 1,000 | BAR1 (`host_device_local`) | 15.0 | 15.1 | 73.0 | 68.2 | 270.3 | +| 10,000 | GPU-only | 15.5 | 15.0 | 94.3 | 115.9 | 773.3 | +| 10,000 | Host-visible | 16.8 | 17.0 | 104.4 | 134.4 | 880.7* | +| 10,000 | BAR1 (`host_device_local`) | 15.5 | 15.0 | 94.4 | 115.4 | 771.7 | +| 100,000 | GPU-only | 21.7 | 15.7 | 231.9 | 216.6 | 2,502.6 | +| 100,000 | Host-visible | 108.0 | 18.4 | 3,290.5 | 4,734.5 | 56,519.6* | +| 100,000 | BAR1 (`host_device_local`) | 21.7 | 15.8 | 231.8 | 216.7 | 2,499.3 | + +\* Shortened by `--max-dispatch-ms 120` in all 12 rounds: 10k `divergent_miss` ran 13–26 iterations (median 4.38 ms, +range 1.60–6.37 ms); 100k `divergent_miss` ran 19 iterations (median 281.51 ms, range 276.11–285.21 ms); 100k +`latency_divergent` (outside table; gross median 8,135.0 µs/M) ran 26 iterations (median 55.45 ms, range +47.57–56.15 ms). + +- **Net timings** (key-read baseline subtracted) at 100,000 entries: 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/M. +- At 100,000 entries on GPU-only, dispatches took 3.89 ms (divergent T#), 7.27 ms (T#+S#) and 41.99 ms (divergent + miss). The hot-key control measured 12.8–13.1 µs/M gross (5.7–6.8 µs/M net) across all types and sizes. +- Memory types: GPU-only = type 1 (`DEVICE_LOCAL`, heap 0, 8,018 MiB); Host-visible = type 3 + (`HOST_VISIBLE | HOST_COHERENT`, non-cached, heap 1, 16,345 MiB); BAR1 (`--memory rebar`) = type 5 + (`DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, heap 2, 214 MiB; 256 MiB BAR1 aperture, 20.0 MiB table fit). +- At 100,000 entries on GPU-only/BAR1, round medians split deterministically by starting table size: starting at 1k + (rounds 1, 5, 8, 12) gave 167.4–167.9 µs/M (divergent T# hit) and 1,791.5–1,791.9 (divergent miss); starting at 10k + (3, 6, 7, 10) gave 231.8–232.1 and 2,498.4–2,505.4; starting at 100k (2, 4, 9, 11) gave 232.2–232.9 and + 2,581.9–2,591.8 (cause unmeasured; table follows the eight not starting at 1k). +- 36 processes, 29,124 timed dispatches, all 1,188 rows `timing_status` `ok`; overlays disabled via + `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` (idle desktop: 2% GPU, 993 MiB VRAM, P5). +- **System:** GeForce RTX 3070 8,192 MiB (`0x10de:0x2488`, subsys `0x404e1458`), PCIe 3.0 x16 (B450 AORUS M), ReBAR + Off (256 MiB BAR1 / 214 MiB Vulkan heap 2), subgroup size 32, NVIDIA 621.24 (Vulkan 1.4.357), Windows 11 Pro 26H2 + (26300.9974), Vulkan headers 1.4.363.0 (`-DLEONIDA_VULKAN_HEADERS_FETCH=ON`), MSVC 19.51.36260.0 `RelWithDebInfo`. + +Replay on Windows: + +```powershell +runtime\build\vk_descriptor_bench.exe --list-devices +runtime\build\vk_descriptor_bench.exe --self-test +$env:DISABLE_RTSS_LAYER = "1" +$env:DISABLE_VULKAN_OBS_CAPTURE = "1" +foreach ($memory in 'device', 'host', 'rebar') { + runtime\build\vk_descriptor_bench.exe --device 0 --memory $memory --sizes 1000,10000,100000 ` + --groups 4096 --iters 64 --warmup 5 --reps 25 --warmup-ms 300 --csv +} +``` + +--- + +## Intel UHD Graphics 770 (Xe-LP) + +Measured by @kapitche on Windows 11 with Intel driver `101.6129` (subgroup size 32, timestamp period 52.083 ns, +commit `8df277f`, old #313 report; default 25 timed dispatches per case). + +Each cell is **net** GPU time in **µs per million logical lane lookups** (after subtracting the scaled key-read +baseline): + +| Live entries | Placement | Uniform T# hit | Uniform T#+S# pair | Divergent T# hit | Divergent miss | +|---:|:---|---:|---:|---:|---:| +| 1,000 | `device_local` | 263.0 | 300.5 | 1,350 | 6,249 | +| 1,000 | `host_visible` | 263.3 | 300.3 | 1,350 | 6,249 | +| 10,000 | `device_local` | 264.2 | 296.2 | 1,364 | 6,413 | +| 10,000 | `host_visible` | 263.9 | 296.3 | 1,363 | 6,402 | +| 100,000 | `device_local` | 280.5 | 316.0 | 1,483 | 8,263 | +| 100,000 | `host_visible` | 280.9 | 316.5 | 1,481 | 8,217 | + +- Both placements (`device_local` type 0 and `host_visible` type 1 with `DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`) + use shared system RAM and stayed within 0.6% of each other across every size and scenario. +- From 1,000 to 100,000 entries, hit timings rose 5–10% and divergent misses rose 31–32%. diff --git a/docs/descriptor_lookup_ada.md b/docs/descriptor_lookup_ada.md deleted file mode 100644 index c5a6fced3d..0000000000 --- a/docs/descriptor_lookup_ada.md +++ /dev/null @@ -1,70 +0,0 @@ -# Descriptor lookup cost on NVIDIA RTX 4070 SUPER (Ada) - -Divergent misses showed the largest change with table size. On the GPU-only memory type, one million logical lane lookups took 150 µs at 1,000 live descriptors, 657 µs at 10,000 and 998 µs at 100,000. Divergent texture hits took 39.7, 75.0 and 119.0 µs. The ReBAR type (device-local and host-visible) stayed within 0.5% of GPU-only in every cell. Host-visible memory outside VRAM was within 8% of them at 1,000 entries, and at 100,000 it was 2.5× slower for divergent misses and 6.0× slower for uniform texture hits. These are synthetic compute results from one GeForce RTX 4070 SUPER on Windows 11 with NVIDIA driver 621.01. The benchmark ran unchanged at `dcd8ecf`. [D3D-56 benchmark PR #639](https://github.com/ItsNotRexed/Leonida/pull/639) · [Measured revision](https://github.com/ItsNotRexed/Leonida/commit/dcd8ecf10b138566d567020562b7afd853a89024) - -## Measurements - -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. The table uses its gross column. - -| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss | -|---:|:---|---:|---:|---:|---:|---:| -| 1,000 | GPU-only | 8.6 | 8.3 | 39.7 | 40.3 | 150.0 | -| 1,000 | Host-visible | 9.2 | 9.0 | 39.9 | 40.4 | 150.6 | -| 1,000 | ReBAR | 8.6 | 8.3 | 39.6 | 40.3 | 149.9 | -| 10,000 | GPU-only | 8.7 | 8.5 | 75.0 | 89.4 | 657.4 | -| 10,000 | Host-visible | 11.5 | 10.1 | 90.0 | 106.3 | 886.8* | -| 10,000 | ReBAR | 8.7 | 8.5 | 75.2 | 89.3 | 658.8 | -| 100,000 | GPU-only | 9.1 | 9.1 | 119.0 | 167.1 | 998.4 | -| 100,000 | Host-visible | 54.4 | 13.9 | 172.4 | 236.6* | 2,460.9* | -| 100,000 | ReBAR | 9.1 | 9.1 | 119.3 | 166.8 | 1,002.1 | - -\* Shortened by the benchmark's Windows timeout guard in 11 or 12 of the 12 rounds (see Method). - -At 100,000 entries on type 1, a divergent T# dispatch took 2.00 ms and a T#+S# dispatch took 5.61 ms. Each paired iteration resolves two descriptors. - -GPU-only is type 1, `DEVICE_LOCAL`, on heap 0 (11,997 MiB). Host-visible is type 2, `HOST_VISIBLE | HOST_COHERENT` without `HOST_CACHED`, on heap 1 (16,243 MiB, not device-local). ReBAR is type 4, `DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, on heap 0. Every allocation on type 4 succeeded, up to the 20 MiB table. Resizable BAR was enabled: `nvidia-smi` reported a 16,384 MiB BAR1 aperture. On a similar card where the ReBAR type is missing or refuses the allocation, the benchmark skips that placement and the ReBAR rows are absent. - -At 100,000 entries, the 12 round medians for GPU-only and ReBAR split into two groups. The four rounds whose process ran the 10,000-entry table first (rounds 3, 6, 7 and 10) measured 293–299 µs per million for divergent misses and 59.6–60.2 for divergent T# hits. The other eight rounds measured 992–1,015 and 118.7–142.9. The table medians follow the eight. The cause was not measured. Host-visible round medians for divergent misses ranged from 1,870–2,810 µs per million, and the spread did not follow the size order. At 1,000 and 10,000 entries, the round medians for each table cell differed by at most 10% on GPU-only and ReBAR, and by up to 37% on host-visible. - -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 reused one texture and measured 7.2 µs per million on all three types and sizes. Divergent misses visited 1,024, 16,384 and 131,072 distinct absent keys across the three sizes. Those counts describe the query schedule. Cache residency and memory traffic were unmeasured. - -## Method and replay - -Each dispatch used 4,096 groups of 64 lanes and 64 iterations. The RTX 4070 SUPER reported 32-lane subgroups. 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 queue advertised 64 valid bits and a 1 ns tick period. - -Each cell is the median of 12 process medians, each from 25 timed dispatches after five warmups. 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 28,948 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. - -Unlike the [M3 Max run](descriptor_lookup_apple.md), this run kept the benchmark's default `--max-dispatch-ms 120`, so that a slow dispatch cannot reach the Windows 2 s GPU timeout (TDR). Before each scenario, a 64-group, four-iteration probe estimates the full dispatch time. If the estimate exceeds 120 ms, the benchmark lowers the iteration count to aim at 60 ms and uses nine timed dispatches after two warmups. The figure stays per million lookups. Only host-visible cells were shortened. The 10,000-entry divergent miss ran with 17–20 iterations in 11 rounds. At 100,000 entries, divergent misses ran with 13–15 iterations in all 12 rounds, and T#+S# pairs with 25–31 in 11 rounds. The table marks these cells. Shortened dispatches had medians of 0.49–9.84 ms, far below the 120 ms limit. - -From a Leonida checkout on Windows, with Visual Studio 2022 (C++ desktop workload, C++ CMake tools) and the Vulkan SDK installed: - -```powershell -git fetch https://github.com/ItsNotRexed/Leonida.git dcd8ecf10b138566d567020562b7afd853a89024 -git worktree add --detach ..\leonida-ada FETCH_HEAD -cd ..\leonida-ada -powershell -ExecutionPolicy Bypass -File scripts\build_runtime.ps1 -runtime\build\vk_descriptor_bench.exe --list-devices -runtime\build\vk_descriptor_bench.exe --self-test -foreach ($memory in 'device', 'host', 'rebar') { - runtime\build\vk_descriptor_bench.exe --device 0 --memory $memory --sizes 1000,10000,100000 ` - --groups 4096 --iters 64 --warmup 5 --reps 25 --csv -} -``` - -These commands predate `--warmup-ms` (TEST-277, default 300 ms of extra warm-up). With a current build add `--warmup-ms 0` to reproduce them as run. - -Device 0 was the RTX 4070 SUPER, 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 run. 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. Each round ran the other of device and host second, and ReBAR third. - -## System - -| | | -|:---|:---| -| GPU | NVIDIA GeForce RTX 4070 SUPER, 12,282 MiB (discrete) | -| PCI id | `0x10de:0x2783`, subsystem `0x89521043` | -| Link | PCIe 4.0 x16 (maximum reported by `nvidia-smi`) | -| Resizable BAR | On (BAR1 aperture 16,384 MiB, `nvidia-smi -q -d MEMORY`) | -| Subgroup size | 32 | -| Driver | NVIDIA 621.01 (`nvidia-smi`), Vulkan API 1.4.357 | -| OS | Windows 11 Home 25H2, build 26200.9974 | -| Vulkan SDK | 1.4.363.1 (headers for the build) | -| Compiler | Visual Studio 2022 Build Tools, `RelWithDebInfo` via `scripts\build_runtime.ps1` | diff --git a/docs/descriptor_lookup_ampere.md b/docs/descriptor_lookup_ampere.md deleted file mode 100644 index 440d7ec068..0000000000 --- a/docs/descriptor_lookup_ampere.md +++ /dev/null @@ -1,68 +0,0 @@ -# Descriptor lookup cost on NVIDIA RTX 3070 (Ampere) - -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`). - -## Measurements - -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). - -| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss | -|---:|:---|---:|---:|---:|---:|---:| -| 1,000 | GPU-only | 15.0 | 15.1 | 73.0 | 68.2 | 270.3 | -| 1,000 | Host-visible | 16.5 | 16.4 | 71.3 | 69.9 | 267.6 | -| 1,000 | BAR1 (`host_device_local`) | 15.0 | 15.1 | 73.0 | 68.2 | 270.3 | -| 10,000 | GPU-only | 15.5 | 15.0 | 94.3 | 115.9 | 773.3 | -| 10,000 | Host-visible | 16.8 | 17.0 | 104.4 | 134.4 | 880.7* | -| 10,000 | BAR1 (`host_device_local`) | 15.5 | 15.0 | 94.4 | 115.4 | 771.7 | -| 100,000 | GPU-only | 21.7 | 15.7 | 231.9 | 216.6 | 2,502.6 | -| 100,000 | Host-visible | 108.0 | 18.4 | 3,290.5 | 4,734.5 | 56,519.6* | -| 100,000 | BAR1 (`host_device_local`) | 21.7 | 15.8 | 231.8 | 216.7 | 2,499.3 | - -\* Shortened by the benchmark's Windows timeout guard in all 12 rounds (see Method). - -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. - -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. - -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. - -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. - -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. - -## Method and replay - -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. - -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). - -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). - -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`): - -```powershell -runtime\build\vk_descriptor_bench.exe --list-devices -runtime\build\vk_descriptor_bench.exe --self-test -$env:DISABLE_RTSS_LAYER = "1" -$env:DISABLE_VULKAN_OBS_CAPTURE = "1" -foreach ($memory in 'device', 'host', 'rebar') { - runtime\build\vk_descriptor_bench.exe --device 0 --memory $memory --sizes 1000,10000,100000 ` - --groups 4096 --iters 64 --warmup 5 --reps 25 --warmup-ms 300 --csv -} -``` - -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. - -## System - -| | | -|:---|:---| -| GPU | NVIDIA GeForce RTX 3070 (Ampere), 8,192 MiB (discrete) | -| PCI id | `0x10de:0x2488`, subsystem `0x404e1458` | -| Link | PCIe 3.0 x16 (current and maximum reported by `nvidia-smi`; B450 AORUS M) | -| Resizable BAR | Off (BAR1 aperture 256 MiB, `nvidia-smi -q -d MEMORY`; Vulkan heap 2 reports 214 MiB `DEVICE_LOCAL \| HOST_VISIBLE \| HOST_COHERENT`) | -| Subgroup size | 32 | -| Driver | NVIDIA 621.24 (`nvidia-smi`), Vulkan API 1.4.357 | -| OS | Windows 11 Pro 26H2, build 26300.9974 | -| Vulkan headers | 1.4.363.0 (`-DLEONIDA_VULKAN_HEADERS_FETCH=ON`) | -| Compiler | Visual Studio 18 Professional (MSVC 19.51.36260.0), `RelWithDebInfo` via CMake + Ninja | diff --git a/docs/descriptor_lookup_apple.md b/docs/descriptor_lookup_apple.md deleted file mode 100644 index fad071ec68..0000000000 --- a/docs/descriptor_lookup_apple.md +++ /dev/null @@ -1,48 +0,0 @@ -# Descriptor lookup cost on Apple M3 Max - -Divergent misses showed the largest change with table size. On the GPU-only memory type, one million logical lane lookups took 49 µs at 1,000 live descriptors, 156 µs at 10,000 and 479 µs at 100,000. Divergent texture hits took 65, 68 and 74 µs. These are synthetic compute results from one M3 Max on AC power, running macOS 27.3 and MoltenVK 1.4.0. The 40-core GPU ran the benchmark unchanged at `f165a13`. [D3D-56 benchmark PR #639](https://github.com/ItsNotRexed/Leonida/pull/639) · [Measured revision](https://github.com/ItsNotRexed/Leonida/commit/f165a13ff8bc12d2516e399bb87f923553fa107e) - -## Measurements - -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. The table uses its gross column. - -| Live descriptors | Memory type | Uniform T# hit | Uniform S# hit | Divergent T# hit | Divergent T#+S# pair | Divergent miss | -|---:|:---|---:|---:|---:|---:|---:| -| 1,000 | GPU-only | 20.8 | 23.2 | 65.0 | 64.0 | 49.3 | -| 1,000 | Host-visible | 20.8 | 23.2 | 65.1 | 64.0 | 49.3 | -| 10,000 | GPU-only | 21.3 | 20.8 | 67.6 | 67.4 | 155.9 | -| 10,000 | Host-visible | 21.3 | 20.8 | 67.7 | 67.4 | 155.8 | -| 100,000 | GPU-only | 20.8 | 20.5 | 73.9 | 74.7 | 479.3 | -| 100,000 | Host-visible | 20.9 | 20.5 | 73.8 | 74.7 | 482.7 | - -At 100,000 entries on type 0, a divergent T# dispatch took 1.24 ms and a T#+S# dispatch took 2.51 ms. Each paired iteration resolves two descriptors. - -Both Vulkan memory types use the same 128 GiB unified heap. Type 0 is device-local. Type 1 is device-local, host-visible, coherent and cached. At 100,000 entries, the 12 round medians for divergent misses ranged from 467–525 µs per million on type 0 and 471–505 on type 1. - -The tables contain 90% T# texture keys and 10% S# sampler keys. Their allocations were approximately 0.156, 2.50 and 80 MiB. 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 reused one texture. Divergent misses exhausted the eight-probe search and visited 1,024, 16,384 and 131,072 distinct absent keys across the three sizes. Those counts describe the query schedule. Cache residency and memory traffic were unmeasured. - -## Method and replay - -Each dispatch used 4,096 groups of 64 lanes and 64 iterations. The M3 Max reported 32-lane subgroups. 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 queue advertised 64 valid bits and a 1 ns tick period. - -Each cell is the median of 12 process medians, each from 25 timed dispatches after five warmups. The 11 scenarios ran in the benchmark's fixed order. Across both memory types and three sizes there were 19,800 timed dispatches. A separate pre-timing dispatch checked 5,042 of 262,144 lane accumulators against the CPU oracle for each case. The run used the default macOS loader with validation layers off. - -From a Leonida checkout with Vulkan headers, CMake, Ninja and MoltenVK installed: - -```sh -git fetch https://github.com/ItsNotRexed/Leonida.git f165a13ff8bc12d2516e399bb87f923553fa107e -git worktree add --detach ../leonida-639 FETCH_HEAD -cd ../leonida-639 -cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -cmake --build build --target vk_descriptor_bench -build/vk_descriptor_bench --self-test -build/vk_descriptor_bench --list-devices -for memory in device host; do - build/vk_descriptor_bench --device 0 --memory "$memory" --sizes 1000,10000,100000 \ - --groups 4096 --iters 64 --warmup 5 --reps 25 --max-dispatch-ms 0 -done -``` - -These commands predate `--warmup-ms` (TEST-277, default 300 ms of extra warm-up). With a current build add `--warmup-ms 0` to reproduce them as run. - -Device 0 was the M3 Max. For the full 12-round series, let A, B and C denote 1k, 10k and 100k. 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. diff --git a/docs/descriptor_lookup_intel.md b/docs/descriptor_lookup_intel.md deleted file mode 100644 index 3420caf306..0000000000 --- a/docs/descriptor_lookup_intel.md +++ /dev/null @@ -1,39 +0,0 @@ -# Descriptor lookup cost on Intel UHD Graphics 770 - -@kapitche ran the D3D-56 `vk_descriptor_bench` synthetic compute benchmark on an Intel -UHD Graphics 770 (Xe-LP integrated GPU) under Windows 11 with Intel driver `101.6129`. -Vulkan reported a subgroup size of 32 and a timestamp period of 52.083 ns. The run used -`main` at [`8df277f`](https://github.com/ItsNotRexed/Leonida/commit/8df277fb035b384971497f6f9790f7fc4b9ec1d1). -[Original report by @kapitche](https://github.com/ItsNotRexed/Leonida/issues/313#issuecomment-7073751039) - -## Measurements - -The benchmark used its defaults of 4,096 workgroups of 64 invocations, 64 iterations -per invocation and a median of 25 timed dispatches per case. Each dispatch counted -16,777,216 logical lane lookups for single-key cases and 33,554,432 for paired cases, -where each iteration resolves one texture (T#) and one sampler (S#). - -All values are **net µs per million logical lane lookups**, after the benchmark -subtracts the matching key-read baseline scaled to the number of lookups per iteration. -The lookup layout and eight-probe limit are described in -[the Vulkan design, §5.1](d3d12_vulkan.md#51-descriptor-hash-table-details). - -| Live entries | Placement | Uniform T# hit | Uniform T#+S# pair | Divergent T# hit | Divergent miss | -|---:|:---|---:|---:|---:|---:| -| 1,000 | `device_local` | 263.0 | 300.5 | 1,350 | 6,249 | -| 1,000 | `host_visible` | 263.3 | 300.3 | 1,350 | 6,249 | -| 10,000 | `device_local` | 264.2 | 296.2 | 1,364 | 6,413 | -| 10,000 | `host_visible` | 263.9 | 296.3 | 1,363 | 6,402 | -| 100,000 | `device_local` | 280.5 | 316.0 | 1,483 | 8,263 | -| 100,000 | `host_visible` | 280.9 | 316.5 | 1,481 | 8,217 | - -## Interpretation - -For each size and scenario, the two placements differ by less than 0.6% relative -to `device_local`. For this run, Vulkan memory type 0 (`device_local`) and type 1 -(`host_visible`, with `DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`) both used -shared system RAM. The small differences apply to these two memory types on this setup. - -From 1,000 to 100,000 entries, the hit timings rose by about 5–10% across the two -placements, while divergent misses, which exhaust the eight-probe search, rose by -about 31–32%. From 4367afb817422804c2bd670debd59b90c53ed0e5 Mon Sep 17 00:00:00 2001 From: Jan Trencansky Date: Tue, 1 Dec 2026 08:08:00 -0500 Subject: [PATCH 3/3] docs: address review findings in descriptor_lookup and docs/README --- docs/README.md | 2 +- docs/descriptor_lookup.md | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/docs/README.md b/docs/README.md index 51a8b03d5d..289ff89791 100644 --- a/docs/README.md +++ b/docs/README.md @@ -126,7 +126,7 @@ method, scope and caveats. No game data is included. | [d3d12/docs/switches.md](../d3d12/docs/switches.md) | The `LEONIDA_*` variables the D3D12 runtime names, made from its sources (`tools/d3d12_switches.py`): how each is read, whether `LEONIDA_AB` can turn it, the sentence of the code's comment. | | [launcher.md](launcher.md) | The Leonida Launcher: the desktop window with navigation, a PLAY button, status line and pages; Leonida's own design, no game assets. | | [mod-menu.md](mod-menu.md) | The in-game trainer menu drawn by the D3D12 runtime (`d3d12/`): on by default, `LEONIDA_MENU=0` turns it off; single player only, nothing online. | -| [modding.md](modding.md) | Archetype-swap mod format (`mods//mod.json` next to `gta6rt.exe` or under `--mods DIR`), `tools/leonida_mods.py` manager (`Mods.bat` / `Mods.sh`), load order and start-up log (swaps wait for RT-5). | +| [modding.md](modding.md) | Archetype-swap and camera mod format (`mods//mod.json` next to `gta6rt.exe` or under `--mods DIR`), `tools/leonida_mods.py` manager (`Mods.bat` / `Mods.sh`), load order and start-up log (swaps wait for RT-5). | | [lua-modding.md](lua-modding.md) | Lua 5.4 mods in the D3D12 runtime: a folder in `mods\` with the same `mod.json` the mod manager lists, and a script next to it. | | [ultrawide.md](ultrawide.md) | How the output size goes from the window to the title and back to the screen, and what the opt-in 21:9 and 32:9 settings change; measured versus hypothesis marked. | | [test_inventory.md](test_inventory.md) | The subsystem test map and prerequisite catalog (`tools/test_inventory.py`, DX-10): how test modules across `tests/` and `runtime/test/` are discovered and grouped. | diff --git a/docs/descriptor_lookup.md b/docs/descriptor_lookup.md index 87f67a2ab6..f14a6e6bb8 100644 --- a/docs/descriptor_lookup.md +++ b/docs/descriptor_lookup.md @@ -8,8 +8,11 @@ Max, NVIDIA RTX 4070 SUPER (Ada), NVIDIA RTX 3070 (Ampere) and Intel UHD Graphic - **Workload:** 4,096 workgroups of 64 lanes, 64 iterations per lane (16,777,216 logical lane lookups per single-key dispatch; 33,554,432 per paired T#+S# dispatch, counting texture and sampler separately). Tables hold 90% T# texture - keys and 10% S# sampler keys at 1,000 / 10,000 / 100,000 live entries (capacities 4,096 / 65,536 / 524,288 slots: - 0.156 / 2.50 / 20.0 MiB on desktop NVIDIA; 80 MiB at 100,000 on M3 Max). + keys and 10% S# sampler keys at 1,000 / 10,000 / 100,000 live entries. For post-`bc8e604cf` runs (Ada, Ampere, + Intel), capacities were `4,096 / 65,536 / 524,288` slots (`163,844 / 2,621,444 / 20,971,524` bytes = + `0.156 / 2.50 / 20.0 MiB`; `24.4% / 15.3% / 19.1%` load). The M3 Max run (`f165a13`, before bounded slot relocation + `bc8e604cf`) allocated ~`0.156 / 2.50 / 80.0 MiB` (`2,097,152` slots / `83,886,084` bytes / `4.77%` load at + 100,000). - **Query schedule:** At 100,000 entries, ordinary uniform hits covered all 90,000 textures or all 10,000 samplers (one shared key per workgroup per iteration), while the hot-key control (`uniform_hot_tsharp`) reused one texture. Divergent misses exhausted the eight-probe search across 1,024 / 16,384 / 131,072 distinct absent keys. Cache @@ -22,8 +25,9 @@ Max, NVIDIA RTX 4070 SUPER (Ada), NVIDIA RTX 3070 (Ampere) and Intel UHD Graphic - **Windows TDR guard (Ada, Ampere):** Kept the default `--max-dispatch-ms 120` guard. Before each scenario, a 64-group, 4-iteration probe estimates full dispatch time; if it exceeds 120 ms, iterations are scaled to aim at 60 ms with 9 timed dispatches after 2 warmups. Shortened cells are marked `*`. -- **Replaying older runs:** The Apple and Ada runs predate `--warmup-ms` (TEST-277, default 300 ms). With a current - build, add `--warmup-ms 0` to match those runs as measured. +- **Replaying older runs:** The Apple, Ada and Intel runs predate `--warmup-ms` (TEST-277, default 300 ms); only the + Ampere run (`5d74c27`) used `--warmup-ms 300`. With a current build, add `--warmup-ms 0` to match those runs as + measured. --- @@ -155,7 +159,8 @@ range 1.60–6.37 ms); 100k `divergent_miss` ran 19 iterations (median 281.51 ms miss). The hot-key control measured 12.8–13.1 µs/M gross (5.7–6.8 µs/M net) across all types and sizes. - Memory types: GPU-only = type 1 (`DEVICE_LOCAL`, heap 0, 8,018 MiB); Host-visible = type 3 (`HOST_VISIBLE | HOST_COHERENT`, non-cached, heap 1, 16,345 MiB); BAR1 (`--memory rebar`) = type 5 - (`DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, heap 2, 214 MiB; 256 MiB BAR1 aperture, 20.0 MiB table fit). + (`DEVICE_LOCAL | HOST_VISIBLE | HOST_COHERENT`, heap 2, 214 MiB; 256 MiB BAR1 aperture, 227 MiB used / 29 MiB free + at idle, 20.0 MiB table fit). - At 100,000 entries on GPU-only/BAR1, round medians split deterministically by starting table size: starting at 1k (rounds 1, 5, 8, 12) gave 167.4–167.9 µs/M (divergent T# hit) and 1,791.5–1,791.9 (divergent miss); starting at 10k (3, 6, 7, 10) gave 231.8–232.1 and 2,498.4–2,505.4; starting at 100k (2, 4, 9, 11) gave 232.2–232.9 and @@ -163,8 +168,10 @@ range 1.60–6.37 ms); 100k `divergent_miss` ran 19 iterations (median 281.51 ms - 36 processes, 29,124 timed dispatches, all 1,188 rows `timing_status` `ok`; overlays disabled via `DISABLE_RTSS_LAYER=1` and `DISABLE_VULKAN_OBS_CAPTURE=1` (idle desktop: 2% GPU, 993 MiB VRAM, P5). - **System:** GeForce RTX 3070 8,192 MiB (`0x10de:0x2488`, subsys `0x404e1458`), PCIe 3.0 x16 (B450 AORUS M), ReBAR - Off (256 MiB BAR1 / 214 MiB Vulkan heap 2), subgroup size 32, NVIDIA 621.24 (Vulkan 1.4.357), Windows 11 Pro 26H2 - (26300.9974), Vulkan headers 1.4.363.0 (`-DLEONIDA_VULKAN_HEADERS_FETCH=ON`), MSVC 19.51.36260.0 `RelWithDebInfo`. + Off (256 MiB BAR1, 227 MiB used / 29 MiB free at idle; 214 MiB Vulkan heap 2), subgroup size 32, NVIDIA 621.24 + (Vulkan 1.4.357), Windows 11 Pro 26H2 (26300.9974), Windows SDK 10.0.26100+, Vulkan headers 1.4.363.0 + (`-DLEONIDA_VULKAN_HEADERS_FETCH=ON`), Visual Studio 18 Professional (MSVC 19.51.36260.0), `RelWithDebInfo` via + CMake + Ninja. Replay on Windows: