feat(build): one shader that crashes or hangs the GPU driver costs the preparation that shader, not the whole run #2323

Merged
HumanBean merged 2 commits from TrashPanda/Longshot:feat/prepare-supervisor-continued into main 2026-11-23 16:34:39 +00:00
Contributor

Summary

This continues pull request #1334 by HumanBean. Its shader-preparation supervisor was a second topic that rode in with the trace replay, so it is offered here on its own, on current main. HumanBean's commit is kept under their name, with follow-up fixes on top, and was taken to current main (it applied without a conflict). It was done with AI agents under TrashPanda's direction, and it is offered to HumanBean to take, fold back into #1334 or supersede with their own, as they prefer. The trace replay half is in a second branch, feat/trace-replay-continued.

What it does (HumanBean's description, shortened): the preparation a build runs after it (longshot --prepare-shaders) kept all or nothing, so one shader that crashed or hung the GPU driver lost the whole run. The run now keeps a journal of each driver compile; nx2/prepare_supervisor.py reads it when the run dies, hangs or passes a limit on one entry, identifies the program that was inside the driver, serializing calls on a retry when several programs were active. It quarantines crashed programs for that driver version (cache/longshot_driver_faults.txt), skips timed-out programs for this preparation only, and starts again past them. An incomplete journal stops diagnosis without attributing the run. docs/dev/reference/shader-preparation.md has the whole of it. Read first: nx2/prepare_supervisor.py, gpu/vk/prepare_journal.h, gpu/vk/vk_draw.cpp (the journal entries), docs/dev/reference/shader-preparation.md.

Does it stand alone? Yes: it shares nothing with the trace but rows in gpu/vk/switches.def and the docs index, which merge as they are. The suite, with and without it, differs by its two new checks only.

Testing

Tested on the earlier head: by the agents, Linux, this PC (RTX 4070 Ti): python -I -B tests/run_all.py through suite.py compare against main at 753fb5af: 930 passed, 3 failed, 26 skipped on the branch; 928 passed, 3 failed, 26 skipped on main; no check fails only on the branch; tests/test_prepare_journal.py and tests/test_prepare_supervisor.py are the two new ones and pass. Not run here, and not repeated on this head: a build's preparation in the game, the forced crash and hang HumanBean ran (see Measurements).

Still to test:

  • Linux, RTX or any: a build with RX_VK_TEST_PREPARE_FAULT=crash:5000, then hang:5000, expecting the preparation to finish and the game to log how many programs the driver faulted on (by hand).
  • Windows, through the Builder: the same two builds; the exit status of a crash under the host's crash filter there is not known (by hand, or @Beanstalk on the pull request).
  • An Intel GPU: a normal build, watching for programs left out by the 240 s per-entry limit (HumanBean measured one compile on a UHD at 389 s, which the limit would now leave out) (by hand).

Measurements

Verdict: HumanBean's, from #1334 on an RTX 3090, not repeated on this head: a clean run journalled 259,795 entries; five programs forced to crash were each named over 11 runs and quarantined; a forced hang was stopped at its 20 s limit, and the game then logged 5 programs the driver faulted on in earlier runs are not asked of it and played.

Setup: HumanBean's, RTX 3090, NVIDIA 620.70. Switches it adds, and the default each ships at: LONGSHOT_PREPARE_JOURNAL, LONGSHOT_PREPARE_SKIP, LONGSHOT_PREPARE_FROM and LONGSHOT_PREPARE_ONLY are unset (the journal and the supervisor's help are off in a game run; the supervisor sets the first three for the run it starts, --prepare-shaders the last), and LONGSHOT_PREPARE_ENTRY_S is unset, meaning no limit on one driver call unless --prepare-entry-limit gives one (the supervisor passes 240 s). Nothing was measured by the agents for this branch; the speed of an ordinary preparation is unmeasured (the journal is off unless the supervisor asks for it).

