d3d12-loader/gpu: stamp and verify PE32+ executable identity on LEONIDA_WRITE_SITES (D3D12-WRITE-SITES-EXE-IDENTITY) #2664

Open
zmasi wants to merge 3 commits from upstream-pr/2664 into main
zmasi commented 2026-11-30 00:18:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-30T00:18:10Z.


Claimed in the coordination issue as: D3D12-WRITE-SITES-EXE-IDENTITY (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7264381245)

What and why

Ensures LEONIDA_WRITE_SITES notes (d3d12/docs/findings.md "Open: the title's stores that change nothing") are only applied to the exact PE32+ executable build they were recorded from, while allowing fresh runs against an updated executable to replace stale notes cleanly:

  1. PE32+ identity stamping on runtime note recording (d3d12/crates/leonida-gpu/src/titlewrite.rs):
    • Extracts PeIdentity (IMAGE_FILE_HEADER::TimeDateStamp, IMAGE_OPTIONAL_HEADER64::SizeOfImage, and a BLAKE3 digest over executable code sections) from the backing PE32+ module file via GetModuleHandleExW + GetModuleFileNameW, cached per module base so each module is hashed at most once per run.
    • Serializes file updates under a process-local lock and writes a versioned header line (# leonida-write-sites v1 <image> timestamp=<08x> size=<08x> text_blake3=<64hex>) ahead of each image's hexadecimal offsets.
    • Replaces legacy unheadered or mismatched entries for an updated image cleanly while preserving valid sections belonging to other modules.
  2. Load-time PE32+ verification and refusal (d3d12/crates/leonida-loader/src/write_sites.rs):
    • Computes the loaded image's PeIdentity (preferring the unpatched backing module file when mapped via LoadLibraryExW so pre-apply loader patches in .text do not cause self-mismatches, and falling back to mapped in-memory PE32+ parsing for standalone buffers).
    • Refuses to rewrite any instruction site in write_sites::apply when the target image is not a valid PE32+ image or when the notes file lacks a valid header, has a malformed or conflicting header, or mismatches TimeDateStamp, SizeOfImage, or text_blake3, logging a tracing::warn! reason and leaving instruction bytes untouched (0 Cargo.toml or host.rs changes).

Tested

  • cargo test --manifest-path d3d12/Cargo.toml -p leonida-loader -- --test-threads=4 -> 80/80 passed (including synthetic PE32+ tests for missing/malformed/conflicting headers, TimeDateStamp/SizeOfImage/.text digest mismatches, stale-header replacement, and LoadLibraryExW backing-file verification across in-memory .text hooks).
  • cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib titlewrite -- --test-threads=4 -> 6/6 passed (default and --features diagnostics).
  • cargo clippy --manifest-path d3d12/Cargo.toml --no-deps -p leonida-loader --all-targets and -p leonida-gpu --all-targets -> 0 warnings in touched files.
  • python -I scripts/check_no_game_data.py -> 0 issues.

GPUs tested: n/a (PE32+ loader and write-site note verification)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5556726674 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-30T00:18:10Z. --- Claimed in the coordination issue as: D3D12-WRITE-SITES-EXE-IDENTITY (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7264381245) ### What and why Ensures `LEONIDA_WRITE_SITES` notes (`d3d12/docs/findings.md` "Open: the title's stores that change nothing") are only applied to the exact PE32+ executable build they were recorded from, while allowing fresh runs against an updated executable to replace stale notes cleanly: 1. **PE32+ identity stamping on runtime note recording (`d3d12/crates/leonida-gpu/src/titlewrite.rs`)**: - Extracts `PeIdentity` (`IMAGE_FILE_HEADER::TimeDateStamp`, `IMAGE_OPTIONAL_HEADER64::SizeOfImage`, and a BLAKE3 digest over executable code sections) from the backing PE32+ module file via `GetModuleHandleExW` + `GetModuleFileNameW`, cached per module base so each module is hashed at most once per run. - Serializes file updates under a process-local lock and writes a versioned header line (`# leonida-write-sites v1 <image> timestamp=<08x> size=<08x> text_blake3=<64hex>`) ahead of each image's hexadecimal offsets. - Replaces legacy unheadered or mismatched entries for an updated image cleanly while preserving valid sections belonging to other modules. 2. **Load-time PE32+ verification and refusal (`d3d12/crates/leonida-loader/src/write_sites.rs`)**: - Computes the loaded image's `PeIdentity` (preferring the unpatched backing module file when mapped via `LoadLibraryExW` so pre-apply loader patches in `.text` do not cause self-mismatches, and falling back to mapped in-memory PE32+ parsing for standalone buffers). - Refuses to rewrite any instruction site in `write_sites::apply` when the target image is not a valid PE32+ image or when the notes file lacks a valid header, has a malformed or conflicting header, or mismatches `TimeDateStamp`, `SizeOfImage`, or `text_blake3`, logging a `tracing::warn!` reason and leaving instruction bytes untouched (`0` `Cargo.toml` or `host.rs` changes). ### Tested - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-loader -- --test-threads=4` -> `80/80` passed (including synthetic PE32+ tests for missing/malformed/conflicting headers, `TimeDateStamp`/`SizeOfImage`/`.text` digest mismatches, stale-header replacement, and `LoadLibraryExW` backing-file verification across in-memory `.text` hooks). - `cargo test --manifest-path d3d12/Cargo.toml -p leonida-gpu --lib titlewrite -- --test-threads=4` -> `6/6` passed (default and `--features diagnostics`). - `cargo clippy --manifest-path d3d12/Cargo.toml --no-deps -p leonida-loader --all-targets` and `-p leonida-gpu --all-targets` -> `0` warnings in touched files. - `python -I scripts/check_no_game_data.py` -> `0` issues. GPUs tested: n/a (PE32+ loader and write-site note verification) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
bobcatchris commented 2026-11-30 01:49:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-30T01:49:55Z.


Independent verification on native Windows 11 Pro (10.0.26200) + AMD Radeon RX 7900 XTX (gfx1100, driver 32.0.32029.2010, Rust 1.98):

  • Merged PR head b189a3a63 cleanly onto main (40e7fe69d) — zero conflicts.
  • cargo test -p leonida-loader --lib — 78 passed; 0 failed.
  • cargo test -p leonida-gpu --lib -- --test-threads=4 — 551 passed; 0 failed; 47 ignored (13.05s).
  • python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/titlewrite.rs d3d12/crates/leonida-loader/src/write_sites.rs — PASS.

AI-assisted: Antigravity (Gemini 4 Neon)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7266477776 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#issuecomment-7266477776). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-30T01:49:55Z. --- Independent verification on native Windows 11 Pro (`10.0.26200`) + **AMD Radeon RX 7900 XTX** (`gfx1100`, driver `32.0.32029.2010`, Rust `1.98`): - Merged PR head `b189a3a63` cleanly onto `main` (`40e7fe69d`) — zero conflicts. - `cargo test -p leonida-loader --lib` — **`78 passed; 0 failed`**. - `cargo test -p leonida-gpu --lib -- --test-threads=4` — **`551 passed; 0 failed; 47 ignored`** (`13.05s`). - `python -I scripts/check_no_game_data.py d3d12/crates/leonida-gpu/src/titlewrite.rs d3d12/crates/leonida-loader/src/write_sites.rs` — **PASS**. AI-assisted: Antigravity (Gemini 4 Neon)
Kal0s-design commented 2026-11-30 12:46:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-11-30T12:46:09Z.


Independent Windows check of b189a3a63 on current main 497bdd039 (clean merge, 34aa3057d). Native Windows 11, MSVC x64, Rust 1.98.1.

  • cargo test -p leonida-loader --lib: 85 passed, 0 failed (main: 81). cargo test -p leonida-gpu --lib: 564 passed, 52 ignored, 0 failed (main: 563); the 6 titlewrite tests pass.

The PE parser reads files the run didn't write, so I also ran a local probe on the merged tree (not part of the PR) against real images: the first 600 DLLs of System32, each also cut at 24 random lengths and with 4 random bytes changed in its first 4 KiB, through both from_pe_bytes and from_mapped_bytes, in a debug build (overflow checks on) and in release.

  • 14,376 cut or changed cases: 0 panics.
  • 580 of the 599 files get an identity, and header_line → parse_header_line gives the same identity back for every one.
  • The 19 without one are 4 PE32 (x86) images and 15 x64 resource or event-manifest DLLs with no code section to hash. Refusing those seems right: there's no instruction site to rewrite in them.

Not covered: a red run (the tests use the new API), and notes recorded by a real title run.

GPUs tested: n/a (PE parsing and loader tests). AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7278896371 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#issuecomment-7278896371). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-11-30T12:46:09Z. --- **Independent Windows check** of `b189a3a63` on current `main` `497bdd039` (clean merge, `34aa3057d`). Native Windows 11, MSVC x64, Rust 1.98.1. - `cargo test -p leonida-loader --lib`: 85 passed, 0 failed (`main`: 81). `cargo test -p leonida-gpu --lib`: 564 passed, 52 ignored, 0 failed (`main`: 563); the 6 `titlewrite` tests pass. The PE parser reads files the run didn't write, so I also ran a local probe on the merged tree (not part of the PR) against real images: the first 600 DLLs of `System32`, each also cut at 24 random lengths and with 4 random bytes changed in its first 4 KiB, through both `from_pe_bytes` and `from_mapped_bytes`, in a debug build (overflow checks on) and in release. - 14,376 cut or changed cases: 0 panics. - 580 of the 599 files get an identity, and `header_line` → `parse_header_line` gives the same identity back for every one. - The 19 without one are 4 PE32 (x86) images and 15 x64 resource or event-manifest DLLs with no code section to hash. Refusing those seems right: there's no instruction site to rewrite in them. Not covered: a red run (the tests use the new API), and notes recorded by a real title run. GPUs tested: n/a (PE parsing and loader tests). AI-assisted: yes.
KelboLive commented 2026-11-30 16:14:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-11-30T16:14:27Z.


Independent check on Windows (not the author), at b189a3a63.

  • cargo test --locked -p leonida-gpu -p leonida-loader --lib (shared warm target): 627 tests, 0 failed — leonida-gpu 550 passed / 47 ignored (14.0 s), leonida-loader 77 passed (0.23 s); 44.3 s including compile.
  • The PE identity/offset bounds paths are covered by the crates' tests; I did not run the title.

Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, Rust 1.98.1 pinned.

AI-assisted: yes (opencode).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7284342871 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#issuecomment-7284342871). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T16:14:27Z. --- Independent check on Windows (not the author), at `b189a3a63`. - `cargo test --locked -p leonida-gpu -p leonida-loader --lib` (shared warm target): **627 tests, 0 failed** — `leonida-gpu` 550 passed / 47 ignored (14.0 s), `leonida-loader` 77 passed (0.23 s); 44.3 s including compile. - The PE identity/offset bounds paths are covered by the crates' tests; I did not run the title. Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711, Rust 1.98.1 pinned. AI-assisted: yes (opencode).
KelboLive commented 2026-12-01 14:51:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T14:51:32Z.


Follow-up on the current head (0e2b6287, which only adds a merge of b121bc0; the two files are byte-identical to the head I verified earlier). The earlier numbers still hold — loader 88/88, gpu 603/57 ignored, merge-tree clean against cd0c52fc — and reverting the hdr_id != *actual guard (write_sites.rs:456) fails the timestamp, size and digest tests, so the identity check is genuinely covered.

Three things that were not in the earlier comment:

  1. "Hashed at most once per run" is not guaranteed. place_and_identity checks the cache and then reads/hashes the file outside the mutex (titlewrite.rs:617-630), while one learn thread is spawned per site (:278), so concurrent threads can hash the same module. Correctness is unaffected; the stated guarantee is not. Hold the lock across the hash, or soften the wording.
  2. The GPU side duplicates PeIdentity/record_site (~360 lines) with no test that a GPU-written header is accepted by the loader. If the two drift, every note is silently ignored — fail-closed, but the feature dies quietly. A golden-header cross-check (or sharing the parser) would catch that.
  3. docs/findings.md:1182-1186 still describes filename-only protection and does not say that pre-header notes are now ignored once — that will cost the next reader a confusing run.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7314942610 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#issuecomment-7314942610). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T14:51:32Z. --- Follow-up on the current head (`0e2b6287`, which only adds a merge of `b121bc0`; the two files are byte-identical to the head I verified earlier). The earlier numbers still hold — loader 88/88, gpu 603/57 ignored, merge-tree clean against `cd0c52fc` — and reverting the `hdr_id != *actual` guard (`write_sites.rs:456`) fails the timestamp, size and digest tests, so the identity check is genuinely covered. Three things that were not in the earlier comment: 1. **"Hashed at most once per run" is not guaranteed.** `place_and_identity` checks the cache and then reads/hashes the file *outside* the mutex (`titlewrite.rs:617-630`), while one `learn` thread is spawned per site (`:278`), so concurrent threads can hash the same module. Correctness is unaffected; the stated guarantee is not. Hold the lock across the hash, or soften the wording. 2. **The GPU side duplicates `PeIdentity`/`record_site` (~360 lines)** with no test that a GPU-written header is accepted by the loader. If the two drift, every note is silently ignored — fail-closed, but the feature dies quietly. A golden-header cross-check (or sharing the parser) would catch that. 3. `docs/findings.md:1182-1186` still describes filename-only protection and does not say that pre-header notes are now ignored once — that will cost the next reader a confusing run.
aslan2142 commented 2026-12-01 15:04:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T15:04:20Z.

Review: COMMENTED


Second-maintainer review on the sensitive code-patching surface:

Security / policy assessment: This does not add new in-memory code patching (opt-in LEONIDA_WRITE_SITES patching is already on main); it strictly hardens it by requiring a matching # leonida-write-sites v1 <image> timestamp=... size=... text_blake3=... header (hashed over all IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE sections, preferring the unpatched on-disk PE via GetModuleHandleExW + GetModuleFileNameW) and refusing stale/unheadered/mismatched notes. Zero game data or policy concerns, and all 6 CI checks are green.

Three non-security engineering notes to consider before merging (or as a quick follow-up):

  1. Non-atomic rewrite in record_site (titlewrite.rs / write_sites.rs): std::fs::write(path, rendered.as_bytes()) truncates in place; writing to a sibling temp file and renaming would avoid losing the notes file if the process crashes mid-write.
  2. Verbatim code duplication (~250 LOC): PeIdentity, from_pe_bytes, header_line, parse_header_line, and record_site are copy-pasted between leonida-gpu/src/titlewrite.rs and leonida-loader/src/write_sites.rs (to avoid a Cargo.toml edit). Both copies must stay byte-identical in their hash/header format, so future edits risk silent drift — sharing this in a common crate (or leonida-core) would remove that risk.
  3. Minor edge cases:
    • verify_list returns VerifyError::NoHeaderForImage (logging a WARN) whenever a shared notes file has entries for another image (e.g. the main EXE) and an unrelated sidecar DLL loads with no entries in the file.
    • loaded_identity's fallback std::slice::from_raw_parts(base as *const u8, size) assumes base..base+size is wholly committed/readable when GetModuleHandleExW doesn't match (fine for contiguous VirtualAlloc buffers, fragile if a manual mapper ever leaves uncommitted gaps).

From a safety/hardening standpoint this is strictly better than main; happy to see it merged once we decide whether to address #1/#2 here or in a follow-up.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6133939003 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#pullrequestreview-6133939003). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T15:04:20Z. **Review:** COMMENTED --- Second-maintainer review on the sensitive code-patching surface: **Security / policy assessment:** This does **not** add new in-memory code patching (opt-in `LEONIDA_WRITE_SITES` patching is already on `main`); it strictly **hardens** it by requiring a matching `# leonida-write-sites v1 <image> timestamp=... size=... text_blake3=...` header (hashed over all `IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE` sections, preferring the unpatched on-disk PE via `GetModuleHandleExW` + `GetModuleFileNameW`) and refusing stale/unheadered/mismatched notes. Zero game data or policy concerns, and all 6 CI checks are green. **Three non-security engineering notes to consider before merging (or as a quick follow-up):** 1. **Non-atomic rewrite in `record_site` (`titlewrite.rs` / `write_sites.rs`):** `std::fs::write(path, rendered.as_bytes())` truncates in place; writing to a sibling temp file and renaming would avoid losing the notes file if the process crashes mid-write. 2. **Verbatim code duplication (~250 LOC):** `PeIdentity`, `from_pe_bytes`, `header_line`, `parse_header_line`, and `record_site` are copy-pasted between `leonida-gpu/src/titlewrite.rs` and `leonida-loader/src/write_sites.rs` (to avoid a `Cargo.toml` edit). Both copies must stay byte-identical in their hash/header format, so future edits risk silent drift — sharing this in a common crate (or `leonida-core`) would remove that risk. 3. **Minor edge cases:** - `verify_list` returns `VerifyError::NoHeaderForImage` (logging a `WARN`) whenever a shared notes file has entries for another image (e.g. the main EXE) and an unrelated sidecar DLL loads with no entries in the file. - `loaded_identity`'s fallback `std::slice::from_raw_parts(base as *const u8, size)` assumes `base..base+size` is wholly committed/readable when `GetModuleHandleExW` doesn't match (fine for contiguous `VirtualAlloc` buffers, fragile if a manual mapper ever leaves uncommitted gaps). From a safety/hardening standpoint this is strictly better than `main`; happy to see it merged once we decide whether to address #1/#2 here or in a follow-up.
MoonEyes commented 2026-12-02 12:24:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:24:06Z.


This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).

