d3d12: catch the driver's compiler crashing on a pipeline and carry on #3222

Merged
roanh47 merged 3 commits from upstream-pr/3222 into main 2026-12-03 14:27:24 +00:00
roanh47 commented 2026-12-02 20:37:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by roanh47 on 2026-12-02T20:37:05Z.


Claim

claiming: AMD compiler crash guard on RDNA4 (LEONIDA_COMPILER_GUARD)

What this does

AMD's D3D12 compiler takes an access violation inside CreateGraphicsPipelineState /
CreateComputePipelineState on RDNA4. On the machine this was found on it killed the whole
run, every time:

Leonida: first-chance exception 0xc0000005 at amdxc64.dll+0x861b9f (read 0x8: nothing mapped there)

This adds a guard, ported from the sibling Belobug/VIctory work (GPL-3.0, credited in the module):

  • a vectored exception handler catches the access violation while a worker is compiling,
  • that worker is parked and its pipeline key is written to warm-bad.txt, so later runs skip it,
  • a replacement worker continues, and the run survives.

make_with no longer uses OnceLock::get_or_init: a parked builder would block every other
caller forever. Pipelines are claimed instead (claim() / release_claim()), waiters block on a
condvar until the pipeline is Made, and worker_lost releases a claim with a CAS — no lock the
parked worker might hold is taken.

LEONIDA_COMPILER_GUARD (default on) turns the catching off; the bad-key list is still honoured.

Tested

  • Windows 11, Ryzen 7 7800X3D, 32 GB, Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010.
  • Before: 11 of 11 starts died at amdxc64.dll+0x861b9f, ~6 s in, no window.
  • After: the run survives; a 10+ minute session reached the intro and the world with 0 compiler
    crashes and 47 pipelines blacklisted in warm-bad.txt.
  • cargo test -p leonida-gpu --profile diag --lib pipeline:: — 66 passed, 0 failed.
  • cargo clippy -p leonida-gpu --profile diag --all-targets — clean for guard.rs/make.rs
    (only a pre-existing unused_mut at host.rs:7633).
  • cargo check --profile diag -p leonida --features diagnostics,mimalloc — clean.

Not covered

Direct compiles off the worker path are not guarded and still kill the process: make::now
(BVH builder, off unless LEONIDA_BVH_BUILDER), make::masked_for, the !workers() fallback,
and one-off creations in compose.rs/host.rs. A crash permanently blacklists that pipeline
key; delete the line to retry.

Disclosure