Before: main @ 753fb5af6 After: this PR @ 841e3e3cf (HumanBean's numbers, earlier head)
Programs forced to crash: named and quarantined, run goes on (RTX 3090) the run is lost 5 of 5, over 11 runs
A forced hang the run never ends stopped at its 20 s limit; the game plays

Risks

A slow but finite compile is left out (the 240 s limit; LONGSHOT_PREPARE_ENTRY_S=0 turns it off), and a program can be blamed wrongly; the quarantine file is cache/longshot_driver_faults.txt, safe to delete. The preparation's exit codes 6 and 7 are new. A revert is enough; nothing in a player's saves or options changes.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. Not ticked: the game was not run for this branch; the forced crash and hang are HumanBean's, on the earlier head.
  • mise run test passes (any failure that also fails on main is named): the earlier head had 3 failures that also failed on main; not repeated on this head.
  • Measured against main, or Measurements says why there is nothing to measure. Not ticked: HumanBean's measurement is not repeated here.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Not ticked: built on Linux only.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary This continues pull request #1334 by HumanBean. Its shader-preparation supervisor was a second topic that rode in with the trace replay, so it is offered here on its own, on current `main`. HumanBean's commit is kept under their name, with follow-up fixes on top, and was taken to current `main` (it applied without a conflict). It was done with AI agents under TrashPanda's direction, and it is offered to HumanBean to take, fold back into #1334 or supersede with their own, as they prefer. The trace replay half is in a second branch, `feat/trace-replay-continued`. What it does (HumanBean's description, shortened): the preparation a build runs after it (`longshot --prepare-shaders`) kept all or nothing, so one shader that crashed or hung the GPU driver lost the whole run. The run now keeps a journal of each driver compile; `nx2/prepare_supervisor.py` reads it when the run dies, hangs or passes a limit on one entry, identifies the program that was inside the driver, serializing calls on a retry when several programs were active. It quarantines crashed programs for that driver version (`cache/longshot_driver_faults.txt`), skips timed-out programs for this preparation only, and starts again past them. An incomplete journal stops diagnosis without attributing the run. `docs/dev/reference/shader-preparation.md` has the whole of it. Read first: `nx2/prepare_supervisor.py`, `gpu/vk/prepare_journal.h`, `gpu/vk/vk_draw.cpp` (the journal entries), `docs/dev/reference/shader-preparation.md`. Does it stand alone? Yes: it shares nothing with the trace but rows in `gpu/vk/switches.def` and the docs index, which merge as they are. The suite, with and without it, differs by its two new checks only. ## Testing **Tested on the earlier head:** by the agents, Linux, this PC (RTX 4070 Ti): `python -I -B tests/run_all.py` through `suite.py compare` against `main` at 753fb5af: 930 passed, 3 failed, 26 skipped on the branch; 928 passed, 3 failed, 26 skipped on `main`; no check fails only on the branch; `tests/test_prepare_journal.py` and `tests/test_prepare_supervisor.py` are the two new ones and pass. **Not run here, and not repeated on this head:** a build's preparation in the game, the forced crash and hang HumanBean ran (see Measurements). **Still to test:** - Linux, RTX or any: a build with `RX_VK_TEST_PREPARE_FAULT=crash:5000`, then `hang:5000`, expecting the preparation to finish and the game to log how many programs the driver faulted on (by hand). - Windows, through the Builder: the same two builds; the exit status of a crash under the host's crash filter there is not known (by hand, or `@Beanstalk` on the pull request). - An Intel GPU: a normal build, watching for programs left out by the 240 s per-entry limit (HumanBean measured one compile on a UHD at 389 s, which the limit would now leave out) (by hand). ## Measurements **Verdict:** HumanBean's, from #1334 on an RTX 3090, not repeated on this head: a clean run journalled 259,795 entries; five programs forced to crash were each named over 11 runs and quarantined; a forced hang was stopped at its 20 s limit, and the game then logged `5 programs the driver faulted on in earlier runs are not asked of it` and played. Setup: HumanBean's, RTX 3090, NVIDIA 620.70. Switches it adds, and the default each ships at: `LONGSHOT_PREPARE_JOURNAL`, `LONGSHOT_PREPARE_SKIP`, `LONGSHOT_PREPARE_FROM` and `LONGSHOT_PREPARE_ONLY` are unset (the journal and the supervisor's help are off in a game run; the supervisor sets the first three for the run it starts, `--prepare-shaders` the last), and `LONGSHOT_PREPARE_ENTRY_S` is unset, meaning no limit on one driver call unless `--prepare-entry-limit` gives one (the supervisor passes 240 s). Nothing was measured by the agents for this branch; the speed of an ordinary preparation is unmeasured (the journal is off unless the supervisor asks for it). | | Before: main @ 753fb5af6 | After: this PR @ 841e3e3cf (HumanBean's numbers, earlier head) | |---|---|---| | Programs forced to crash: named and quarantined, run goes on (RTX 3090) | the run is lost | 5 of 5, over 11 runs | | A forced hang | the run never ends | stopped at its 20 s limit; the game plays | ## Risks A slow but finite compile is left out (the 240 s limit; `LONGSHOT_PREPARE_ENTRY_S=0` turns it off), and a program can be blamed wrongly; the quarantine file is `cache/longshot_driver_faults.txt`, safe to delete. The preparation's exit codes 6 and 7 are new. A revert is enough; nothing in a player's saves or options changes. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. Not ticked: the game was not run for this branch; the forced crash and hang are HumanBean's, on the earlier head. - [ ] `mise run test` passes (any failure that also fails on `main` is named): the earlier head had 3 failures that also failed on `main`; not repeated on this head. - [ ] Measured against `main`, or Measurements says why there is nothing to measure. Not ticked: HumanBean's measurement is not repeated here. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Not ticked: built on Linux only. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