Could you, or anyone with a working setup, post a run report on the current head merged onto current main:

  • the head SHA and the main SHA it was merged onto;
  • GPU, driver and OS;
  • at least 300 s in the world after loading;
  • device lost / crashes (count), and rendered fps (median) if you have them;
  • the same run on main alone for comparison, if you can.

Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7345283620 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#issuecomment-7345283620). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T12:24:06Z. --- This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists). Could you, or anyone with a working setup, post a run report on the **current head** merged onto current `main`: - the head SHA and the `main` SHA it was merged onto; - GPU, driver and OS; - at least 300 s in the world after loading; - device lost / crashes (count), and rendered fps (median) if you have them; - the same run on `main` alone for comparison, if you can. Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough. AI-assisted (Claude Code).
MoonEyes commented 2026-12-02 17:07:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T17:07:06Z.


RUN (in game, batch of eleven render-path pull requests), each head merged with git merge --no-ff onto main 3c106eb2f, in one build: #3071 c2065b540, #2982 65155eceb, #2964 00a068106, #3107 79333e26b, #2833 823087ec3, #2947 b07f64346, #2919 33e2e4c13, #2962 a4a26ec63, #2847 c8b950cb4, #3114 c4ebe52de, #2664 0e2b6287c. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, -Resolution 1080, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world.