AI-assisted: yes.
Author: DeepSeek V4.1 Flash.
Reviewer: GPT-6.1 Sol (read-only, independent) — 3 findings; the make_with claim race it
raised is fixed in this commit (claim/wait, tests at make.rs:1934+).
Provenance: ported from Belobug/VIctory (GPL-3.0), credited in guard.rs.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5614277349 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222). Originally posted by [roanh47](https://github.com/roanh47) on 2026-12-02T20:37:05Z. --- ## Claim `claiming: AMD compiler crash guard on RDNA4 (LEONIDA_COMPILER_GUARD)` ## What this does AMD's D3D12 compiler takes an access violation inside `CreateGraphicsPipelineState` / `CreateComputePipelineState` on RDNA4. On the machine this was found on it killed the whole run, every time: ``` Leonida: first-chance exception 0xc0000005 at amdxc64.dll+0x861b9f (read 0x8: nothing mapped there) ``` This adds a guard, ported from the sibling Belobug/VIctory work (GPL-3.0, credited in the module): - a vectored exception handler catches the access violation while a worker is compiling, - that worker is parked and its pipeline key is written to `warm-bad.txt`, so later runs skip it, - a replacement worker continues, and the run survives. `make_with` no longer uses `OnceLock::get_or_init`: a parked builder would block every other caller forever. Pipelines are claimed instead (`claim()` / `release_claim()`), waiters block on a condvar until the pipeline is `Made`, and `worker_lost` releases a claim with a CAS — no lock the parked worker might hold is taken. `LEONIDA_COMPILER_GUARD` (default on) turns the catching off; the bad-key list is still honoured. ## Tested - Windows 11, Ryzen 7 7800X3D, 32 GB, Radeon RX 9070 XT (RDNA4), driver `32.0.32029.2010`. - Before: 11 of 11 starts died at `amdxc64.dll+0x861b9f`, ~6 s in, no window. - After: the run survives; a 10+ minute session reached the intro and the world with 0 compiler crashes and 47 pipelines blacklisted in `warm-bad.txt`. - `cargo test -p leonida-gpu --profile diag --lib pipeline::` — 66 passed, 0 failed. - `cargo clippy -p leonida-gpu --profile diag --all-targets` — clean for `guard.rs`/`make.rs` (only a pre-existing `unused_mut` at `host.rs:7633`). - `cargo check --profile diag -p leonida --features diagnostics,mimalloc` — clean. ## Not covered Direct compiles off the worker path are not guarded and still kill the process: `make::now` (BVH builder, off unless `LEONIDA_BVH_BUILDER`), `make::masked_for`, the `!workers()` fallback, and one-off creations in `compose.rs`/`host.rs`. A crash permanently blacklists that pipeline key; delete the line to retry. ## Disclosure AI-assisted: yes. Author: DeepSeek V4.1 Flash. Reviewer: GPT-6.1 Sol (read-only, independent) — 3 findings; the `make_with` claim race it raised is fixed in this commit (claim/wait, tests at `make.rs:1934+`). Provenance: ported from Belobug/VIctory (GPL-3.0), credited in `guard.rs`.
copilot-pull-request-reviewer[bot] commented 2026-12-02 20:37:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-12-02T20:37:19Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6158541296 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#pullrequestreview-6158541296). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-12-02T20:37:19Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level. An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. [Learn about Copilot code review billing](https://docs.github.com/en/copilot/concepts/agents/code-review#code-review-usage).
merzleckeier commented 2026-12-02 20:41:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T20:41:23Z.

Review: COMMENTED


Source review on d59a9d6e. The default-on recovery covers the entire p.make() call (make.rs:1184–1185), including HostPipeline::new and the subsequent timing bookkeeping (make.rs:210–215). guard.rs:173–174 checks the exception kind and accessed address, but does not check whether the fault came from a driver compilation call. An unrelated fault in guarded host code could be attributed to the compiler, and worker_lost then records the pipeline key permanently. Please narrow or verify the recovery boundary around the intended driver calls before persisting a key. Separately, AddVectoredExceptionHandler can return null and its result is currently discarded, so the success log can claim recovery is active when registration failed. This was a defensive source review; I did not trigger a fault or run a workload. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6158616113 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#pullrequestreview-6158616113). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T20:41:23Z. **Review:** COMMENTED --- Source review on `d59a9d6e`. The default-on recovery covers the entire `p.make()` call (`make.rs:1184–1185`), including `HostPipeline::new` and the subsequent timing bookkeeping (`make.rs:210–215`). `guard.rs:173–174` checks the exception kind and accessed address, but does not check whether the fault came from a driver compilation call. An unrelated fault in guarded host code could be attributed to the compiler, and `worker_lost` then records the pipeline key permanently. Please narrow or verify the recovery boundary around the intended driver calls before persisting a key. Separately, `AddVectoredExceptionHandler` can return null and its result is currently discarded, so the success log can claim recovery is active when registration failed. This was a defensive source review; I did not trigger a fault or run a workload. AI-assisted.
fiestorra commented 2026-12-02 21:44:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T21:44:04Z.


VERIFY-3222 — Windows nativo: la suite pasa, el control muerde, y el guardián se limita a lo que dice

Head (this PR)
Merge base b41763227 = current main
Merged onto main — merge-tree clean, git merge --no-ff clean

Ran

cargo test -p leonida-gpu --lib     709 passed; 1 failed; 59 ignored
  pipeline::guard::tests::only_a_first_page_access_violation_inside_a_compile_is_caught ... ok
  pipeline::guard::tests::warm_bad_names_a_crashed_pipeline_once_and_reads_back ... ok
  pipeline::make::tests::a_pipeline_the_compiler_crashed_on_is_not_built_again ... ok
  pipeline::make::tests::a_pipeline_is_built_once_by_two_threads ... ok

The one failure is this machine's, unchanged all day (views_are_made_beside_the_heap_and_copied_in, the iGPU artefact of D3D12CreateDevice(None, ..) that #2995 addresses).

Negative control (synthetic): I made the handler's predicate refuse under a test variable (compiling && code == AV && parameters >= 2 && address < FIRST_TITLE_PAGE), rebuilt and ran → FAILED: only_a_first_page_access_violation_inside_a_compile_is_caught, assertion failed: handles(EXCEPTION_ACCESS_VIOLATION, 2, 0x8, true). The test bites.

What I checked because a vectored exception handler is process-wide: the predicate is narrow on purpose — it only handles an EXCEPTION_ACCESS_VIOLATION while a compile is attached to a slot, with at least two parameters, at an address below FIRST_TITLE_PAGE — and returns EXCEPTION_CONTINUE_SEARCH otherwise, so the title's own faults are not swallowed. The tests pin exactly those boundaries (the name says "only a first page access violation"), and the two make-side ones cover the aftermath: a pipeline the compiler crashed on is not built again, and two threads build it once. That last pair is the part that keeps a driver crash from turning into a compile storm, which is what the nightly logs show for other failures.

What I could not test

  • A real driver compiler crash: that needs the crashing driver; the tests synthesise the fault.
  • The handler under the game: no run; whether a real AV from the compiler arrives with an address below the first title page is exactly what the log would tell, and it is not in this branch.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7359703880 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#issuecomment-7359703880). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T21:44:04Z. --- ## VERIFY-3222 — Windows nativo: la suite pasa, el control muerde, y el guardián se limita a lo que dice | | | |---|---| | Head | `(this PR)` | | Merge base | `b41763227` = current `main` | | Merged onto | `main` — `merge-tree` clean, `git merge --no-ff` clean | **Ran** ``` cargo test -p leonida-gpu --lib 709 passed; 1 failed; 59 ignored pipeline::guard::tests::only_a_first_page_access_violation_inside_a_compile_is_caught ... ok pipeline::guard::tests::warm_bad_names_a_crashed_pipeline_once_and_reads_back ... ok pipeline::make::tests::a_pipeline_the_compiler_crashed_on_is_not_built_again ... ok pipeline::make::tests::a_pipeline_is_built_once_by_two_threads ... ok ``` The one failure is this machine's, unchanged all day (`views_are_made_beside_the_heap_and_copied_in`, the iGPU artefact of `D3D12CreateDevice(None, ..)` that #2995 addresses). **Negative control (synthetic)**: I made the handler's predicate refuse under a test variable (`compiling && code == AV && parameters >= 2 && address < FIRST_TITLE_PAGE`), rebuilt and ran → `FAILED: only_a_first_page_access_violation_inside_a_compile_is_caught`, `assertion failed: handles(EXCEPTION_ACCESS_VIOLATION, 2, 0x8, true)`. **The test bites.** **What I checked because a vectored exception handler is process-wide**: the predicate is **narrow on purpose** — it only handles an `EXCEPTION_ACCESS_VIOLATION` **while a compile is attached to a slot**, **with at least two parameters**, **at an address below `FIRST_TITLE_PAGE`** — and returns `EXCEPTION_CONTINUE_SEARCH` otherwise, so the title's own faults are not swallowed. The tests pin exactly those boundaries (the name says "only a first page access violation"), and the two make-side ones cover the aftermath: **a pipeline the compiler crashed on is not built again**, and **two threads build it once**. That last pair is the part that keeps a driver crash from turning into a compile storm, which is what the nightly logs show for other failures. ## What I could not test - **A real driver compiler crash**: that needs the crashing driver; the tests synthesise the fault. - **The handler under the game**: no run; whether a real AV from the compiler arrives with an address below the first title page is exactly what the log would tell, and it is not in this branch. Written with an AI assistant.
MoonEyes commented 2026-12-02 22:00:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T22:00:12Z.


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:7360085467 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#issuecomment-7360085467). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T22:00:12Z. --- 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).
lixonik commented 2026-12-02 22:41:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-02T22:41:24Z.


RUN (in game, RTX 5070 12 GB, 315 s in-world gate) -- PASS on head d59a9d6e2 (merged cleanly via git merge --no-ff onto main 8877be372).

Build & Unit Checks (Windows 10 x64, RTX 5070 12 GB, driver 595.79)

  • python -I scripts/check_no_game_data.py -> PASS
  • cargo test -p leonida-gpu --lib --locked pipeline:: -- --skip depth_bounds_pipeline_loads_and_filters_draws -> 65 passed, 0 failed, 8 ignored (skipping only the pre-existing Windows 10 depth_bounds test tracked in #2855)
  • cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked -> PASS

Live In-Game Gate (-SeriesS -NoFrameGen, default LEONIDA_COMPILER_GUARD active)

Run Time in world (total) World samples (max draws) Errors / Device lost Median FPS (ms) Slowest / fastest tenth (fps)
PR #3222 (d59a9d6e2 on 8877be372) 315 s (436.6 s) 64 (5,451) 0 / 0 27.8 fps (36.0 ms) 22.6 / 28.4
Matched main (8877be372) 315 s (441.9 s) 63 (4,338) 0 / 0 27.9 fps (35.8 ms) 26.1 / 29.6
  • Telemetry: leonida_gpu::pipeline::guard: the driver's compiler crashing on a worker is caught (LEONIDA_COMPILER_GUARD=0: not) confirmed active in the live log; 0 compiler crashes and 0 regressions on this NVIDIA driver (crash-recovery itself is covered by the pipeline::guard unit tests).

AI-assisted: yes (Antigravity -- Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7361029721 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#issuecomment-7361029721). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-02T22:41:24Z. --- **RUN (in game, RTX 5070 12 GB, 315 s in-world gate) -- PASS** on head `d59a9d6e2` (merged cleanly via `git merge --no-ff` onto `main` `8877be372`). ### Build & Unit Checks (Windows 10 x64, RTX 5070 12 GB, driver 595.79) - `python -I scripts/check_no_game_data.py` -> **PASS** - `cargo test -p leonida-gpu --lib --locked pipeline:: -- --skip depth_bounds_pipeline_loads_and_filters_draws` -> **65 passed, 0 failed, 8 ignored** (skipping only the pre-existing Windows 10 `depth_bounds` test tracked in #2855) - `cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked` -> **PASS** ### Live In-Game Gate (`-SeriesS -NoFrameGen`, default `LEONIDA_COMPILER_GUARD` active) | Run | Time in world (total) | World samples (max draws) | Errors / Device lost | Median FPS (ms) | Slowest / fastest tenth (fps) | | --- | ---: | ---: | ---: | ---: | ---: | | **PR #3222 (`d59a9d6e2` on `8877be372`)** | `315 s` (`436.6 s`) | `64` (`5,451`) | **`0` / `0`** | **`27.8 fps`** (`36.0 ms`) | `22.6` / `28.4` | | **Matched `main` (`8877be372`)** | `315 s` (`441.9 s`) | `63` (`4,338`) | **`0` / `0`** | **`27.9 fps`** (`35.8 ms`) | `26.1` / `29.6` | - **Telemetry:** `leonida_gpu::pipeline::guard: the driver's compiler crashing on a worker is caught (LEONIDA_COMPILER_GUARD=0: not)` confirmed active in the live log; `0` compiler crashes and `0` regressions on this NVIDIA driver (crash-recovery itself is covered by the `pipeline::guard` unit tests). AI-assisted: yes (Antigravity -- Gemini 4 Neon).
MoonEyes commented 2026-12-03 09:01:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T09:01:28Z.


This pull request has a merge conflict with current main (d9b618f10), so it can't be run in game or merged as it is. Could you merge the latest main into it (or rebase onto it) and resolve the conflict? Once the head is updated, the in-game gate run can be done on the new head.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7373066394 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#issuecomment-7373066394). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T09:01:28Z. --- This pull request has a merge conflict with current `main` (`d9b618f10`), so it can't be run in game or merged as it is. Could you merge the latest `main` into it (or rebase onto it) and resolve the conflict? Once the head is updated, the in-game gate run can be done on the new head. AI-assisted (Claude Code).
lixonik commented 2026-12-03 09:21:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T09:21:31Z.


RUN (in game, RTX 5070 12 GB, 315 s in-world gate) -- PASS (updated head 3772d3eae)

  • Head tested: 3772d3eae merged cleanly (git merge --no-ff) onto main (d9b618f10)
  • Preflight & unit tests (Windows 10 x64):
    • python -I scripts/check_no_game_data.py -- PASS
    • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md -- PASS
    • cargo test -p leonida-gpu --lib --locked pipeline:: -- --skip depth_bounds_pipeline_loads_and_filters_draws -- 65 passed, 0 failed, 8 ignored (including pipeline::guard::tests::only_a_first_page_access_violation_inside_a_compile_is_caught, pipeline::guard::tests::warm_bad_names_a_crashed_pipeline_once_and_reads_back, and pipeline::make::tests::a_pipeline_the_compiler_crashed_on_is_not_built_again)
    • cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked -- PASS
  • In-game run (Windows 10, RTX 5070 12 GB, Series S preset, DLSS, no Frame Generation, LEONIDA_COMPILER_GUARD=1, 315 s in world, 448.0 s total, 65 world samples, max 5,530 draws):
    • Runtime errors: 0; device lost: 0
    • Guard active: leonida_gpu::pipeline::guard: the driver's compiler crashing on a worker is caught (LEONIDA_COMPILER_GUARD=0: not) (0 false trips on NVIDIA)
    • Frame rate: median 26.5 fps (37.7 ms; slowest tenth 22.2, fastest tenth 27.6); 3000-4999 draws bucket: 26.6 fps (58 samples)
    • Matched main (d9b618f10) baseline on the same machine/preset: median 27.0 fps (37.1 ms; slowest tenth 20.2, fastest tenth 27.9); 3000-4999 draws bucket: 27.1 fps (55 samples; within single-run noise)
    • Note: this verifies the non-crashing Windows NVIDIA path with the VEH guard active; actual RDNA4 amdxc64.dll compiler-crash recovery cannot be reproduced on NVIDIA hardware.

AI-assisted: yes (Antigravity -- Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7373543620 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#issuecomment-7373543620). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T09:21:31Z. --- RUN (in game, RTX 5070 12 GB, 315 s in-world gate) -- PASS (updated head `3772d3eae`) - Head tested: `3772d3eae` merged cleanly (`git merge --no-ff`) onto `main` (`d9b618f10`) - Preflight & unit tests (Windows 10 x64): - `python -I scripts/check_no_game_data.py` -- PASS - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` -- PASS - `cargo test -p leonida-gpu --lib --locked pipeline:: -- --skip depth_bounds_pipeline_loads_and_filters_draws` -- 65 passed, 0 failed, 8 ignored (including `pipeline::guard::tests::only_a_first_page_access_violation_inside_a_compile_is_caught`, `pipeline::guard::tests::warm_bad_names_a_crashed_pipeline_once_and_reads_back`, and `pipeline::make::tests::a_pipeline_the_compiler_crashed_on_is_not_built_again`) - `cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked` -- PASS - In-game run (Windows 10, RTX 5070 12 GB, Series S preset, DLSS, no Frame Generation, `LEONIDA_COMPILER_GUARD=1`, 315 s in world, 448.0 s total, 65 world samples, max 5,530 draws): - Runtime errors: 0; device lost: 0 - Guard active: `leonida_gpu::pipeline::guard: the driver's compiler crashing on a worker is caught (LEONIDA_COMPILER_GUARD=0: not)` (0 false trips on NVIDIA) - Frame rate: median **26.5 fps** (37.7 ms; slowest tenth 22.2, fastest tenth 27.6); `3000-4999` draws bucket: **26.6 fps** (58 samples) - Matched `main` (`d9b618f10`) baseline on the same machine/preset: median **27.0 fps** (37.1 ms; slowest tenth 20.2, fastest tenth 27.9); `3000-4999` draws bucket: **27.1 fps** (55 samples; within single-run noise) - Note: this verifies the non-crashing Windows NVIDIA path with the VEH guard active; actual RDNA4 `amdxc64.dll` compiler-crash recovery cannot be reproduced on NVIDIA hardware. AI-assisted: yes (Antigravity -- Gemini 4 Neon).
roanh47 commented 2026-12-03 10:00:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by roanh47 on 2026-12-03T10:00:01Z.


Both points are addressed in f5b162c3c.

(a) The fault boundary. The handler now refuses to attribute a fault to the driver's compiler unless the faulting instruction is outside our own image. At start() the guard records the allocation our own code lives in (VirtualQuery on its own handler address — no loader lock), and in the handler it asks VirtualQuery for the allocation of the faulting Rip; if that is our own image, it returns EXCEPTION_CONTINUE_SEARCH, so the fault stays fatal and no pipeline key is written to warm-bad.txt. VirtualQuery is used inside the handler deliberately instead of GetModuleHandleEx/EnumProcessModules, which take the loader lock a faulting thread could hold. The handler still allocates nothing, takes no lock and touches no file.

(b) Registration. AddVectoredExceptionHandler's return is now checked: on null the guard logs a warning ("no vectored exception handler was registered") and does not print the "crashes are caught" line.

Verified in the PR worktree: cargo check --locked --profile diag -p leonida-gpu exit 0, cargo test -p leonida-gpu --profile diag --lib pipeline:: 66 passed / 0 failed, cargo clippy -p leonida-gpu --profile diag --all-targets clean for guard.rs / make.rs.

One limit worth stating: this narrows the boundary to "not our image", which is exactly the mis-attribution you described; it does not prove the call is a driver compile call, because proving that from inside a handler would need a loader query. The compiling flag plus the first-page address test plus the not-our-image test are the three cheap conditions available without a lock.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7374587248 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#issuecomment-7374587248). Originally posted by [roanh47](https://github.com/roanh47) on 2026-12-03T10:00:01Z. --- Both points are addressed in `f5b162c3c`. **(a) The fault boundary.** The handler now refuses to attribute a fault to the driver's compiler unless the faulting instruction is outside our own image. At `start()` the guard records the allocation our own code lives in (`VirtualQuery` on its own handler address — no loader lock), and in the handler it asks `VirtualQuery` for the allocation of the faulting `Rip`; if that is our own image, it returns `EXCEPTION_CONTINUE_SEARCH`, so the fault stays fatal and no pipeline key is written to `warm-bad.txt`. `VirtualQuery` is used inside the handler deliberately instead of `GetModuleHandleEx`/`EnumProcessModules`, which take the loader lock a faulting thread could hold. The handler still allocates nothing, takes no lock and touches no file. **(b) Registration.** `AddVectoredExceptionHandler`'s return is now checked: on null the guard logs a warning ("no vectored exception handler was registered") and does not print the "crashes are caught" line. Verified in the PR worktree: `cargo check --locked --profile diag -p leonida-gpu` exit 0, `cargo test -p leonida-gpu --profile diag --lib pipeline::` 66 passed / 0 failed, `cargo clippy -p leonida-gpu --profile diag --all-targets` clean for `guard.rs` / `make.rs`. One limit worth stating: this narrows the boundary to "not our image", which is exactly the mis-attribution you described; it does not prove the call is a driver compile call, because proving that from inside a handler would need a loader query. The compiling flag plus the first-page address test plus the not-our-image test are the three cheap conditions available without a lock.
lixonik commented 2026-12-03 10:22:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-03T10:22:02Z.


RUN (in game, RTX 5070 12 GB, 315 s in-world gate) -- PASS (updated head f5b162c3c)

  • Head tested: f5b162c3c merged cleanly (git merge --no-ff) onto main (d9b618f10)
  • Preflight & unit tests (Windows 10 x64):
    • python -I scripts/check_no_game_data.py -- PASS
    • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md -- PASS
    • cargo test -p leonida-gpu --lib --locked pipeline:: -- --skip depth_bounds_pipeline_loads_and_filters_draws -- 65 passed, 0 failed, 8 ignored (including the pipeline::guard::tests::* and pipeline::make::tests::a_pipeline_the_compiler_crashed_on_is_not_built_again tests)
    • cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked -- PASS
  • In-game run (Windows 10, RTX 5070 12 GB, Series S preset, DLSS, no Frame Generation, LEONIDA_COMPILER_GUARD=1, 315 s in world, 466.1 s total, 65 world samples, max 5,404 draws):
    • Runtime errors: 0; device lost: 0
    • Guard active: leonida_gpu::pipeline::guard: the driver's compiler crashing on a worker is caught (LEONIDA_COMPILER_GUARD=0: not) (0 false trips on NVIDIA)
    • Frame rate: median 25.4 fps (39.3 ms; slowest tenth 19.7, fastest tenth 26.8); 3000-4999 draws bucket: 25.5 fps (60 samples)
    • Note: this verifies the non-crashing Windows NVIDIA path with the updated fault-boundary VEH guard active; actual RDNA4 amdxc64.dll compiler-crash recovery cannot be reproduced on NVIDIA hardware.

AI-assisted: yes (Antigravity -- Gemini 4 Neon).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7375128457 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#issuecomment-7375128457). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-03T10:22:02Z. --- RUN (in game, RTX 5070 12 GB, 315 s in-world gate) -- PASS (updated head `f5b162c3c`) - Head tested: `f5b162c3c` merged cleanly (`git merge --no-ff`) onto `main` (`d9b618f10`) - Preflight & unit tests (Windows 10 x64): - `python -I scripts/check_no_game_data.py` -- PASS - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` -- PASS - `cargo test -p leonida-gpu --lib --locked pipeline:: -- --skip depth_bounds_pipeline_loads_and_filters_draws` -- 65 passed, 0 failed, 8 ignored (including the `pipeline::guard::tests::*` and `pipeline::make::tests::a_pipeline_the_compiler_crashed_on_is_not_built_again` tests) - `cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked` -- PASS - In-game run (Windows 10, RTX 5070 12 GB, Series S preset, DLSS, no Frame Generation, `LEONIDA_COMPILER_GUARD=1`, 315 s in world, 466.1 s total, 65 world samples, max 5,404 draws): - Runtime errors: 0; device lost: 0 - Guard active: `leonida_gpu::pipeline::guard: the driver's compiler crashing on a worker is caught (LEONIDA_COMPILER_GUARD=0: not)` (0 false trips on NVIDIA) - Frame rate: median **25.4 fps** (39.3 ms; slowest tenth 19.7, fastest tenth 26.8); `3000-4999` draws bucket: **25.5 fps** (60 samples) - Note: this verifies the non-crashing Windows NVIDIA path with the updated fault-boundary VEH guard active; actual RDNA4 `amdxc64.dll` compiler-crash recovery cannot be reproduced on NVIDIA hardware. AI-assisted: yes (Antigravity -- Gemini 4 Neon).
MoonEyes commented 2026-12-03 14:03:01 +00:00 (Migrated from github.com)

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


This was green and already run in game by a third party, but stuck in conflict on the generated switches.md only (its format changed in #3318). I carried it onto current main in #3333, keeping your two commits as they are, so it can merge. If you update this branch first, #3333 gets closed instead. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7380807230 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3222#issuecomment-7380807230). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-03T14:03:01Z. --- This was green and already run in game by a third party, but stuck in conflict on the generated `switches.md` only (its format changed in #3318). I carried it onto current main in #3333, keeping your two commits as they are, so it can merge. If you update this branch first, #3333 gets closed instead. AI-assisted (Claude Code).
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!3222
No description provided.