Shader: a meet in a block that has already branched keeps that branch; keep GTA VI's 30 s watchdog from ending the run #84

Open
github-bot wants to merge 3 commits from github-bot/gh-84 into main AGit
Owner

@⁠maridogolpeador on GitHub · 2026-11-27 14:08 UTC · original
maridogolpeador:fix/gta6-meet-in-closed-block-and-watchdog → main · +261 −24 · 11 files · 3 commits · open

Two fixes that took Grand Theft Auto VI from a black screen and a crash to the world on my machine: a shader translator bug, and the title's own hang watchdog.

1. A meet in a block that has already branched (the "use of a void value" panic)

Symptom: panicked at crates\victory-shader\src\emit\bitcode.rs:872:21: use of a void value, then host pipeline build panicked shaders=[compute 02384a60fda6f2d0], a dispatch without a host pipeline dropped, and the title's write to 0 at +0x23cf683.

Cause: a lane mask defined in an earlier block and first read as a number later is balloted and exchanged where it was defined. With half meets (a wave64 program on 32-lane host waves) that exchange meets in a block whose branch is already there: the entry, or an earlier block's tail. half_meet_at gave that block the meet's CondBr in place of its own branch, so everything the old branch led to became unreachable while its values were still read. VICTORY_OPT_CHECK (2nd commit) showed it: after lowering: ... reads inst 181 in block 5 reached=false; the entry block's Br(3) was replaced by the meet's CondBr.

cb1468d refuses these programs (a deferred exchange needs a per-wave meet in a closed block). This PR translates them instead:

  • half_meet_at meets in the block that now holds what is aimed at the closed one, takes its branch off first and puts it on the meet's continuation, and leaves the lowering cursor where it was.
  • Module::terminate follows a meet's redirect, as push does.
  • Module::settle_meets: a join's incoming from a closed block comes from its continuation.
  • write leaves out a phi's incoming from a block it does not write; the void-value panic names the instruction, its block and liveness (instead of 1bd5e1a's funcs - 1 stand-in, which writes wrong DXIL silently).
  • TRANSLATOR_VERSION 2 → 4: translations change (and the upstream changes since 2 had not bumped it).

The upstream test a_deferred_ballot_in_a_wave_only_predecessor_is_refused becomes ..._meets_there: the same program now translates (and is validated when the validator is present).

2. The title's 30 s watchdog