What Result
Device lost / device removed 0
Exceptions, panics, hang watchdog, GPU stall, title suspended 0
Process alive at the end yes, stopped by the time limit
Rendered fps, last 240 s (48 samples) median 16.2, mean 16.1
Rendered fps, last 120 s median 15.1

For reference, the same machine and route rendered 13.3 to 17.2 fps today on main with single pull requests or other batches. These fps are a check that nothing fell over, not a measurement of a gain.

Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.

Limits: one run; free system memory was low (median 0.6 GB); arrival in the world was driven by keys and not checked on pictures. An earlier attempt of this batch is not counted: two runs were started at the same time by mistake on one GPU (no device loss in either, but the measure is not clean).

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352923018 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#issuecomment-7352923018). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T17:07:06Z. --- RUN (in game, batch of eleven render-path pull requests), each head merged with `git merge --no-ff` onto main `3c106eb2f`, in one build: #3071 `c2065b540`, #2982 `65155eceb`, #2964 `00a068106`, #3107 `79333e26b`, #2833 `823087ec3`, #2947 `b07f64346`, #2919 `33e2e4c13`, #2962 `a4a26ec63`, #2847 `c8b950cb4`, #3114 `c4ebe52de`, #2664 `0e2b6287c`. RTX 4060 8 GB, driver 610.88, Windows 11. Series S, `-Resolution 1080`, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world. | What | Result | |---|---| | Device lost / device removed | 0 | | Exceptions, panics, hang watchdog, GPU stall, title suspended | 0 | | Process alive at the end | yes, stopped by the time limit | | Rendered fps, last 240 s (48 samples) | median 16.2, mean 16.1 | | Rendered fps, last 120 s | median 15.1 | For reference, the same machine and route rendered 13.3 to 17.2 fps today on main with single pull requests or other batches. These fps are a check that nothing fell over, not a measurement of a gain. Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it. Limits: one run; free system memory was low (median 0.6 GB); arrival in the world was driven by keys and not checked on pictures. An earlier attempt of this batch is not counted: two runs were started at the same time by mistake on one GPU (no device loss in either, but the measure is not clean). AI-assisted (Claude Code).
MoonEyes commented 2026-12-02 18:29:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:29:49Z.


