Skip to content

Track counter-report hazards by byte range - #2121

Closed
thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/counter-report-ranges
Closed

thehobbit85 wants to merge 1 commit into
seedds:mainfrom
thehobbit85:codex/counter-report-ranges

Conversation

@thehobbit85

Copy link
Copy Markdown
Contributor

What and why

Addresses the false uniform-shadow refusals described in issue #1660. Ori and the Will of the Wisps puts two 16-byte counter reports on a page shared with unrelated uniform blocks. Treating each unfinished report as an unknown write to the entire 4 KB page needlessly refuses those partial shadows and ends render passes.

Track the exact report ranges and their submission fences. Both GPU-write ledgers consult them, including CPU copy-source reads of the timestamp bytes. Overlapping bytes remain unavailable until the report writes have landed and the completion fence advances. Actual GPU writes keep page hazards. Per-submission overflow and a full live ring retain the previous conservative behavior; no unfinished record is overwritten.

The issue's copied-program identity bug is already fixed on main by #1521. This PR addresses its remaining counter-report tracking defect; it does not claim the game's reported frame-rate improvement or close the whole gameplay report. Credit to Zatteo for the diagnosis and exact-range approach.

Checked

Apple M2 Max, macOS 26.6 (25G5028f), Xcode 27.2 (27B52), Python 3.14.6; native arm64 builds. No game files, keys or extracted data.

  • Regression before the production change: five failures in 157 checks, demonstrating disjoint uniforms and CPU source bytes being incorrectly refused. With the fix, all 157 pass. Expanded capacity/lifetime coverage passes all 1,187 checks in t_ubp_running: both report records, timestamp-source reads, touching boundaries, cross-page reports, independent fences, mixed real writes, submission overflow, full ring fallback and reuse only after retirement.
  • make -C dm/gfx/tests -j2 GAME=010015100B514000 run: full native graphics suite PASS (641.6 seconds).
  • make -C dm/host -j2 GAME=010015100B514000 dmhost: PASS.
  • LLVM 23.1.4 lint_c.py tidy --against 6c676444c6991967cad8164d09ea041f6c8efbaa -j2 dm/gfx/nvn/nvn_mtl.m dm/gfx/tests/t_ubp_running.m: PASS, zero file/check pairs above the existing baseline.
  • Full tools suite: 1,423 tests, 23 skips, one inherited ABI-literal ratchet failure (nvn_mtl.m, '?' count 2→3), reproduced independently on pristine base; existing test_dmsh_abi's ratchet no longer counts "?": the unknown binding kind is also what log lines write for a name they do not have, and the third such placeholder in nvn_mtl.m fails the Tool tests on main (issue #1656) #1981 addresses it. Documentation tests pass.
  • iOS Python suite: all 52 pass. Graphics Python suite: 467 tests, 140 skips, six inherited IntegerPassThrough errors. Python lint: the same three inherited dmsh_build.py:166–167 type findings. Both groups reproduce on pristine base; existing Fix shader-tool lint and stale shader test fixtures #2111 addresses them.
  • git diff --check: PASS. No shader-chain tool or version changes.
  • Attempted regress.py check --games 01008DD013200000,0100A6301214E000,01007EF00011E000,0400380020056000,0400486024DEC000: exit 2, because REGRESS_ROOT, REGRESS_GAMES and game files are unavailable. Ori is the reported layout (no profile yet), Engage exercises reports sharing uniform memory, Breath of the Wild exercises partial uniform shadows, Splatoon Raiders exercises report-heavy submissions, and Ocarina of Time exercises timestamp reads. None was run; there is no gameplay, visual or frame-rate validation claim.

Fresh main 6c676444 and all 1,472 open/draft/closed/merged PR descriptions plus the issue timeline were checked again before publication. Existing counter-clock/frequency and write-ledger PRs address different defects; no existing solution to report-page widening was found.

Docs

  • Mechanism and limitations in docs/reference/rendering.md, current behavior in docs/development.md, symptom index regenerated.
  • No agent plans, progress journals, game files or extracted data in the diff.

Keep report records live through their submission fence without refusing unrelated uniform bytes on the same page. Retain conservative page tracking when capacity is exhausted and for actual GPU writes.

Refs: seedds#1660

Co-authored-by: Zatteo <64840342+zatteogit@users.noreply.github.com>
@github-actions github-actions Bot added nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) docs Documentation labels Nov 10, 2026
@thehobbit85

Copy link
Copy Markdown
Contributor Author

Closing as superseded by current main (72ca2e09d565e8c144ad27f191948082e22464fa).

Commit 4c574a6 already tracks completion-written counter records by their own 16 bytes and submission fences, with conservative page fallback when the live ring cannot accept a submission. Both uniform-shadow and CPU-source-read hazard checks use the exact records; actual GPU writes still retain page hazards. It also covers samples-passed reports. This provides the PR’s intended fix for issue #1660 without adding a second report ledger. Fresh native t_ubp_running validation passed all 25 checks on a9005a5; those native sources are identical at the main revision cited here. This is synthetic regression evidence, not a new gameplay or performance claim.

The PR branch is preserved.

@thehobbit85
thehobbit85 deleted the codex/counter-report-ranges branch November 13, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants