[pr-docs][MULDER][RAYTRACING] docs/larp-raytracing.md: ray tracing, larp against Darner (C10) #710

Open
cafe wants to merge 1 commit from cafe/c10-larp-raytracing into Main AGit
Contributor

Task: C10

Research

  • larp makes the title's ray-tracing structure memory the host's own: it detours xmem_alloc_wc_256_or_break and xmem_free_bvh, answers the prebuild with the host's sizes, and builds every structure at the title's own address, so the title's allocator, budget and frees manage the host bytes (reference/larp/crates/larp-gpu/src/rt.rs:29-40, rt.rs:1431-1592, larp-gpu/src/bvh.rs:146-215).
  • Darner replaces the builder's 12 exports only (crates/darner-hle/src/modules/xboxbvh.rs:130-185) and keeps its own buffers keyed by console address (crates/darner-gpu/src/hwrt.rs:3691), 64 KiB placed or committed per bottom level (hwrt.rs:2543, hwrt.rs:2960-3064), with a budget, least-recently-used eviction and rebuilds of evicted bottom levels on top (hwrt.rs:1128-1189).
  • Other differences:
    • larp decodes the console's packed index format 53 and quantised position format 16 on the card (rt.rs:2897-2945, rt.rs:3685-3783); Darner decodes both on the CPU (hwrt.rs:4721-4810) and copies every plain input at each build and refit (hwrt.rs:4944, hwrt.rs:4968).
    • larp honours top-level updates (rt.rs:3058-3066); Darner always rebuilds top levels in full (hwrt.rs:5053-5056).
    • larp really compacts, guarded by the title's range (rt.rs:2161-2275, rt.rs:3354-3416); Darner answers the full size and aliases the copy (hwrt.rs:5636-5663).
    • larp skips rays with a NaN or t min > t max before TraceRayInline (larp-shader/src/emit/rayquery.rs:194-202); no such guard was found in Darner's darner-shader/src/emit/rayquery.rs.
  • Plan: one new document, docs/larp-raytracing.md, with each difference as an item: what larp does, what Darner does, why one is better, and the Darner file a port would change, plus a summary table. Items that are A6 (reserved memory) or track B (replacement shaders, the positions pool) are marked as such and only described.

Contributor role (optional)

  • Fluxer ID: 1577752157942198273

What it changes

  • The problem on main: read from the code only. No document compared larp's ray tracing with Darner's; docs/fork-ray-tracing.md covers other forks and Darner's own switches, and the new file links it instead of repeating it.
  • Adds docs/larp-raytracing.md (388 lines, eight sections and a summary table). Candidate new C items it finds (staff decide the rows):
    • 1a: structures built in the title's own blocks, its allocator and frees hooked;
    • 1b: small structures in shared slabs;
    • 1c: the title's scratch used;
    • 2a: format 53 and 16 decoded on the card;
    • 2b: no per-build copy of plain inputs, keeping a #3706 guard where needed;
    • 3a: top-level updates honoured;
    • 4a: real compaction (after 1a);
    • 5: a smaller remap table (after 1a);
    • 7b: invalid rays not traced.
  • Kept as Darner's: the per-frame build budget, procedural geometry and transforms taken at the call. Marked "check only": the rehydrate flags and whether Darner's matcher lifts larp's seven listed programs.
  • No speed numbers of its own. The only figures are written in the code, with the place named (hwrt.rs:1130-1141, hwrt.rs:1465-1468, hwrt.rs:3053-3061, larp rt.rs:124-125); everything else says expected, unknown or not measured. Reasons worked out from the code are marked "inferred".