feat(build): one shader that crashes or hangs the GPU driver costs the preparation that shader, not the whole run
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
841e3e3cff
The renderer rework plan's track E, step 1. The preparation the Builder runs after a build (longshot
--prepare-shaders) keeps a journal of each call into the driver's compiler; nx2/prepare_supervisor.py reads it when
the run dies, hangs or passes an entry's limit, names the program that was inside the driver (building suspects one
at a time when several were), appends it to longshot_driver_faults.txt for that driver version, and starts again
past it. The game already leaves such a program out. docs/development/shader-preparation.md has the journal, the
arguments, the exit codes and the bounds; RX_VK_TEST_PREPARE_FAULT crashes or hangs a chosen program to test it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8dzCsAL3UdW7ft8ptL9
Member

Possibly related, for context:

  • PR #1386 WIP: feat(build): one shader that crashes or hangs the GPU driver costs the preparation that shader, not the whole run — Earlier stand-alone iteration of same supervisor; closed, superseded into #1334
  • issue #462 Game: shader preparation hard-freezes the whole PC (no TDR, no watchdog) — RX 9070 XT, Windows — AMD driver hard-freeze report directly motivates per-shader quarantine
  • issue #407 Game: up-front shader preparation does not finish on Intel Arc (Windows) with compiles one at a time — Intel preparation stalls; 240-second limit may exclude slow compiles
Possibly related, for context: - PR #1386 WIP: feat(build): one shader that crashes or hangs the GPU driver costs the preparation that shader, not the whole run — Earlier stand-alone iteration of same supervisor; closed, superseded into #1334 - issue #462 Game: shader preparation hard-freezes the whole PC (no TDR, no watchdog) — RX 9070 XT, Windows — AMD driver hard-freeze report directly motivates per-shader quarantine - issue #407 Game: up-front shader preparation does not finish on Intel Arc (Windows) with compiles one at a time — Intel preparation stalls; 240-second limit may exclude slow compiles
TrashPanda force-pushed feat/prepare-supervisor-continued from 841e3e3cff
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 7f0c9fa35b
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-23 15:10:11 +00:00
Compare
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The supervisor can permanently exclude working programs, including a known finite Intel compile and programs merely running beside the actual crash. Its file error handling can also turn an incomplete journal into a false quarantine.

