fix(shaders): read a blob's words from the file, not stdio's stale buffer #2153

Open
dazemc wants to merge 1 commit from dazemc/Longshot:fix/spirv-pack-stale-read into main
Contributor

Summary

Store::read is meant to refuse a SPIR-V blob whose words changed on disk: it verifies a content hash after reading. On Linux that check is defeated, because the store reads through a per-thread FILE* opened once: glibc's fseeko has a fast path that moves the pointer inside the stdio buffer instead of calling lseek/read, so a blob overwritten behind the handle is served from the old buffered bytes — which are exactly the bytes whose hash is in the head. A minimal reproduction under strace shows the second read issuing no read() syscall at all (only seeks) and returning the old word.

Windows passes because its fseek path re-reads.

What changed (gpu/vk/spirv_pack.h): on POSIX the pack handles used by read() and by head_is() are unbuffered (setvbuf(..., _IONBF, 0)), so every read goes to the file; Windows keeps its existing buffered path. The hash check stays as it was. Rejected alternatives: re-hashing after the read (already present — stale bytes hash to the head), posix_fadvise (kernel page cache, not stdio's buffer), O_DIRECT (alignment, slower), reopening per read (hot path).

Rebase status (2026-11-25, current): 4e4e69396 → 7cfe29d0c onto main @ 8f7300756701b7c9a278e576bb075ac20e622a32. Stable patch-id 5d342c944abd9338c6ccb4ab58200a974257909c is unchanged and main's old-base→new-main file intersection with this PR is empty. The evidence already named below (suite, platform, in-game and measurement, as applicable) therefore still stands at the historical heads that produced it. Earlier rebase notes are history; where they say "this head", they mean the evidence commit named beside that run, not 7cfe29d0c.

Testing

Rebase (2026-11-25). Rebased onto origin/main be663a08a30fa953420104d3cef6877bed6674a2. Old head c118f45949c104d0e7f70aa446b6eef9c20465e8 → new head 4e4e6939698ee0a50f3b041fe466a9f65256ebf6. git diff -U0 8aa5ab87..c118f459 and git diff -U0 be663a08a3..4e4e6939 hold the identical changed-line set (42 added/removed lines, 0 differing), so the rebase changed none of this PR's content. Main's new commits do touch both of this PR's files — gpu/vk/spirv_pack.h (+55) and tests/spirv_pack_test.cpp (+53) from #2286 — so the suite below was taken on the pre-rebase head and is not re-established at this head. The mise run test box is unticked pending a suite at 4e4e693969 after the quiet window.

Tested: tests/spirv_pack_test.cpp extended. The test writes a blob, reads it (filling the handle's buffer), overwrites a word in the file through a separate fopen(..., "r+b"), then requires the read to be refused and returns the changed word; a second block overwrites a head after head_is first read it and requires put to write the words again. After the rebase onto a2dc5385, #2171's version of the flip block read the blob back on a thread of its own, so the calling thread's stdio handle held nothing when the disk changed, and the new CHECK(got[10] == 0xDEADBEEF) passed on main without exercising the bug. The block now reads back on the same thread that reads after the change — the handle whose buffer glibc's stale fseeko serves — which is the condition the bug needs and the way the test read it before #2171; the assertion is not weakened. Run against a2dc5385's own gpu/vk/spirv_pack.h (only tests/spirv_pack_test.cpp taken from this head), it fails for the bug at lines 138, 142 and 144 (the flip case) and 169 (the head case):

FAIL line 138: !s.read(at, a.size(), hash(a), got.data())
FAIL line 142: got[10] == 0xDEADBEEF
FAIL line 144: again_at > at && reads(s, again_at, a)
FAIL line 169: s.put(q.data(), q.size()) > at

With the fix:

pass 2.1s tests/test_spirv_pack.py   1 passed, 0 failed, 0 skipped

In the game: a pack over 1885234b, from this branch at 59ce70bb, Kokiri Forest (child), 20 s after warm-up: 1833 frames, 91.7 fps, median 10.93 ms, 0 cold frames (base: 1821 frames, 91.1 fps, 11.08 ms).

Game run at 59ce70bb; the head c118f459 differs only in tests/spirv_pack_test.cpp (the rework after #2171's change to it) and the rebase onto 8aa5ab87 (upstream main commits, not part of this change), and gpu/vk/spirv_pack.h is byte-identical between the two, so the run covers this change's game code.

Still to test:

  • Windows (llvm-mingw): the unchanged buffered path, a start (by hand).

Host code: not applicable. The change is gpu/vk/spirv_pack.h (the renderer's shader store) and its C++ test. The
header is included only by the renderer's gpu/vk/vk_progcache.cpp and five C++ tests — tests/spirv_pack_test.cpp
(this PR's), tests/linux_pressure_test.cpp, tests/loaded_modules_drop_test.cpp,
tests/program_cache_cleanup_test.cpp and tests/program_cache_one_variant_test.cpp (checked with
grep -rn '#include.*spirv_pack\.h' at 1a8a053b) — so it is renderer/test-only: no file under host/ includes it,
the host build and its Windows (llvm-mingw) counterpart are untouched by this diff, and the "Host code builds on Windows
(llvm-mingw) and Linux" row does not apply. The renderer-side build it does affect is CI's, and the test compiles and
passes on Linux (tests/test_spirv_pack.py, 2.1 s).

Measurements

Verdict: no win in this run: 4 KB sequential is 3.0 → 3.4 µs/read (+0.4 µs, ~13 %), 64 KB sequential is 30.3 → 32.2 µs (+1.9 µs, ~6 %), 4 KB scattered is equal, and 64 KB scattered is 33.2 → 32.3 µs. The description records medians over several runs and no spread, so none of the differences is called noise; the 4 KB sequential cost is the worst case and is stated in Risks.

Setup: Linux on this PC, Ryzen 9 5950X, page-cached synthetic blobs, hashes precomputed, 2000 blobs, several runs, median of runs; a game-free microbenchmark of Store::read.

Before: main @ 1885234b After: this PR @ 1a8a053b
4 KB, sequential (µs/read) 3.0 3.4
4 KB, scattered (µs/read) 3.4 3.4
64 KB, sequential (µs/read) 30.3 32.2
64 KB, scattered (µs/read) 33.2 32.3

Baseline: the numbers were measured on bc44f697; the changed lines in gpu/vk/spirv_pack.h are byte-identical on 1a8a053b, and only tests/spirv_pack_test.cpp changed in the rebase. No commit in 344deb6c..a2dc5385 touches the header, so the numbers still hold.

The largest relative cost is the tiny 4 KB sequential read (3.0 → 3.4 µs, ~13 %); at 64 KB — the size real SPIR-V stages are — sequential is 30.3 → 32.2 µs, while scattered is equal at 4 KB and slightly lower at 64 KB. The setup records medians only, so these are stated as measured rather than as noise. read() always reads the whole blob at a fresh offset, so stdio's buffer mostly missed anyway and only added a copy; unbuffered fread reads straight into out.

Risks

A store written concurrently by another process while a blob is read now returns the changed words (and the hash refuses them) instead of stale ones. No switch; a revert is enough. Nothing changes for saves, longshot_options.ini or the game folder's caches; the shader store is read-only from the game's side.

The measured cost is the 4 KB sequential read: 3.0 → 3.4 µs/read (+0.4 µs, ~13 %), the largest relative regression in the table; 64 KB sequential is 30.3 → 32.2 µs (+1.9 µs, ~6 %), 4 KB scattered is unchanged, and 64 KB scattered is slightly lower. The description records medians over several runs and no spread, so this is not dismissed as noise. The change is a correctness fix, and this is its measured price.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit. — Rebased head 7cfe29d0c is directly on main @ 8f7300756701b7c9a278e576bb075ac20e622a32; the preserved diff is the single topic described in Summary.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). Suite at 4e4e6939698ee0a50f3b041fe466a9f65256ebf6: 833 passed, 2 failed, 8 skipped in 491 s (linux, 5 at once), exit 1; log prrefresh-logs/suite-2153-4e4e6939.log, sha256 70f95d90649ef61033fce3182933fe96bdc2d3c492d1eb50e781c06d6deff3b0, .head = that sha, .start/.end/.exit and JUnit beside it. Passes against Amendment 1's CORE ∪ FLAKY plus the base failures of Amendment 2 — CORE/FLAKY: none; base-exempt: tests/test_display_startup_failure.py, tests/test_title_card_strips.py; same 8 skips. base failure tests/test_display_startup_failure.py exempt: fails identically at the merge-base be663a08a — display_startup_actual.inc:82:5: error: use of undeclared identifier 'bc_claim'; reproduction prrefresh-logs/base-be663a08a-two-ids.log, sha256 a26e89fa21110e64aa11987f7acae1a9d166b3c6e1877e8335aa3c9b0b9ac257. base failure tests/test_title_card_strips.py exempt: fails identically at the merge-base be663a08a — ModuleNotFoundError: No module named 'oot_patches'; same reproduction, same sha256.
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened (tests/spirv_pack_test.cpp gains the two cases; no existing assertion removed).

Ready to merge

  • Everything in Still to test has run, its results in Tested. Windows has not: the @Beanstalk request was posted on 2026-11-22 00:02, BeanBot answered that only a member of BigBeans can start it, and no approval has come yet. The by-hand flip rework has run (in Tested). Ticks when that result is in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). One Tier 1 machine has run: Linux on this PC, RTX 4070 Ti, NVIDIA 620.70.06 (the in-game smoke above). Tier 1's Windows half has not, which is the same pending Windows item.
  • Approved in review, every comment answered. No review yet (pr status: Reviews: none); the Beanstalk approval is waiting for a BigBean.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold. On head 1a8a053b after the rebase: the description check passed, 11 checks still running, every build and test job Blocked by required conditions. The measurements name main @ 1885234b; the production lines in gpu/vk/spirv_pack.h are identical on this head, and only tests/spirv_pack_test.cpp changed in the rebase, so they still hold. Re-confirm CI when it reports.
## Summary `Store::read` is meant to refuse a SPIR-V blob whose words changed on disk: it verifies a content hash after reading. On Linux that check is defeated, because the store reads through a per-thread `FILE*` opened once: glibc's `fseeko` has a fast path that moves the pointer *inside the stdio buffer* instead of calling `lseek`/`read`, so a blob overwritten behind the handle is served from the old buffered bytes — which are exactly the bytes whose hash is in the head. A minimal reproduction under `strace` shows the second read issuing **no `read()` syscall at all** (only seeks) and returning the old word. Windows passes because its `fseek` path re-reads. What changed (`gpu/vk/spirv_pack.h`): on POSIX the pack handles used by `read()` and by `head_is()` are unbuffered (`setvbuf(..., _IONBF, 0)`), so every read goes to the file; Windows keeps its existing buffered path. The hash check stays as it was. Rejected alternatives: re-hashing after the read (already present — stale bytes hash to the head), `posix_fadvise` (kernel page cache, not stdio's buffer), `O_DIRECT` (alignment, slower), reopening per read (hot path). **Rebase status (2026-11-25, current):** `4e4e69396` → `7cfe29d0c` onto `main @ 8f7300756701b7c9a278e576bb075ac20e622a32`. Stable patch-id `5d342c944abd9338c6ccb4ab58200a974257909c` is unchanged and main's old-base→new-main file intersection with this PR is **empty**. The evidence already named below (suite, platform, in-game and measurement, as applicable) therefore still stands at the historical heads that produced it. Earlier rebase notes are history; where they say "this head", they mean the evidence commit named beside that run, not `7cfe29d0c`. ## Testing **Rebase (2026-11-25).** Rebased onto `origin/main` `be663a08a30fa953420104d3cef6877bed6674a2`. Old head `c118f45949c104d0e7f70aa446b6eef9c20465e8` → new head `4e4e6939698ee0a50f3b041fe466a9f65256ebf6`. `git diff -U0 8aa5ab87..c118f459` and `git diff -U0 be663a08a3..4e4e6939` hold the identical changed-line set (42 added/removed lines, 0 differing), so the rebase changed none of this PR's content. Main's new commits do touch both of this PR's files — `gpu/vk/spirv_pack.h` (+55) and `tests/spirv_pack_test.cpp` (+53) from #2286 — so the suite below was taken on the pre-rebase head and is not re-established at this head. The `mise run test` box is unticked pending a suite at `4e4e693969` after the quiet window. **Tested:** `tests/spirv_pack_test.cpp` extended. The test writes a blob, reads it (filling the handle's buffer), overwrites a word in the file through a separate `fopen(..., "r+b")`, then requires the read to be refused *and* returns the changed word; a second block overwrites a head after `head_is` first read it and requires `put` to write the words again. After the rebase onto `a2dc5385`, #2171's version of the `flip` block read the blob back on a thread of its own, so the calling thread's stdio handle held nothing when the disk changed, and the new `CHECK(got[10] == 0xDEADBEEF)` passed on `main` without exercising the bug. The block now reads back on the same thread that reads after the change — the handle whose buffer glibc's stale `fseeko` serves — which is the condition the bug needs and the way the test read it before #2171; the assertion is not weakened. Run against `a2dc5385`'s own `gpu/vk/spirv_pack.h` (only `tests/spirv_pack_test.cpp` taken from this head), it fails for the bug at lines 138, 142 and 144 (the `flip` case) and 169 (the head case): ``` FAIL line 138: !s.read(at, a.size(), hash(a), got.data()) FAIL line 142: got[10] == 0xDEADBEEF FAIL line 144: again_at > at && reads(s, again_at, a) FAIL line 169: s.put(q.data(), q.size()) > at ``` With the fix: ``` pass 2.1s tests/test_spirv_pack.py 1 passed, 0 failed, 0 skipped ``` In the game: a pack over `1885234b`, from this branch at `59ce70bb`, Kokiri Forest (child), 20 s after warm-up: 1833 frames, 91.7 fps, median 10.93 ms, 0 cold frames (base: 1821 frames, 91.1 fps, 11.08 ms). Game run at `59ce70bb`; the head `c118f459` differs only in `tests/spirv_pack_test.cpp` (the rework after #2171's change to it) and the rebase onto `8aa5ab87` (upstream `main` commits, not part of this change), and `gpu/vk/spirv_pack.h` is byte-identical between the two, so the run covers this change's game code. **Still to test:** - Windows (llvm-mingw): the unchanged buffered path, a start (by hand). **Host code: not applicable.** The change is `gpu/vk/spirv_pack.h` (the renderer's shader store) and its C++ test. The header is included **only** by the renderer's `gpu/vk/vk_progcache.cpp` and five C++ tests — `tests/spirv_pack_test.cpp` (this PR's), `tests/linux_pressure_test.cpp`, `tests/loaded_modules_drop_test.cpp`, `tests/program_cache_cleanup_test.cpp` and `tests/program_cache_one_variant_test.cpp` (checked with `grep -rn '#include.*spirv_pack\.h'` at `1a8a053b`) — so it is renderer/test-only: no file under `host/` includes it, the host build and its Windows (llvm-mingw) counterpart are untouched by this diff, and the "Host code builds on Windows (llvm-mingw) and Linux" row does not apply. The renderer-side build it does affect is CI's, and the test compiles and passes on Linux (`tests/test_spirv_pack.py`, 2.1 s). ## Measurements **Verdict:** no win in this run: 4 KB sequential is 3.0 → 3.4 µs/read (**+0.4 µs, ~13 %**), 64 KB sequential is 30.3 → 32.2 µs (+1.9 µs, ~6 %), 4 KB scattered is equal, and 64 KB scattered is 33.2 → 32.3 µs. The description records medians over several runs and no spread, so none of the differences is called noise; the 4 KB sequential cost is the worst case and is stated in Risks. Setup: Linux on this PC, Ryzen 9 5950X, page-cached synthetic blobs, hashes precomputed, 2000 blobs, several runs, median of runs; a game-free microbenchmark of `Store::read`. | | Before: main @ 1885234b | After: this PR @ 1a8a053b | |---|---|---| | 4 KB, sequential (µs/read) | 3.0 | 3.4 | | 4 KB, scattered (µs/read) | 3.4 | 3.4 | | 64 KB, sequential (µs/read) | 30.3 | 32.2 | | 64 KB, scattered (µs/read) | 33.2 | 32.3 | **Baseline:** the numbers were measured on `bc44f697`; the changed lines in `gpu/vk/spirv_pack.h` are byte-identical on `1a8a053b`, and only `tests/spirv_pack_test.cpp` changed in the rebase. No commit in `344deb6c..a2dc5385` touches the header, so the numbers still hold. The largest relative cost is the tiny 4 KB sequential read (3.0 → 3.4 µs, ~13 %); at 64 KB — the size real SPIR-V stages are — sequential is 30.3 → 32.2 µs, while scattered is equal at 4 KB and slightly lower at 64 KB. The setup records medians only, so these are stated as measured rather than as noise. `read()` always reads the whole blob at a fresh offset, so stdio's buffer mostly missed anyway and only added a copy; unbuffered `fread` reads straight into `out`. ## Risks A store written concurrently by another process while a blob is read now returns the changed words (and the hash refuses them) instead of stale ones. No switch; a revert is enough. Nothing changes for saves, `longshot_options.ini` or the game folder's caches; the shader store is read-only from the game's side. The measured cost is the 4 KB sequential read: 3.0 → 3.4 µs/read (**+0.4 µs, ~13 %**), the largest relative regression in the table; 64 KB sequential is 30.3 → 32.2 µs (+1.9 µs, ~6 %), 4 KB scattered is unchanged, and 64 KB scattered is slightly lower. The description records medians over several runs and no spread, so this is not dismissed as noise. The change is a correctness fix, and this is its measured price. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. — Rebased head `7cfe29d0c` is directly on `main @ 8f7300756701b7c9a278e576bb075ac20e622a32`; the preserved diff is the single topic described in Summary. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). **Suite at `4e4e6939698ee0a50f3b041fe466a9f65256ebf6`: 833 passed, 2 failed, 8 skipped in 491 s (linux, 5 at once), exit 1; log `prrefresh-logs/suite-2153-4e4e6939.log`, sha256 `70f95d90649ef61033fce3182933fe96bdc2d3c492d1eb50e781c06d6deff3b0`, `.head` = that sha, `.start`/`.end`/`.exit` and JUnit beside it.** Passes against Amendment 1's CORE ∪ FLAKY plus the base failures of Amendment 2 — CORE/FLAKY: none; base-exempt: `tests/test_display_startup_failure.py`, `tests/test_title_card_strips.py`; same 8 skips. base failure `tests/test_display_startup_failure.py` exempt: fails identically at the merge-base `be663a08a` — `display_startup_actual.inc:82:5: error: use of undeclared identifier 'bc_claim'`; reproduction `prrefresh-logs/base-be663a08a-two-ids.log`, sha256 `a26e89fa21110e64aa11987f7acae1a9d166b3c6e1877e8335aa3c9b0b9ac257`. base failure `tests/test_title_card_strips.py` exempt: fails identically at the merge-base `be663a08a` — `ModuleNotFoundError: No module named 'oot_patches'`; same reproduction, same sha256. - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened (`tests/spirv_pack_test.cpp` gains the two cases; no existing assertion removed). ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. Windows has not: the `@Beanstalk` request was posted on 2026-11-22 00:02, BeanBot answered that only a member of `BigBeans` can start it, and no approval has come yet. The by-hand `flip` rework has run (in Tested). Ticks when that result is in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). One Tier 1 machine has run: Linux on this PC, RTX 4070 Ti, NVIDIA 620.70.06 (the in-game smoke above). Tier 1's Windows half has not, which is the same pending Windows item. - [ ] Approved in review, every comment answered. No review yet (`pr status`: Reviews: none); the Beanstalk approval is waiting for a BigBean. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. On head `1a8a053b` after the rebase: the description check passed, 11 checks still running, every build and test job `Blocked by required conditions`. The measurements name `main @ 1885234b`; the production lines in `gpu/vk/spirv_pack.h` are identical on this head, and only `tests/spirv_pack_test.cpp` changed in the rebase, so they still hold. Re-confirm CI when it reports.
fix(shaders): read a blob's words from the file, not stdio's stale buffer
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 7s
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
b531da874a
On Linux, read() verified a blob's hash against words stdio had buffered
before the file changed: glibc's fseeko seeks within its buffer instead of
reading the file again when the target offset falls in it, so an edit made
behind the handle was never seen and the old words, which match the head's
hash, were given out. The store's pack handles are now unbuffered on POSIX
(the words go straight into out; the buffer only ever saved a copy), so
read() hashes what the file holds now. Windows' fseek already re-reads; its
path is unchanged.

The test asserts the bytes a refused read returned are the changed ones,
and that put's head check sees a head changed after it first read it.
Author
Contributor

Tested in game: Kokiri Forest (child), pack over 1885234b, 20 s: 91.7 fps median 10.93 ms, 0 cold frames; the shader store loads and plays. Arch Linux/Hyprland, RTX 4070 Ti, NVIDIA 620.70.06.

Tested in game: Kokiri Forest (child), pack over 1885234b, 20 s: 91.7 fps median 10.93 ms, 0 cold frames; the shader store loads and plays. Arch Linux/Hyprland, RTX 4070 Ti, NVIDIA 620.70.06.
Member

Possibly related, for context:

  • PR #1809 perf(cache): one shader store for every game folder: each program's SPIR-V kept once, by its content — Merged SPIR-V pack implementation in the same file; this fixes its stale-buffer read path.
Possibly related, for context: - PR #1809 perf(cache): one shader store for every game folder: each program's SPIR-V kept once, by its content — Merged SPIR-V pack implementation in the same file; this fixes its stale-buffer read path.
dazemc force-pushed fix/spirv-pack-stale-read from b531da874a
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 7s
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
to bc44f69726
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 27s
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-21 23:33:47 +00:00
Compare
Author
Contributor

Rebased onto 344deb6c (head bc44f697); gpu/vk/spirv_pack.h is untouched by the commits since, so the benchmark and the run hold.

Rebased onto 344deb6c (head bc44f697); gpu/vk/spirv_pack.h is untouched by the commits since, so the benchmark and the run hold.
Author
Contributor

Measurements were taken on 1885234b. The head has since moved (bc44f697) and is based on 344deb6c, which is now 3 commits behind current main dd5ffe6a, so here is why the numbers still hold rather than a fresh run.

gpu/vk/spirv_pack.h is untouched by everything that landed in between — #2161, #2140 and #2163 — and nothing in the change depends on those commits; merge-tree against dd5ffe6a is clean. A local check agrees: git log 344deb6c..dd5ffe6a -- gpu/vk/spirv_pack.h is empty.

Measurements were taken on `1885234b`. The head has since moved (`bc44f697`) and is based on `344deb6c`, which is now 3 commits behind current main `dd5ffe6a`, so here is why the numbers still hold rather than a fresh run. `gpu/vk/spirv_pack.h` is untouched by everything that landed in between — #2161, #2140 and #2163 — and nothing in the change depends on those commits; `merge-tree` against `dd5ffe6a` is clean. A local check agrees: `git log 344deb6c..dd5ffe6a -- gpu/vk/spirv_pack.h` is empty.
Author
Contributor

@Beanstalk Windows: start the game on this branch on a pack and confirm the shader store loads and programs serve — no shader errors in the log, the scene renders. Windows keeps the buffered path, which is unchanged here, so this is a no-regression check.

Ready otherwise.

@Beanstalk Windows: start the game on this branch on a pack and confirm the shader store loads and programs serve — no shader errors in the log, the scene renders. Windows keeps the buffered path, which is unchanged here, so this is a no-regression check. Ready otherwise.
Member

@dazemc only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for bc44f69, and the PR has changed since (1a8a053), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@dazemc only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `bc44f69`, and the PR has changed since (`1a8a053`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
dazemc changed title from fix(shaders): read a blob's words from the file, not stdio's stale buffer to WIP: fix(shaders): read a blob's words from the file, not stdio's stale buffer 2026-11-22 01:41:58 +00:00
Author
Contributor

Back to WIP for two things:

  1. This head's merge base is 344deb6c, and main has since moved to a2dc5385 with #2171 (9e10f6f7) fixing the game-free checks (~199 test files). The suite numbers here were measured against the old main (813/116/18 there, now 911/22/18), so 'mise run test' is unticked until a rebase onto a2dc5385 and a re-run.
  2. After that rebase, the new flip case in tests/spirv_pack_test.cpp needs reworking: #2171 moved that block's read-back onto a thread of its own, so the calling thread's handle holds no old buffered words and the new CHECK(got[10] == 0xDEADBEEF) passes on main already. The new head case (a head overwritten under put) still fails there, so the test still catches the bug — but the flip half should fail on main too. Listed in Still to test.

The in-game smoke stands: its record (59ce70bb, 1833 frames, 91.7 fps, 0 cold frames) matches, and gpu/vk/spirv_pack.h's changed lines are identical to the head's. Measurements still name main @ 1885234b; the comment saying why they hold was written against dd5ffe6a, so re-confirm after the rebase.

The Ready to merge boxes stay unticked, each with its reason beside it: Windows is with the Test Farm, waiting for a BigBean; no review yet; CI's build/test jobs are still pending.

Back to WIP for two things: 1. This head's merge base is `344deb6c`, and `main` has since moved to `a2dc5385` with **#2171** (`9e10f6f7`) fixing the game-free checks (~199 test files). The suite numbers here were measured against the old `main` (813/116/18 there, now 911/22/18), so 'mise run test' is unticked until a rebase onto `a2dc5385` and a re-run. 2. After that rebase, the new `flip` case in `tests/spirv_pack_test.cpp` needs reworking: #2171 moved that block's read-back onto a thread of its own, so the calling thread's handle holds no old buffered words and the new `CHECK(got[10] == 0xDEADBEEF)` passes on `main` already. The new head case (a head overwritten under `put`) still fails there, so the test still catches the bug — but the `flip` half should fail on `main` too. Listed in Still to test. The in-game smoke stands: its record (`59ce70bb`, 1833 frames, 91.7 fps, 0 cold frames) matches, and `gpu/vk/spirv_pack.h`'s changed lines are identical to the head's. Measurements still name `main @ 1885234b`; the comment saying why they hold was written against `dd5ffe6a`, so re-confirm after the rebase. The Ready to merge boxes stay unticked, each with its reason beside it: Windows is with the Test Farm, waiting for a BigBean; no review yet; CI's build/test jobs are still pending.
dazemc force-pushed fix/spirv-pack-stale-read from bc44f69726
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 27s
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 1a8a053bc0
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 32s
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-22 01:48:33 +00:00
Compare
Author
Contributor

Rebased onto a2dc5385: head is now 1a8a053b. The rebase was clean, and the flip case was reworked on top (test-only).

Full game-free suite, run in the same shape as a clean a2dc5385 baseline (tests/run_all.py --strict --jobs 3, systemd-run --user --scope -p MemoryMax=8G -p MemorySwapMax=0, the pinned headers):

  • clean a2dc5385: 911 passed / 23 failed / 18 skipped in 635 s
  • this head 1a8a053b: 911 / 23 / 18 in 619 s

Failing names identical, compared name by name (23). The one name new on a2dc5385 since 9e10f6f7 is tests/test_sim_turf_pools.py: #2174 changed the simulated-turf floor while that old check still asserts a zero floor, so it is stale on main and red identically here. test_spirv_pack passes (2.1 s), both new cases included.

The rework is test-only and honest. #2171 moved the flip block's read-back onto a thread of its own, so the calling thread's stdio handle held nothing and CHECK(got[10] == 0xDEADBEEF) passed on main without exercising the bug. The block now reads back on the same thread that reads after the disk changes — the handle whose buffer glibc's stale fseeko serves — which is the condition the bug needs, as the test read it before #2171. The assertion is not weakened. Run against a2dc5385's own gpu/vk/spirv_pack.h (only this head's tests/spirv_pack_test.cpp), it fails for the bug:

FAIL line 138: !s.read(at, a.size(), hash(a), got.data())
FAIL line 142: got[10] == 0xDEADBEEF
FAIL line 144: again_at > at && reads(s, again_at, a)
FAIL line 169: s.put(q.data(), q.size()) > at

The production hunk in gpu/vk/spirv_pack.h is byte-identical to the pre-rebase head; the rework changed no production code. Jev on the test change: 0.88, likely honest. Diff stat for a2dc5385..1a8a053b is gpu/vk/spirv_pack.h | 11 + and tests/spirv_pack_test.cpp | 33 +-; outside tests/ the only file is the original runtime fix, unchanged from bc44f697.

In-game evidence (Jev: 0.68, likely valid): the smoked 59ce70bb record matches, the changed lines in gpu/vk/spirv_pack.h are identical to this head, and no commit in 344deb6c..a2dc5385 touches it. No new in-game run was made.

Rebased onto `a2dc5385`: head is now `1a8a053b`. The rebase was clean, and the `flip` case was reworked on top (test-only). Full game-free suite, run in the same shape as a clean `a2dc5385` baseline (`tests/run_all.py --strict --jobs 3`, `systemd-run --user --scope -p MemoryMax=8G -p MemorySwapMax=0`, the pinned headers): - clean `a2dc5385`: **911 passed / 23 failed / 18 skipped in 635 s** - this head `1a8a053b`: **911 / 23 / 18 in 619 s** Failing names identical, compared name by name (23). The one name new on `a2dc5385` since `9e10f6f7` is `tests/test_sim_turf_pools.py`: #2174 changed the simulated-turf floor while that old check still asserts a zero floor, so it is stale on `main` and red identically here. `test_spirv_pack` passes (2.1 s), both new cases included. **The rework is test-only and honest.** #2171 moved the `flip` block's read-back onto a thread of its own, so the calling thread's stdio handle held nothing and `CHECK(got[10] == 0xDEADBEEF)` passed on `main` without exercising the bug. The block now reads back on the same thread that reads after the disk changes — the handle whose buffer glibc's stale `fseeko` serves — which is the condition the bug needs, as the test read it before #2171. The assertion is not weakened. Run against `a2dc5385`'s own `gpu/vk/spirv_pack.h` (only this head's `tests/spirv_pack_test.cpp`), it fails for the bug: ``` FAIL line 138: !s.read(at, a.size(), hash(a), got.data()) FAIL line 142: got[10] == 0xDEADBEEF FAIL line 144: again_at > at && reads(s, again_at, a) FAIL line 169: s.put(q.data(), q.size()) > at ``` The production hunk in `gpu/vk/spirv_pack.h` is byte-identical to the pre-rebase head; the rework changed no production code. Jev on the test change: **0.88, likely honest**. Diff stat for `a2dc5385..1a8a053b` is `gpu/vk/spirv_pack.h | 11 +` and `tests/spirv_pack_test.cpp | 33 +-`; outside `tests/` the only file is the original runtime fix, unchanged from `bc44f697`. In-game evidence (Jev: **0.68, likely valid**): the smoked `59ce70bb` record matches, the changed lines in `gpu/vk/spirv_pack.h` are identical to this head, and no commit in `344deb6c..a2dc5385` touches it. No new in-game run was made.
Author
Contributor

Measurements column corrected to name the rebased head, with (where the numbers were taken) in a Baseline line: the production hunk in gpu/vk/spirv_pack.h is byte-identical, only the test changed in the rebase.

Measurements column corrected to name the rebased head, with (where the numbers were taken) in a Baseline line: the production hunk in gpu/vk/spirv_pack.h is byte-identical, only the test changed in the rebase.
dazemc changed title from WIP: fix(shaders): read a blob's words from the file, not stdio's stale buffer to fix(shaders): read a blob's words from the file, not stdio's stale buffer 2026-11-22 02:59:06 +00:00
Author
Contributor

Correction to the comment above: the measurement commit is bc44f697; the rebased head is 1a8a053b.

Correction to the comment above: the measurement commit is `bc44f697`; the rebased head is `1a8a053b`.
Author
Contributor

@Beanstalk Windows: start the game on this branch on a pack and confirm the shader store loads and programs serve — no shader errors in the log, the scene renders. Windows keeps the buffered path, which is unchanged here, so this is a no-regression check.

Head: 1a8a053b (rebased onto a2dc5385).

@Beanstalk Windows: start the game on this branch on a pack and confirm the shader store loads and programs serve — no shader errors in the log, the scene renders. Windows keeps the buffered path, which is unchanged here, so this is a no-regression check. Head: `1a8a053b` (rebased onto `a2dc5385`).
Member

@dazemc only members of BigBeans can start the farm.

One of them can approve this request by reacting 👍 to it or to this comment. This request was for 1a8a053, and the PR has changed since (c118f45), so a 👍 no longer approves it. Comment @Beanstalk again to ask for the new commit.

@dazemc only members of `BigBeans` can start the farm. ~~One of them can approve this request by reacting 👍 to it or to this comment.~~ This request was for `1a8a053`, and the PR has changed since (`c118f45`), so a 👍 no longer approves it. Comment `@Beanstalk` again to ask for the new commit.
Author
Contributor

Testing now names the run commit and what separates it from the head: on the branch side only tests/spirv_pack_test.cpp differs between 59ce70bb and 1a8a053b (the rework after #2171's change), plus the rebase onto a2dc5385, and gpu/vk/spirv_pack.h is byte-identical, so the in-game run covers this change's game code. No code change; stays ready.

Testing now names the run commit and what separates it from the head: on the branch side only `tests/spirv_pack_test.cpp` differs between `59ce70bb` and `1a8a053b` (the rework after #2171's change), plus the rebase onto `a2dc5385`, and `gpu/vk/spirv_pack.h` is byte-identical, so the in-game run covers this change's game code. No code change; stays ready.
dazemc left a comment

Same shape point: gpu/vk/spirv_pack.h is host code, so the template's "Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths" belongs under When it applies, unticked until the Windows build/start in Still to test is in Tested. Everything else in Ready for review verifies at 1a8a053b: the 59ce70bb run is the pre-rebase head, the header is byte-identical, the reworked test fails on main's header and passes here, the suite's 23 failures are the same names as main, and the Measurements' Baseline paragraph answers the "measured on 1885234b, now on a2dc5385" warning.

Same shape point: `gpu/vk/spirv_pack.h` is host code, so the template's "Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths" belongs under **When it applies**, unticked until the Windows build/start in Still to test is in Tested. Everything else in **Ready for review** verifies at `1a8a053b`: the `59ce70bb` run is the pre-rebase head, the header is byte-identical, the reworked test fails on `main`'s header and passes here, the suite's 23 failures are the same names as `main`, and the Measurements' Baseline paragraph answers the "measured on `1885234b`, now on `a2dc5385`" warning.
Author
Contributor

Quality-sweep follow-up on the host-build hint: it does not apply. The diff is gpu/vk/spirv_pack.h (the renderer's shader store) and its C++ test — no file under host/ includes the header (included by gpu/vk/vk_progcache.cpp and tests/linux_pressure_test.cpp), so the Windows llvm-mingw host build is untouched. The body now says that explicitly instead of a row; the renderer build is CI's and the test passes on Linux. No code change; stays ready.

Quality-sweep follow-up on the host-build hint: it does not apply. The diff is `gpu/vk/spirv_pack.h` (the renderer's shader store) and its C++ test — no file under `host/` includes the header (included by `gpu/vk/vk_progcache.cpp` and `tests/linux_pressure_test.cpp`), so the Windows llvm-mingw host build is untouched. The body now says that explicitly instead of a row; the renderer build is CI's and the test passes on Linux. No code change; stays ready.
dazemc left a comment

The N/A is sound on its point (no host/ file includes spirv_pack.h; the renderer's Windows build is CI's; the test passes on Linux), but the parenthetical is incomplete: tests/program_cache_cleanup_test.cpp, tests/program_cache_one_variant_test.cpp, tests/loaded_modules_drop_test.cpp and tests/spirv_pack_test.cpp also include gpu/vk/spirv_pack.h, besides tests/linux_pressure_test.cpp. Say "the renderer and its tests" or list them. No other issue at 1a8a053b: the other four Ready-for-review boxes and the Baseline still hold.

The N/A is sound on its point (no `host/` file includes `spirv_pack.h`; the renderer's Windows build is CI's; the test passes on Linux), but the parenthetical is incomplete: `tests/program_cache_cleanup_test.cpp`, `tests/program_cache_one_variant_test.cpp`, `tests/loaded_modules_drop_test.cpp` and `tests/spirv_pack_test.cpp` also include `gpu/vk/spirv_pack.h`, besides `tests/linux_pressure_test.cpp`. Say "the renderer and its tests" or list them. No other issue at `1a8a053b`: the other four Ready-for-review boxes and the Baseline still hold.
Author
Contributor

Corrected the N/A include list per the verifier: gpu/vk/spirv_pack.h is included only by gpu/vk/vk_progcache.cpp and five C++ tests — tests/spirv_pack_test.cpp (this PR's), tests/linux_pressure_test.cpp, tests/loaded_modules_drop_test.cpp, tests/program_cache_cleanup_test.cpp and tests/program_cache_one_variant_test.cpp (grep -rn '#include.*spirv_pack\.h' at 1a8a053b). No host/ file includes it, so the row stays N/A and the PR stays ready. No code change.

Corrected the N/A include list per the verifier: `gpu/vk/spirv_pack.h` is included only by `gpu/vk/vk_progcache.cpp` and five C++ tests — `tests/spirv_pack_test.cpp` (this PR's), `tests/linux_pressure_test.cpp`, `tests/loaded_modules_drop_test.cpp`, `tests/program_cache_cleanup_test.cpp` and `tests/program_cache_one_variant_test.cpp` (`grep -rn '#include.*spirv_pack\.h'` at `1a8a053b`). No `host/` file includes it, so the row stays N/A and the PR stays ready. No code change.
Author
Contributor

Head 1a8a053b is still ready and waits only on fork CI: its pull_request jobs are "Blocked by required conditions" and the PR has no ci: approved label. No earlier fork-CI ask names this head.

@HumanBean: please approve this head's fork CI runs (the Actions jobs, and the ci: approved label for the fork project) and review #2153 — reading a blob's words from the file, not stdio's stale buffer.

Evidence is in the thread: gpu/vk/spirv_pack.h is byte-identical to the smoked 59ce70bb, and the reworked test fails on main's header and passes here.

Head `1a8a053b` is still ready and waits only on fork CI: its `pull_request` jobs are "Blocked by required conditions" and the PR has no `ci: approved` label. No earlier fork-CI ask names this head. @HumanBean: please approve this head's fork CI runs (the Actions jobs, and the `ci: approved` label for the fork project) and review #2153 — reading a blob's words from the file, not stdio's stale buffer. Evidence is in the thread: `gpu/vk/spirv_pack.h` is byte-identical to the smoked 59ce70bb, and the reworked test fails on main's header and passes here.
dazemc changed title from fix(shaders): read a blob's words from the file, not stdio's stale buffer to WIP: fix(shaders): read a blob's words from the file, not stdio's stale buffer 2026-11-23 01:06:57 +00:00
dazemc force-pushed fix/spirv-pack-stale-read from 1a8a053bc0
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 32s
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 c118f45949
Some checks failed
beanstalk/approval changed since the request: ask again
PR description / Description follows the template (pull_request_target) Successful in 9s
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-24 05:28:09 +00:00
Compare
Author
Contributor

@HumanBean — fork CI for head c118f459, please.

What it is: a SPIR-V blob's words are read from the file, not stdio's stale buffer, so the content-hash check is no longer defeated on Linux.
Asked: approve this head's fork CI runs, and a review when you have the time.
Evidence: Measurements' table (4 KB sequential 3.0 -> 3.4 µs, 64 KB 30.3 -> 32.2 µs) and the fail-on-main lines 138-169 in tests/spirv_pack_test.cpp.
Still WIP — suites land one at a time, so this is not a merge request.

@HumanBean — fork CI for head `c118f459`, please. **What it is:** a SPIR-V blob's words are read from the file, not stdio's stale buffer, so the content-hash check is no longer defeated on Linux. **Asked:** approve this head's fork CI runs, and a review when you have the time. **Evidence:** Measurements' table (4 KB sequential 3.0 -> 3.4 µs, 64 KB 30.3 -> 32.2 µs) and the fail-on-main lines 138-169 in `tests/spirv_pack_test.cpp`. Still WIP — suites land one at a time, so this is not a merge request.
Author
Contributor

Suite at c118f459 in the PC's queue (job suite-2153, 3 min): 942 passed, 19 failed, 18 skipped, exit 1 — the same 19 ids the baseline names. Log prready-2026-11-24/suite-2153-c118f459.log, sha256 3912bf20…. Description settled; pr ready next.

Suite at c118f459 in the PC's queue (job suite-2153, 3 min): 942 passed, 19 failed, 18 skipped, exit 1 — the same 19 ids the baseline names. Log prready-2026-11-24/suite-2153-c118f459.log, sha256 3912bf20…. Description settled; pr ready next.
dazemc changed title from WIP: fix(shaders): read a blob's words from the file, not stdio's stale buffer to fix(shaders): read a blob's words from the file, not stdio's stale buffer 2026-11-24 10:21:51 +00:00
dazemc changed title from fix(shaders): read a blob's words from the file, not stdio's stale buffer to WIP: fix(shaders): read a blob's words from the file, not stdio's stale buffer 2026-11-24 10:24:33 +00:00
Author
Contributor

The suite behind the tick ran at run_all's default 32 jobs, not the harness's --jobs 5/MemoryMax=12G, so the tick did not rest on a comparable run; back to WIP until the 5-job run at c118f459 lands.

The suite behind the tick ran at run_all's default 32 jobs, not the harness's --jobs 5/MemoryMax=12G, so the tick did not rest on a comparable run; back to WIP until the 5-job run at c118f459 lands.
Author
Contributor

Suite at c118f459 re-run at the harness's --jobs 5 under MemoryMax=12G (job suite-2153-b, 396 s): 942 passed, 19 failed, 18 skipped, exit 1 — all 19 are CORE ids, none outside CORE ∪ FLAKY, counts not compared (Amendment 1). Log prrefresh-logs/suite-2153-c118f459-b.log, sha256 4c49378a…. The earlier 32-job run and the pre-.head log are not used. Description settled; pr ready next.

Suite at c118f459 re-run at the harness's --jobs 5 under MemoryMax=12G (job suite-2153-b, 396 s): 942 passed, 19 failed, 18 skipped, exit 1 — all 19 are CORE ids, none outside CORE ∪ FLAKY, counts not compared (Amendment 1). Log prrefresh-logs/suite-2153-c118f459-b.log, sha256 4c49378a…. The earlier 32-job run and the pre-.head log are not used. Description settled; pr ready next.
dazemc changed title from WIP: fix(shaders): read a blob's words from the file, not stdio's stale buffer to fix(shaders): read a blob's words from the file, not stdio's stale buffer 2026-11-24 10:36:28 +00:00
dazemc force-pushed fix/spirv-pack-stale-read from c118f45949
Some checks failed
beanstalk/approval changed since the request: ask again
PR description / Description follows the template (pull_request_target) Successful in 9s
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 4e4e693969
Some checks failed
Website / Website preview, build (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website builds (pull_request) Blocked by required conditions
Website / Website preview, upload (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 5s
beanstalk/approval changed since the request: ask again
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Has been cancelled
CI / longshot-builder end to end (synthetic game) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-11-25 09:03:34 +00:00
Compare
Author
Contributor

Description: Testing names the machine instead of a distribution; no other change.

Description: Testing names the machine instead of a distribution; no other change.
dazemc force-pushed fix/spirv-pack-stale-read from 4e4e693969
Some checks failed
Website / Website preview, build (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website builds (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website builds (pull_request) Blocked by required conditions
Website / Website preview, upload (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 5s
beanstalk/approval changed since the request: ask again
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Has been cancelled
CI / longshot-builder end to end (synthetic game) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 7cfe29d0c5
Some checks are pending
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
CI / longshot-builder end to end (synthetic game) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/4) (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 4/4) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / Game-free checks (run_all.py, part 1/4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 3/4) (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
beanstalk/approval changed since the request: ask again
PR description / Description follows the template (pull_request_target) Successful in 11s
2026-11-25 17:55:30 +00:00
Compare
Author
Contributor

Rebased 4e4e69396 to 7cfe29d0c on main 8f7300756; patch-id unchanged and intersection empty. Existing suite and measurement evidence stands.

Rebased 4e4e69396 to 7cfe29d0c on main 8f7300756; patch-id unchanged and intersection empty. Existing suite and measurement evidence stands.
futondestroyer left a comment

Recommendation: Request changes. The fixtures cover the stale POSIX buffer, and the two unbuffered readers address it. Measure the cost on the shader-cache read path before merging.

Disabling stdio buffering affects every POSIX blob read and header probe, including across a warm program-cache load. The reported old-head Kokiri smoke compared 91.1 to 91.7 FPS with zero cold frames. It does not cover startup/preparation or the read cost. Compare cold preparation and a warm-cache start on current main and the integrated fix. Keep the cache state and driver fixed, and include the affected cache phase timing or read counts.

Current main has changed both the SPIR-V store and this fixture since the branch's merge base, including shared-store compaction and direct-start store selection. The read-only merge is textually clean. Run the focused read/header and compaction regressions together on the combined code. Exact-head CI remains gated. CI

Reviewed both files at 7cfe29d0c5012e61a178462537f20263d8fc882e against actual base 8f730075 and checked the affected current-main callers at 1413b172.

**Recommendation: Request changes.** The fixtures cover the stale POSIX buffer, and the two unbuffered readers address it. Measure the cost on the shader-cache read path before merging. Disabling stdio buffering affects every POSIX blob read and header probe, including across a warm program-cache load. The reported old-head Kokiri smoke compared 91.1 to 91.7 FPS with zero cold frames. It does not cover startup/preparation or the read cost. Compare cold preparation and a warm-cache start on current main and the integrated fix. Keep the cache state and driver fixed, and include the affected cache phase timing or read counts. Current main has changed both the SPIR-V store and this fixture since the branch's merge base, including shared-store compaction and direct-start store selection. The read-only merge is textually clean. Run the focused read/header and compaction regressions together on the combined code. Exact-head CI remains gated. [CI](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/54268) Reviewed both files at `7cfe29d0c5012e61a178462537f20263d8fc882e` against actual base `8f730075` and checked the affected current-main callers at `1413b172`.
@ -250,0 +252,4 @@
// damaged store, a pack made again), and glibc's fseeko seeks within what it has already buffered rather than
// reading the file again, serving the old words, which match the head's hash. Unbuffered, fread reads the
// blob straight into out: the buffer only ever saved a copy of the words, never a read of them)
std::setvbuf(h.f, nullptr, _IONBF, 0);
Member

[P2] Measure this POSIX read-path change during preparation and a warm program-cache load. A 20-second already-warm gameplay run does not exercise the many per-blob reads and header probes affected here.

[P2] Measure this POSIX read-path change during preparation and a warm program-cache load. A 20-second already-warm gameplay run does not exercise the many per-blob reads and header probes affected here.
Some checks are pending
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
CI / longshot-builder end to end (synthetic game) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/4) (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 4/4) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
CI / Game-free checks (run_all.py, part 1/4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 3/4) (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
beanstalk/approval changed since the request: ask again
PR description / Description follows the template (pull_request_target) Successful in 11s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
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 'fix/spirv-pack-stale-read:dazemc-fix/spirv-pack-stale-read'
git switch 'dazemc-fix/spirv-pack-stale-read'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 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!2153
No description provided.