How it was tested

  • Tested revision: 603cc2e76 on Main 33ff92cc4.
  • Commands and results:
    • cargo xtask policy --staged: "asset policy: 1 files ok".
    • The quoted figures and a sample of references were checked by hand against both trees: the top-level rebuild (hwrt.rs:5053-5056), the compaction answer (hwrt.rs:5636-5663), larp's update and allocator notes (rt.rs:3058-3066, rt.rs:29-40), ray_valid (larp rayquery.rs:194-202), the 12 builder exports, and the figures at hwrt.rs:1132, 1467 and 3060 and larp rt.rs:125.
  • Changes a default: no (documentation only).
  • Gates run: none (documentation only; no code changed).
  • Hardware dependence: none (no runs).
  • Coverage gaps, the claims least sure:
    • "Darner never sees the arena reuse a range" (1a) is inferred from finding no hook for the arena's frees; hwrt.rs:1131 says structures "went only when the title freed their memory".
    • 7b rests on a search of Darner's rayquery.rs, not a full read.
    • That compaction is safe from the #3706 misalignment once 1a lands is inferred from larp's bvh.rs:196-199.
    • Darner's CPU-decode figures are from older runs; how much is left today is not measured.
    • Whether larp's single barrier pair per call is safe when a top level and its bottom levels are built in one call was not checked.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only). Documentation only: nothing to run.
  • This PR contains one change based on Main.
  • The diff follows docs/asset-policy.md (no game data, no shader code).

Checked for overlap

  • Searched pull requests for larp-raytracing, C10 and "ray tracing larp": none covers this. Related: #709 edits docs/fork-ray-tracing.md, which this file links; no shared file.

Opened by Cafe's agent, working the ROADMAP unattended (not reviewed by a person before posting). Measured on RTX 2080 Ti, Windows 10, no Resizable BAR (no measurements in this one: documentation only).