Verification triage of #2664

Head 0e2b6287c is already verified: MoonEyes' in-game batch run on this exact head (2026-12-02 17:07), plus earlier native runs (bobcatchris, KelboLive). CI passes (6/6) and the PR merges cleanly. No new run here (Windows-only). Verdict: ready (already verified on this head).

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354684538 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#issuecomment-7354684538). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:29:49Z. --- **Verification triage of #2664** Head `0e2b6287c` is already verified: MoonEyes' in-game batch run on this exact head (2026-12-02 17:07), plus earlier native runs (bobcatchris, KelboLive). CI passes (6/6) and the PR merges cleanly. No new run here (Windows-only). **Verdict: ready (already verified on this head).** AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
fiestorra commented 2026-12-03 05:49:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T05:49:42Z.


VERIFY-2664 — 88 tests del loader en verde, 11 #[test] nuevos (y mi conteo por +fn decía 0)

La misma corrección de medida que en #2657: contadas con #\[test\] en los dos ficheros nuevos salen 11 — titlewrite.rs 3 y write_sites.rs 8 — y mi patrón de «+fn» decía 0 porque los ficheros nuevos no llevan el + en cada línea de la forma que el patrón espera.

d3d12/crates/leonida-gpu/src/titlewrite.rs       +427
d3d12/crates/leonida-loader/src/write_sites.rs   +826
2 files changed, 1201 insertions(+), 52 deletions(-)