The change journals shader compiler calls and retries preparation after excluding a suspected program. It could let builds recover from driver crashes and hangs, but a mistaken exclusion removes that program's draws during play until the fault list is cleared or the driver changes.

Blocking (3): must change before merging.

  1. L1 nx2/prepare_supervisor.py:43: The default timeout permanently quarantines a shader simply because its compile takes more than 240 seconds. (more on the line) Do: Do not persistently quarantine a program solely for exceeding this unvalidated time limit; use a safe policy for slow finite compiles and test it on the affected hardware.
  2. L2 nx2/prepare_supervisor.py:183: Serializing only the previous suspects does not establish that the one open suspect caused the next crash. (more on the line) Do: Isolate the candidate driver calls from all other calls during diagnosis, or avoid quarantining a candidate until the failing call is unambiguously identified.
  3. L3 gpu/vk/prepare_journal.h:163: Journal write and flush failures are ignored, so the supervisor can mistake a completed call for the call that killed the process. (more on the line) Do: Detect and propagate journal write and flush failures, and disable attribution and persistent quarantine when the journal is incomplete.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4: The recovery path has not been exercised in a game build on this head or on the supported Windows and Linux systems it affects. When: The reported forced-fault results are from an earlier head; Windows crash exit handling and the current integration remain untested. Do: Run normal preparation and forced crash and hang recovery on this head on Windows and Linux, including the Tier 1 GPU systems and Steam Deck affected by the renderer path.
  • L5: The cost of journaling every compiler call during ordinary build preparation is unmeasured. When: Each call now takes the shared journal lock and flushes a begin and end line; the earlier run reported 259,795 entries, but provides no comparable preparation time. Do: Compare clean preparation time and cache size against the base over repeated runs on representative supported hardware. (@fix does its part first: Reduce or batch journal I/O while preserving enough durable information to identify an interrupted call.)

@fix can do L1, L2, L3 and L5.

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven on this head. The PR reports 5 of 5 forced crashes identified over 11 runs and one forced hang stopped on an earlier head with an RTX 3090; the branch itself has not had a game preparation or forced-fault run.

Other systems: The supervisor runs during Builder and development-runtime preparation on Windows and Linux, and its fault list affects subsequent gameplay on the same driver. NVIDIA, AMD, Intel and Steam Deck behavior on this head is not established; the PR also reports an Intel compile that exceeds the new default limit.

Switches: LONGSHOT_PREPARE_JOURNAL, LONGSHOT_PREPARE_SKIP and LONGSHOT_PREPARE_FROM default unset; LONGSHOT_PREPARE_ENTRY_S defaults unset for a direct game run but the supervisor supplies 240 seconds; RX_VK_TEST_PREPARE_FAULT defaults off. The 240-second supervised default is unsafe for the reported 389-second finite compile. All five have switch-table rows.

Reviewed: 7f0c9fa35b against 0e32bc100d: Read AGENTS.md, CONTRIBUTING.md, the PR template, relevant standards, the full supervisor, journal header, argument header, shader-preparation documentation and new tests; inspected the remaining diffs and related renderer, build, cache and fault-list paths. The large existing renderer and build files were read around the changed code and callers, not in full; the full switch table was skimmed. No recorded runs or translations were changed. docs/review-checklist.md was absent.; nothing run (a code review).

Checked and fine:

  • The added switches have table entries.
  • The commit records AI assistance, and the diff does not change the renderer API or generated shaders.
  • The unit tests exercise journal parsing, retry bounds and the fault-list format without game data.

Testing: No commands from the pull request, builds or tests were run, as requested. The supplied CI checks were still running and no head-only failures were reported.