Task: C10 ## Research - **larp** makes the title's ray-tracing structure memory the host's own: it detours `xmem_alloc_wc_256_or_break` and `xmem_free_bvh`, answers the prebuild with the host's sizes, and builds every structure at the title's own address, so the title's allocator, budget and frees manage the host bytes (`reference/larp/crates/larp-gpu/src/rt.rs:29-40`, `rt.rs:1431-1592`, `larp-gpu/src/bvh.rs:146-215`). - **Darner** replaces the builder's 12 exports only (`crates/darner-hle/src/modules/xboxbvh.rs:130-185`) and keeps its own buffers keyed by console address (`crates/darner-gpu/src/hwrt.rs:3691`), 64 KiB placed or committed per bottom level (`hwrt.rs:2543`, `hwrt.rs:2960-3064`), with a budget, least-recently-used eviction and rebuilds of evicted bottom levels on top (`hwrt.rs:1128-1189`). - **Other differences:** - larp decodes the console's packed index format 53 and quantised position format 16 on the card (`rt.rs:2897-2945`, `rt.rs:3685-3783`); Darner decodes both on the CPU (`hwrt.rs:4721-4810`) and copies every plain input at each build and refit (`hwrt.rs:4944`, `hwrt.rs:4968`). - larp honours top-level updates (`rt.rs:3058-3066`); Darner always rebuilds top levels in full (`hwrt.rs:5053-5056`). - larp really compacts, guarded by the title's range (`rt.rs:2161-2275`, `rt.rs:3354-3416`); Darner answers the full size and aliases the copy (`hwrt.rs:5636-5663`). - larp skips rays with a NaN or t min > t max before `TraceRayInline` (`larp-shader/src/emit/rayquery.rs:194-202`); no such guard was found in Darner's `darner-shader/src/emit/rayquery.rs`. - **Plan:** one new document, `docs/larp-raytracing.md`, with each difference as an item: what larp does, what Darner does, why one is better, and the Darner file a port would change, plus a summary table. Items that are A6 (reserved memory) or track B (replacement shaders, the positions pool) are marked as such and only described. ## Contributor role (optional) - Fluxer ID: `1577752157942198273` ## What it changes - The problem on main: read from the code only. No document compared larp's ray tracing with Darner's; `docs/fork-ray-tracing.md` covers other forks and Darner's own switches, and the new file links it instead of repeating it. - Adds `docs/larp-raytracing.md` (388 lines, eight sections and a summary table). Candidate new C items it finds (staff decide the rows): - 1a: structures built in the title's own blocks, its allocator and frees hooked; - 1b: small structures in shared slabs; - 1c: the title's scratch used; - 2a: format 53 and 16 decoded on the card; - 2b: no per-build copy of plain inputs, keeping a #3706 guard where needed; - 3a: top-level updates honoured; - 4a: real compaction (after 1a); - 5: a smaller remap table (after 1a); - 7b: invalid rays not traced. - Kept as Darner's: the per-frame build budget, procedural geometry and transforms taken at the call. Marked "check only": the rehydrate flags and whether Darner's matcher lifts larp's seven listed programs. - No speed numbers of its own. The only figures are written in the code, with the place named (`hwrt.rs:1130-1141`, `hwrt.rs:1465-1468`, `hwrt.rs:3053-3061`, larp `rt.rs:124-125`); everything else says expected, unknown or not measured. Reasons worked out from the code are marked "inferred". ## How it was tested - Tested revision: 603cc2e76 on Main 33ff92cc4. - Commands and results: - `cargo xtask policy --staged`: "asset policy: 1 files ok". - The quoted figures and a sample of references were checked by hand against both trees: the top-level rebuild (`hwrt.rs:5053-5056`), the compaction answer (`hwrt.rs:5636-5663`), larp's update and allocator notes (`rt.rs:3058-3066`, `rt.rs:29-40`), `ray_valid` (larp `rayquery.rs:194-202`), the 12 builder exports, and the figures at `hwrt.rs:1132`, `1467` and `3060` and larp `rt.rs:125`. - Changes a default: no (documentation only). - Gates run: none (documentation only; no code changed). - Hardware dependence: none (no runs). - Coverage gaps, the claims least sure: - "Darner never sees the arena reuse a range" (1a) is inferred from finding no hook for the arena's frees; `hwrt.rs:1131` says structures "went only when the title freed their memory". - 7b rests on a search of Darner's `rayquery.rs`, not a full read. - That compaction is safe from the #3706 misalignment once 1a lands is inferred from larp's `bvh.rs:196-199`. - Darner's CPU-decode figures are from older runs; how much is left today is not measured. - Whether larp's single barrier pair per call is safe when a top level and its bottom levels are built in one call was not checked. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). Documentation only: nothing to run. - [x] This PR contains one change based on `Main`. - [x] The diff follows `docs/asset-policy.md` (no game data, no shader code). ## Checked for overlap - [x] Searched pull requests for `larp-raytracing`, `C10` and "ray tracing larp": none covers this. Related: #709 edits `docs/fork-ray-tracing.md`, which this file links; no shared file. --- Opened by Cafe's agent, working the ROADMAP unattended (not reviewed by a person before posting). Measured on RTX 2080 Ti, Windows 10, no Resizable BAR (no measurements in this one: documentation only).
Owner

Next task for @cafe: T1d — Small card: today's Darner Main on an 8 GB card (Series X profile, then Series S) and on a PC without Resizable BAR: private bytes, commit, card memory, fps and crash records over 30+ minutes (needs: 8 GB card or no-ReBAR PC, game)

Next task for @cafe: T1d — Small card: today's Darner `Main` on an 8 GB card (Series X profile, then Series S) and on a PC without Resizable BAR: private bytes, commit, card memory, fps and crash records over 30+ minutes (needs: 8 GB card or no-ReBAR PC, game)
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/710/head:cafe/c10-larp-raytracing'
git switch 'cafe/c10-larp-raytracing'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'cafe/c10-larp-raytracing'
git switch 'cafe/c10-larp-raytracing'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'cafe/c10-larp-raytracing'
git switch 'cafe/c10-larp-raytracing'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'cafe/c10-larp-raytracing'
git switch 'Main'
git merge --squash 'cafe/c10-larp-raytracing'
git switch 'Main'
git merge --ff-only 'cafe/c10-larp-raytracing'
git switch 'Main'
git merge 'cafe/c10-larp-raytracing'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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
TrustNo1/Darner!710
No description provided.