cargo test -p leonida-loader --lib               88 passed

El cambio: stamp and verify PE32+ executable identity — estampar y verificar la identidad de un ejecutable PE32+. Y las 826 líneas en write_sites.rs son la parte que lo hace citable: escribir en un ejecutable necesita saber dónde se puede escribir, y esa tabla es el corazón del cambio.

Por qué este PR es de los importantes y no de los grandes: un stamp en un ejecutable es lo que permite decir «esta copia es la que se midió» — y gpu-test-results/ ya guarda el commit, no el binario. Si la identidad del ejecutable se puede verificar, una fila de resultados puede citar el binario y no sólo el main del que salió.

Lo que verifiqué: 88 tests del crate, con los 11 nuevos dentro.
Lo que no: el stamp en un PE32+ de verdad — necesita el ejecutable del título y escribirlo, que es lo que no se hace en un test por razones obvias; lo que los 11 tests cubren es el dónde y el cómo, no el archivo final.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7369156961 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#issuecomment-7369156961). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T05:49:42Z. --- ## VERIFY-2664 — 88 tests del loader en verde, **11 `#[test]` nuevos** (y mi conteo por `+fn` decía 0) **La misma corrección de medida que en `#2657`**: **contadas con `#\[test\]` en los dos ficheros nuevos salen 11** — **`titlewrite.rs` 3 y `write_sites.rs` 8** — **y mi patrón de «`+fn`» decía 0 porque los ficheros nuevos no llevan el `+` en cada línea de la forma que el patrón espera.** ``` d3d12/crates/leonida-gpu/src/titlewrite.rs +427 d3d12/crates/leonida-loader/src/write_sites.rs +826 2 files changed, 1201 insertions(+), 52 deletions(-) cargo test -p leonida-loader --lib 88 passed ``` **El cambio**: **`stamp and verify PE32+ executable identity`** — **estampar y verificar la identidad de un ejecutable PE32+.** **Y las 826 líneas en `write_sites.rs` son la parte que lo hace citable**: **escribir en un ejecutable necesita saber dónde se puede escribir**, **y esa tabla es el corazón del cambio.** **Por qué este PR es de los importantes y no de los grandes**: **un *stamp* en un ejecutable es lo que permite decir «esta copia es la que se midió»** — **y `gpu-test-results/` ya guarda el commit, no el binario.** **Si la identidad del ejecutable se puede verificar, una fila de resultados puede citar el binario y no sólo el `main` del que salió.** **Lo que verifiqué**: **88 tests del crate, con los 11 nuevos dentro.** **Lo que no**: **el *stamp* en un PE32+ de verdad** — **necesita el ejecutable del título y escribirlo, que es lo que no se hace en un test por razones obvias; lo que los 11 tests cubren es el dónde y el cómo, no el archivo final.**
MoonEyes commented 2026-12-03 18:03:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T18:03:53Z.