The write to 0 at +0x23cf683 (the crash in #39) is deliberate: a watchdog thread (title+0x2215a60) sleeps 1 s, checks the main loop's tick (title+0x71b6338), and after 30 checks without a change decodes a message and writes to address 0. While the first frames wait for their compute pipelines (2a1965f) the loop stalls past 30 s. The watchdog starts its count over on every pass while bit 0 of title+0x71b6330 is set.

VICTORY_POKE (made for exactly this) was only built with diagnostics; it is now in every build (it does nothing unless set), and Play-VIctory*.cmd set VICTORY_POKE=71b6330:1 unless already set.

Tested on

CPU AMD Ryzen 9 5900X (12 cores / 24 threads)
GPU NVIDIA GeForce RTX 3080, 10 GB, driver 617.42
RAM 16 GB, page file managed by Windows
OS Windows 11 Pro, build 26300
Build cargo build --release --locked -p victory (MSVC, Rust 1.98.1), launched with Play-VIctory.cmd
  • cargo test -p victory-shader --lib: 307 passed, 0 failed.
  • victory shaders over the title: 25,665 in the cache, 320 do not translate (upstream's refusals), 0 panics; before, the run panicked.
  • The title reaches the world (third-person camera on the street, ~5-8 fps) and kept running; before, it ended at the loading screen (~4.5 min) every time. The first run after the cache bump took about 17 minutes to get there while the driver compiled pipelines.
  • Not tested: other GPUs, AMD (Play-VIctory-AMD.cmd only gets the same VICTORY_POKE line), Linux/Proton.

🤖 Generated with Claude Code

**@⁠maridogolpeador** on GitHub · 2026-11-27 14:08 UTC · [original](https://github.com/DoubleGhosty/cool_fox/pull/84) `maridogolpeador:fix/gta6-meet-in-closed-block-and-watchdog` → `main` · +261 −24 · 11 files · 3 commits · open Two fixes that took Grand Theft Auto VI from a black screen and a crash to the world on my machine: a shader translator bug, and the title's own hang watchdog. ## 1. A meet in a block that has already branched (the "use of a void value" panic) **Symptom:** `panicked at crates\victory-shader\src\emit\bitcode.rs:872:21: use of a void value`, then `host pipeline build panicked shaders=[compute 02384a60fda6f2d0]`, `a dispatch without a host pipeline dropped`, and the title's write to 0 at `+0x23cf683`. **Cause:** a lane mask defined in an earlier block and first read as a number later is balloted and exchanged where it was defined. With half meets (a wave64 program on 32-lane host waves) that exchange meets in a block whose branch is already there: the entry, or an earlier block's tail. `half_meet_at` gave that block the meet's `CondBr` in place of its own branch, so everything the old branch led to became unreachable while its values were still read. `VICTORY_OPT_CHECK` (2nd commit) showed it: `after lowering: ... reads inst 181 in block 5 reached=false`; the entry block's `Br(3)` was replaced by the meet's `CondBr`. cb1468d refuses these programs (`a deferred exchange needs a per-wave meet in a closed block`). This PR translates them instead: - `half_meet_at` meets in the block that now holds what is aimed at the closed one, takes its branch off first and puts it on the meet's continuation, and leaves the lowering cursor where it was. - `Module::terminate` follows a meet's redirect, as `push` does. - `Module::settle_meets`: a join's incoming from a closed block comes from its continuation. - `write` leaves out a phi's incoming from a block it does not write; the void-value panic names the instruction, its block and liveness (instead of 1bd5e1a's `funcs - 1` stand-in, which writes wrong DXIL silently). - `TRANSLATOR_VERSION` 2 → 4: translations change (and the upstream changes since 2 had not bumped it). The upstream test `a_deferred_ballot_in_a_wave_only_predecessor_is_refused` becomes `..._meets_there`: the same program now translates (and is validated when the validator is present). ## 2. The title's 30 s watchdog The write to 0 at `+0x23cf683` (the crash in #39) is deliberate: a watchdog thread (`title+0x2215a60`) sleeps 1 s, checks the main loop's tick (`title+0x71b6338`), and after 30 checks without a change decodes a message and writes to address 0. While the first frames wait for their compute pipelines (2a1965f) the loop stalls past 30 s. The watchdog starts its count over on every pass while bit 0 of `title+0x71b6330` is set. `VICTORY_POKE` (made for exactly this) was only built with `diagnostics`; it is now in every build (it does nothing unless set), and `Play-VIctory*.cmd` set `VICTORY_POKE=71b6330:1` unless already set. ## Tested on | | | |---|---| | CPU | AMD Ryzen 9 5900X (12 cores / 24 threads) | | GPU | NVIDIA GeForce RTX 3080, 10 GB, driver 617.42 | | RAM | 16 GB, page file managed by Windows | | OS | Windows 11 Pro, build 26300 | | Build | `cargo build --release --locked -p victory` (MSVC, Rust 1.98.1), launched with `Play-VIctory.cmd` | - `cargo test -p victory-shader --lib`: 307 passed, 0 failed. - `victory shaders` over the title: 25,665 in the cache, 320 do not translate (upstream's refusals), 0 panics; before, the run panicked. - The title reaches the world (third-person camera on the street, ~5-8 fps) and kept running; before, it ended at the loading screen (~4.5 min) every time. The first run after the cache bump took about 17 minutes to get there while the driver compiled pipelines. - Not tested: other GPUs, AMD (`Play-VIctory-AMD.cmd` only gets the same `VICTORY_POKE` line), Linux/Proton. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A lane mask defined in an earlier block and first read as a number later
is balloted and exchanged where it was defined (cb1468d). With half meets
on (a wave64 program on 32-lane host waves), that exchange meets in a block
whose branch is already there: the entry, or an earlier block's tail.
`half_meet_at` gave that block the meet's branch in place of its own, so
the blocks the old branch led to were never reached while their values
were still read: `Module::write` panicked with "use of a void value", the
pipeline was dropped, and Grand Theft Auto VI's compute dispatch with it
(compute 02384a60fda6f2d0; the title then ended itself).

cb1468d refuses such programs ("a deferred exchange needs a per-wave meet
in a closed block"); this translates them instead:

- `half_meet_at` meets in the block that now holds what is aimed at the
  closed one (`Module::follow`), takes its branch off first and puts it on
  the meet's continuation, and leaves the lowering cursor where it was
  when the block met in was not the current one.
- `Module::terminate` follows a meet's redirect, as `push` does.
- `Module::settle_meets` (before the clean-up passes): a join's incoming
  from a block a meet closed comes from its continuation.
- `write` leaves out a phi's incoming from a block it does not write.
- "use of a void value" names the instruction, its block and liveness.

All 25,748 shaders of the title translate without a panic; 5 of them met in
a closed block before. TRANSLATOR_VERSION 4: translations change (and the merged
upstream changes since version 2 had not bumped it).

Tests: a_deferred_ballot_in_a_wave_only_predecessor_meets_there (was
..._is_refused), a_meet_in_a_block_that_branched_on_keeps_its_branch,
phi_incoming_from_an_unreachable_block_is_dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With VICTORY_OPT_CHECK set, the module is checked after the lowering and
after each clean-up pass (merge, prune, drop_dead): a value a reached block
reads (a join only through its reached predecessors) must be made in a
reached block. A failure names the pass, both instructions, their blocks,
their predecessors and the meets' redirects. It found the meet above:
"after lowering ... reads inst 181 in block 5 reached=false". Off: no cost.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title's watchdog thread (title+0x2215a60) checks once a second that the
main loop's tick (title+0x71b6338) moved, and after 30 checks without it
ends the title on purpose: it decodes a message and writes to address 0 at
+0x23cf683 ("write 0x0: nothing mapped there", the crash in #39). While the
first frames wait for their compute pipelines (2a1965f) the loop can stall
past 30 s. The watchdog starts its count over on every pass while bit 0 of
title+0x71b6330 is set.

VICTORY_POKE (run.rs) was only built with `diagnostics`; it is now in every
build (it does nothing unless set), and Play-VIctory*.cmd set
VICTORY_POKE=71b6330:1 unless it is set already.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 14:15:04 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/84/head:github-bot/gh-84'
git switch 'github-bot/gh-84'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-84'
git switch 'github-bot/gh-84'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-84'
git switch 'github-bot/gh-84'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-84'
git switch 'main'
git merge --squash 'github-bot/gh-84'
git switch 'main'
git merge --ff-only 'github-bot/gh-84'
git switch 'main'
git merge 'github-bot/gh-84'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.