Overlaps and merge order: The PR describes this as extracted from #1334, with a separate trace-replay branch; merge order and current overlap could not be checked without network access.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The supervisor can permanently exclude working programs, including a known finite Intel compile and programs merely running beside the actual crash. Its file error handling can also turn an incomplete journal into a false quarantine. The change journals shader compiler calls and retries preparation after excluding a suspected program. It could let builds recover from driver crashes and hangs, but a mistaken exclusion removes that program's draws during play until the fault list is cleared or the driver changes. **Blocking (3)**: must change before merging. 1. **L1** `nx2/prepare_supervisor.py:43`: The default timeout permanently quarantines a shader simply because its compile takes more than 240 seconds. (more on the line) **Do:** Do not persistently quarantine a program solely for exceeding this unvalidated time limit; use a safe policy for slow finite compiles and test it on the affected hardware. 2. **L2** `nx2/prepare_supervisor.py:183`: Serializing only the previous suspects does not establish that the one open suspect caused the next crash. (more on the line) **Do:** Isolate the candidate driver calls from all other calls during diagnosis, or avoid quarantining a candidate until the failing call is unambiguously identified. 3. **L3** `gpu/vk/prepare_journal.h:163`: Journal write and flush failures are ignored, so the supervisor can mistake a completed call for the call that killed the process. (more on the line) **Do:** Detect and propagate journal write and flush failures, and disable attribution and persistent quarantine when the journal is incomplete. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4**: The recovery path has not been exercised in a game build on this head or on the supported Windows and Linux systems it affects. *When:* The reported forced-fault results are from an earlier head; Windows crash exit handling and the current integration remain untested. **Do:** Run normal preparation and forced crash and hang recovery on this head on Windows and Linux, including the Tier 1 GPU systems and Steam Deck affected by the renderer path. - **L5**: The cost of journaling every compiler call during ordinary build preparation is unmeasured. *When:* Each call now takes the shared journal lock and flushes a begin and end line; the earlier run reported 259,795 entries, but provides no comparable preparation time. **Do:** Compare clean preparation time and cache size against the base over repeated runs on representative supported hardware. *(`@fix` does its part first: Reduce or batch journal I/O while preserving enough durable information to identify an interrupted call.)* `@fix` can do L1, L2, L3 and L5. **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven on this head. The PR reports 5 of 5 forced crashes identified over 11 runs and one forced hang stopped on an earlier head with an RTX 3090; the branch itself has not had a game preparation or forced-fault run. **Other systems:** The supervisor runs during Builder and development-runtime preparation on Windows and Linux, and its fault list affects subsequent gameplay on the same driver. NVIDIA, AMD, Intel and Steam Deck behavior on this head is not established; the PR also reports an Intel compile that exceeds the new default limit. **Switches:** LONGSHOT_PREPARE_JOURNAL, LONGSHOT_PREPARE_SKIP and LONGSHOT_PREPARE_FROM default unset; LONGSHOT_PREPARE_ENTRY_S defaults unset for a direct game run but the supervisor supplies 240 seconds; RX_VK_TEST_PREPARE_FAULT defaults off. The 240-second supervised default is unsafe for the reported 389-second finite compile. All five have switch-table rows. **Reviewed:** 7f0c9fa35bc1 against 0e32bc100dbe: Read AGENTS.md, CONTRIBUTING.md, the PR template, relevant standards, the full supervisor, journal header, argument header, shader-preparation documentation and new tests; inspected the remaining diffs and related renderer, build, cache and fault-list paths. The large existing renderer and build files were read around the changed code and callers, not in full; the full switch table was skimmed. No recorded runs or translations were changed. docs/review-checklist.md was absent.; nothing run (a code review). **Checked and fine:** - The added switches have table entries. - The commit records AI assistance, and the diff does not change the renderer API or generated shaders. - The unit tests exercise journal parsing, retry bounds and the fault-list format without game data. **Testing:** No commands from the pull request, builds or tests were run, as requested. The supplied CI checks were still running and no head-only failures were reported. **Overlaps and merge order:** The PR describes this as extracted from #1334, with a separate trace-replay branch; merge order and current overlap could not be checked without network access. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -0,0 +160,4 @@
};
/// One line, written and handed to the system (the header's durability note). Under mu_
void put(const char* line) {
fwrite(line, 1, strlen(line), f_);
Member

L3 (blocking): Journal write and flush failures are ignored, so the supervisor can mistake a completed call for the call that killed the process.

When: If the disk fills after a begin line is flushed, its end line can be lost. A later unrelated process crash leaves that earlier entry apparently open, and the supervisor writes its working program to the persistent fault list.

Do: Detect and propagate journal write and flush failures, and disable attribution and persistent quarantine when the journal is incomplete.

**L3** (blocking): Journal write and flush failures are ignored, so the supervisor can mistake a completed call for the call that killed the process. *When:* If the disk fills after a begin line is flushed, its end line can be lost. A later unrelated process crash leaves that earlier entry apparently open, and the supervisor writes its working program to the persistent fault list. **Do:** Detect and propagate journal write and flush failures, and disable attribution and persistent quarantine when the journal is incomplete.
@ -0,0 +40,4 @@
# (seconds one driver call gets. Below the run's own 300 s with nothing moving, so that a stuck shader is named before the
# whole run is given up; LONGSHOT_PREPARE_ENTRY_S in the Builder's environment sets another, 0 none)
ENTRY_LIMIT_S = 240
Member

L1 (blocking): The default timeout permanently quarantines a shader simply because its compile takes more than 240 seconds.

When: On the UHD system reported in the PR, a compile that completes in 389 seconds is killed at 240 seconds and its program is added to the driver fault list. Later gameplay skips that program's draws even though the driver would have completed it.

Do: Do not persistently quarantine a program solely for exceeding this unvalidated time limit; use a safe policy for slow finite compiles and test it on the affected hardware.

**L1** (blocking): The default timeout permanently quarantines a shader simply because its compile takes more than 240 seconds. *When:* On the UHD system reported in the PR, a compile that completes in 389 seconds is killed at 240 seconds and its program is added to the driver fault list. Later gameplay skips that program's draws even though the driver would have completed it. **Do:** Do not persistently quarantine a program solely for exceeding this unvalidated time limit; use a safe policy for slow finite compiles and test it on the affected hardware.
@ -0,0 +180,4 @@
narrowed = [k for k in keys if k in self.suspects] or keys
if len(narrowed) > 1: # (several threads were inside the driver: built one at a time, the next death names one)
self.suspects = narrowed
return self._restart()
Member

L2 (blocking): Serializing only the previous suspects does not establish that the one open suspect caused the next crash.

When: After programs A and B are open during a crash, the retry serializes A and B but permits unrelated C to compile concurrently. If C crashes while A is open, the intersection selects A and permanently excludes its draws, while C remains able to crash the next run.

Do: Isolate the candidate driver calls from all other calls during diagnosis, or avoid quarantining a candidate until the failing call is unambiguously identified.

**L2** (blocking): Serializing only the previous suspects does not establish that the one open suspect caused the next crash. *When:* After programs A and B are open during a crash, the retry serializes A and B but permits unrelated C to compile concurrently. If C crashes while A is open, the intersection selects A and permanently excludes its draws, while C remains able to crash the next run. **Do:** Isolate the candidate driver calls from all other calls during diagnosis, or avoid quarantining a candidate until the failing call is unambiguously identified.
Owner
@fix
BeanBot force-pushed feat/prepare-supervisor-continued from 7f0c9fa35b
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to e2911d5b81
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 23s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 33s
CI / Workflow lint (actionlint) (pull_request) Successful in 36s
Third-party parts / As their notes say (pull_request) Successful in 41s
CI / Website build and checks (pull_request) Successful in 6m53s
PR description / Description follows the template (pull_request_target) Failing after 25s
2026-11-23 16:27:33 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The recovery feature has evidence from an earlier head, but it has not been exercised on this head on the Windows and Linux systems it affects. The cost of journaling during ordinary preparation is also unmeasured. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is e2911d5b81. I rebased it onto main (59f9632bef). I edited its description to match the change.

Changed

  • Concurrent diagnosis, gpu/vk/vk_draw.cpp:1860: Serialized all journaled driver calls during diagnosis and stopped attributing a crash by intersecting concurrent entries with prior suspects. Added regression coverage.
  • Keep preparation skips out of driver faults: gpu/vk/vk_draw.cpp:1542 gives supervisor skips a distinct result for module, graphics and compute calls, preventing them from being persisted as driver faults.
  • Detect incomplete preparation journals: gpu/vk/prepare_journal.h:164 detects write and flush errors and marks writes in progress; nx2/prepare_supervisor.py:346 stops attribution when the journal is incomplete. Updated documentation and checks. Tests were not run, as requested.

Not done

  • Journal I/O cost: Journal writes remain unbatched. A batching design must preserve reliable attribution across concurrent calls and write failures; the author must also measure preparation cost on representative hardware.

Nothing was built or run: the checks run again on the new head.

The supervisor attempts to preserve shader preparation after a driver crash or hang by identifying and skipping the offending program. It adds journal I/O to every supervised compiler call and serializes calls during diagnosis.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4: The recovery path has not been exercised in a game build on this head or on the supported Windows and Linux systems it affects. When: The reported forced-fault results are from an earlier head; Windows crash exit handling and the current integration remain untested. Do: Run normal preparation and forced crash and hang recovery on this head on Windows and Linux, including the Tier 1 GPU systems and Steam Deck affected by the renderer path.
  • L5: The cost of journaling every compiler call during ordinary build preparation is unmeasured. When: Each call now takes the shared journal lock and flushes a begin and end line; the earlier run reported 259,795 entries, but provides no comparable preparation time. Do: Compare clean preparation time and cache size against the base over repeated runs on representative supported hardware.

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (2; not asked for, not blocking)
  • The specified base-to-HEAD diff includes many merged changes beyond the shader preparation files listed in the description.
  • The supplied base diff includes many changes beyond the shader-preparation files listed in the pull request.
More: does it help, other systems, switches, what was read

Does it help: Unproven on this head. On an earlier head, the author reported five forced crashes identified over 11 runs and one forced hang stopped; ordinary preparation cost was not measured.

Other systems: The change affects shader preparation on Windows and Linux across GPU drivers. Windows crash handling, Intel's slow compiles, and ordinary preparation time still need validation; the documented 240-second limit can skip a finite compile.

Switches: LONGSHOT_PREPARE_JOURNAL, LONGSHOT_PREPARE_SKIP, LONGSHOT_PREPARE_FROM and LONGSHOT_PREPARE_ONLY default to unset; the supervisor supplies the first three as needed and preparation supplies the last. LONGSHOT_PREPARE_ENTRY_S defaults to unset, with a 240-second supervisor default; its suitability on slow hardware remains unverified. RX_VK_TEST_PREPARE_FAULT defaults to unset and is for testing.

Reviewed: e2911d5b81 against 59f9632bef: Read AGENTS.md, CONTRIBUTING.md, the pull request template, gpu/vk/prepare_journal.h and nx2/prepare_supervisor.py in full. Inspected the fix diff, relevant vk_draw.cpp and make_game.py paths, and the commit list; the remaining changed files and the full base diff were not read in full.; nothing run (a code review).

Checked and fine:

  • The fix retains the supervisor and journal, serializes journaled calls during diagnosis, and keeps timed-out programs out of the persistent driver-fault list.
  • A journal write error, pending marker or incomplete final line stops attribution.

Testing: No code or tests were run. CI has not yet run on this head; the reported suite and driver runs are from earlier heads.

Overlaps and merge order: The description identifies #1334 as the source of this work; its intended relationship and merge order need maintainer coordination.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The recovery feature has evidence from an earlier head, but it has not been exercised on this head on the Windows and Linux systems it affects. The cost of journaling during ordinary preparation is also unmeasured. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is e2911d5b810b. I rebased it onto `main` (59f9632befed). I edited its description to match the change. **Changed** - **Concurrent diagnosis, gpu/vk/vk_draw.cpp:1860**: Serialized all journaled driver calls during diagnosis and stopped attributing a crash by intersecting concurrent entries with prior suspects. Added regression coverage. - **Keep preparation skips out of driver faults**: gpu/vk/vk_draw.cpp:1542 gives supervisor skips a distinct result for module, graphics and compute calls, preventing them from being persisted as driver faults. - **Detect incomplete preparation journals**: gpu/vk/prepare_journal.h:164 detects write and flush errors and marks writes in progress; nx2/prepare_supervisor.py:346 stops attribution when the journal is incomplete. Updated documentation and checks. Tests were not run, as requested. **Not done** - **Journal I/O cost**: Journal writes remain unbatched. A batching design must preserve reliable attribution across concurrent calls and write failures; the author must also measure preparation cost on representative hardware. Nothing was built or run: the checks run again on the new head. The supervisor attempts to preserve shader preparation after a driver crash or hang by identifying and skipping the offending program. It adds journal I/O to every supervised compiler call and serializes calls during diagnosis. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4**: The recovery path has not been exercised in a game build on this head or on the supported Windows and Linux systems it affects. *When:* The reported forced-fault results are from an earlier head; Windows crash exit handling and the current integration remain untested. **Do:** Run normal preparation and forced crash and hang recovery on this head on Windows and Linux, including the Tier 1 GPU systems and Steam Deck affected by the renderer path. - **L5**: The cost of journaling every compiler call during ordinary build preparation is unmeasured. *When:* Each call now takes the shared journal lock and flushes a begin and end line; the earlier run reported 259,795 entries, but provides no comparable preparation time. **Do:** Compare clean preparation time and cache size against the base over repeated runs on representative supported hardware. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (2; not asked for, not blocking)</summary> - The specified base-to-HEAD diff includes many merged changes beyond the shader preparation files listed in the description. - The supplied base diff includes many changes beyond the shader-preparation files listed in the pull request. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven on this head. On an earlier head, the author reported five forced crashes identified over 11 runs and one forced hang stopped; ordinary preparation cost was not measured. **Other systems:** The change affects shader preparation on Windows and Linux across GPU drivers. Windows crash handling, Intel's slow compiles, and ordinary preparation time still need validation; the documented 240-second limit can skip a finite compile. **Switches:** LONGSHOT_PREPARE_JOURNAL, LONGSHOT_PREPARE_SKIP, LONGSHOT_PREPARE_FROM and LONGSHOT_PREPARE_ONLY default to unset; the supervisor supplies the first three as needed and preparation supplies the last. LONGSHOT_PREPARE_ENTRY_S defaults to unset, with a 240-second supervisor default; its suitability on slow hardware remains unverified. RX_VK_TEST_PREPARE_FAULT defaults to unset and is for testing. **Reviewed:** e2911d5b810b against 59f9632befed: Read AGENTS.md, CONTRIBUTING.md, the pull request template, gpu/vk/prepare_journal.h and nx2/prepare_supervisor.py in full. Inspected the fix diff, relevant vk_draw.cpp and make_game.py paths, and the commit list; the remaining changed files and the full base diff were not read in full.; nothing run (a code review). **Checked and fine:** - The fix retains the supervisor and journal, serializes journaled calls during diagnosis, and keeps timed-out programs out of the persistent driver-fault list. - A journal write error, pending marker or incomplete final line stops attribution. **Testing:** No code or tests were run. CI has not yet run on this head; the reported suite and driver runs are from earlier heads. **Overlaps and merge order:** The description identifies #1334 as the source of this work; its intended relationship and merge order need maintainer coordination. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean changed title from WIP: feat(build): one shader that crashes or hangs the GPU driver costs the preparation that shader, not the whole run to feat(build): one shader that crashes or hangs the GPU driver costs the preparation that shader, not the whole run 2026-11-23 16:34:32 +00:00
HumanBean deleted branch feat/prepare-supervisor-continued 2026-11-23 16:34:39 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2323
No description provided.