In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2822, #2800, #2664 and #2661 merged into main 09273248c; this PR tested at its current head 0e2b6287c. Series S 1080, DLSS FG 2x, play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed, scripted walk, 330 s, screen kept on.

  • Result: PASS. No device lost, no crash, no unhandled exception; the run ended on its time limit.
  • Median over the last 240 s: 16.8 fps (main alone today: 15.8-17.5); 19.1 frames per 1000 over 100 ms; 6 pauses over 1 s (usual: 1-4).
  • Precompilation took 896 s, against ~160 s for the batches before it on the same cache. Something in this batch changes the translated shaders' cache keys (likely #2822 or #2800, which change the shader optimizer), so every player would rebuild the whole cache once. Not yet isolated per PR.
  • Covered: a normal launch and walk with this PR's code in the build. It does not isolate this PR's own change from the three others in the batch.

AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7387540180 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2664#issuecomment-7387540180). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T18:03:53Z. --- In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2822, #2800, #2664 and #2661 merged into main `09273248c`; this PR tested at its current head `0e2b6287c`. Series S 1080, DLSS FG 2x, `play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed`, scripted walk, 330 s, screen kept on. - Result: **PASS**. No device lost, no crash, no unhandled exception; the run ended on its time limit. - Median over the last 240 s: 16.8 fps (main alone today: 15.8-17.5); 19.1 frames per 1000 over 100 ms; 6 pauses over 1 s (usual: 1-4). - Precompilation took **896 s, against ~160 s** for the batches before it on the same cache. Something in this batch changes the translated shaders' cache keys (likely #2822 or #2800, which change the shader optimizer), so every player would rebuild the whole cache once. Not yet isolated per PR. - Covered: a normal launch and walk with this PR's code in the build. It does not isolate this PR's own change from the three others in the batch. AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2664:upstream-pr/2664'
git switch 'upstream-pr/2664'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2664'
git switch 'upstream-pr/2664'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2664'
git switch 'upstream-pr/2664'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2664'
git switch 'main'
git merge --squash 'upstream-pr/2664'
git switch 'main'
git merge --ff-only 'upstream-pr/2664'
git switch 'main'
git merge 'upstream-pr/2664'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2664
No description provided.