d3d12-docs: record LEONIDA_CONSTANTS_ONCE measurements in findings.md #2888

Merged
lixonik merged 3 commits from upstream-pr/2888 into main 2026-12-02 18:41:43 +00:00
lixonik commented 2026-12-01 15:31:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-01T15:31:09Z.


Claimed in the coordination issue as: D3D12-CONSTANTS-ONCE-DOCS (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7315907475)

What and why

Follow-up requested when closing #2850 (whose code landed in 357c71023):

  • Adds the Table constant buffers filled once per list (2026-12-01) measurements from #2850 (RTX 3080 10 GB) and the independent RTX 5070 12 GB (621.40) LEONIDA_AB=20,LEONIDA_CONSTANTS_ONCE check to d3d12/docs/findings.md.
  • Regenerates d3d12/docs/switches.md via python -I tools/d3d12_switches.py --out d3d12/docs/switches.md so the F ("named in findings.md") column on LEONIDA_CONSTANTS_ONCE updates to yes (while the LEONIDA_CONSTANTS_ONCE row itself was already present on main).

Tested

  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md: passed
  • python -m unittest discover -s tests -p "test_docs_*.py" -v: 57 passed, 0 failed
  • python -I scripts/check_no_game_data.py: clean

GPUs tested: n/a (documentation-only; references measured results from #2850 on RTX 3080 10 GB driver 32.0.16.2140 and RTX 5070 12 GB driver 621.40 / Windows 10 22H2)

AI-assisted: Antigravity (plus separate read-only reviewer subagent)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5588899409 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2888). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-01T15:31:09Z. --- Claimed in the coordination issue as: `D3D12-CONSTANTS-ONCE-DOCS` (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7315907475) ### What and why Follow-up requested when closing #2850 (whose code landed in `357c71023`): - Adds the `Table constant buffers filled once per list (2026-12-01)` measurements from #2850 (RTX 3080 10 GB) and the independent RTX 5070 12 GB (`621.40`) `LEONIDA_AB=20,LEONIDA_CONSTANTS_ONCE` check to `d3d12/docs/findings.md`. - Regenerates `d3d12/docs/switches.md` via `python -I tools/d3d12_switches.py --out d3d12/docs/switches.md` so the `F` ("named in findings.md") column on `LEONIDA_CONSTANTS_ONCE` updates to `yes` (while the `LEONIDA_CONSTANTS_ONCE` row itself was already present on `main`). ### Tested - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md`: passed - `python -m unittest discover -s tests -p "test_docs_*.py" -v`: **57 passed, 0 failed** - `python -I scripts/check_no_game_data.py`: clean GPUs tested: n/a (documentation-only; references measured results from #2850 on RTX 3080 10 GB driver 32.0.16.2140 and RTX 5070 12 GB driver 621.40 / Windows 10 22H2) AI-assisted: Antigravity (plus separate read-only reviewer subagent) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
KelboLive commented 2026-12-01 17:40:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T17:40:10Z.

Review: COMMENTED


Mechanism and figures check out: LEONIDA_CONSTANTS_ONCE is the toggled! at host.rs:9636, reuse is keyed on (src, len) and re-points via add_slot (host.rs:9629-9664), invalidation is title_written (host.rs:3624-3631), and FillTo::Slots really does re-point every slot at one place (card_steps.rs:645-647, :1185-1189) — bytes read once, no barrier change claimed or made. The 3080/5070 deltas match #2850 and its 5070 comment, and the merged tree's switches.md regenerates clean.

One arithmetic nit: 3,327 / 11,578 = 28.7 %, not 28.8 %. If 28.8 % is the median of per-frame ratios, say so; and note 1.6 MB is 27.6 % of 5.8 MB, so the parenthetical is a count share, not a byte share — as written it invites the wrong comparison.

Four small completeness fixes for a measurement record:

  • state the sign convention ("on minus off"), and give −0.85 its unit;
  • include the 5070's dropped pairs (4 of 9 valid, 5 dropped for draw jumps);
  • add the 3080's OS (the 5070 line says Windows 10 22H2; #2850 says the 3080 is Windows 11);
  • the 3080 paragraph omits the measured card_steps −0.16 that the 5070 paragraph includes.

Minor: −0.77 idle and 30.5 busy are per-arm means, not paired deltas — worth labelling so they aren't read as a 13-pair result.

CI: both red checks are the five Python tests main fixed in 9b7674d64 at 15:54Z, after this run started; they pass on the merged tree, so a re-run should clear them. Merge is clean, and findings.md's other open editors (#2847, #2743) do not share a hunk with this append.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6136642209 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2888#pullrequestreview-6136642209). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T17:40:10Z. **Review:** COMMENTED --- Mechanism and figures check out: `LEONIDA_CONSTANTS_ONCE` is the `toggled!` at `host.rs:9636`, reuse is keyed on `(src, len)` and re-points via `add_slot` (`host.rs:9629-9664`), invalidation is `title_written` (`host.rs:3624-3631`), and `FillTo::Slots` really does re-point every slot at one place (`card_steps.rs:645-647`, `:1185-1189`) — bytes read once, no barrier change claimed or made. The 3080/5070 deltas match #2850 and its 5070 comment, and the merged tree's `switches.md` regenerates clean. One arithmetic nit: **3,327 / 11,578 = 28.7 %, not 28.8 %**. If 28.8 % is the median of per-frame ratios, say so; and note 1.6 MB is 27.6 % of 5.8 MB, so the parenthetical is a count share, not a byte share — as written it invites the wrong comparison. Four small completeness fixes for a measurement record: - state the sign convention ("on minus off"), and give `−0.85` its unit; - include the 5070's dropped pairs (4 of 9 valid, 5 dropped for draw jumps); - add the 3080's OS (the 5070 line says Windows 10 22H2; #2850 says the 3080 is Windows 11); - the 3080 paragraph omits the measured `card_steps −0.16` that the 5070 paragraph includes. Minor: `−0.77` idle and `30.5` busy are per-arm means, not paired deltas — worth labelling so they aren't read as a 13-pair result. CI: both red checks are the five Python tests main fixed in `9b7674d64` at 15:54Z, after this run started; they pass on the merged tree, so a re-run should clear them. Merge is clean, and `findings.md`'s other open editors (#2847, #2743) do not share a hunk with this append.
lixonik commented 2026-12-01 20:51:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-12-01T20:51:56Z.


@KelboLive Thanks for checking every number against #2850! Addressed all items in d8de91272 and merged origin/main so CI picks up the Python test fixes:

  • Corrected 3,327 / 11,578 to 28.7 % of fills; 1.6 MB so the count share is exact and clearly distinguished from the byte share.
  • Added the sign convention (on minus off), the ms unit on -0.85 ms, the 3080 OS (Windows 11), and the 3080 card_steps delta (-0.16 ms).
  • Labeled the 3080 card idle (7.21 ms off to 6.44 ms on, -0.77 ms) and card busy (30.49 ms off vs 30.48 ms on) numbers explicitly as per-arm means (14 phases each).
  • Added the RTX 5070 dropped-pair count (4 of 9 pairs valid, 5 dropped for draw jumps).

Re-verified tools/d3d12_switches.py --check d3d12/docs/switches.md, test_d3d12_switches.py (19/19), test_docs_*.py (57/57), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7325390134 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2888#issuecomment-7325390134). Originally posted by [lixonik](https://github.com/lixonik) on 2026-12-01T20:51:56Z. --- @KelboLive Thanks for checking every number against #2850! Addressed all items in `d8de91272` and merged `origin/main` so CI picks up the Python test fixes: - Corrected `3,327 / 11,578` to `28.7 % of fills; 1.6 MB` so the count share is exact and clearly distinguished from the byte share. - Added the sign convention (`on minus off`), the `ms` unit on `-0.85 ms`, the 3080 OS (`Windows 11`), and the 3080 `card_steps` delta (`-0.16 ms`). - Labeled the 3080 card idle (`7.21 ms off to 6.44 ms on, -0.77 ms`) and card busy (`30.49 ms off vs 30.48 ms on`) numbers explicitly as per-arm means (14 phases each). - Added the RTX 5070 dropped-pair count (`4 of 9 pairs valid, 5 dropped for draw jumps`). Re-verified `tools/d3d12_switches.py --check d3d12/docs/switches.md`, `test_d3d12_switches.py` (19/19), `test_docs_*.py` (57/57), and `scripts/check_no_game_data.py`.
imShangLi commented 2026-12-02 05:32:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-02T05:32:35Z.


VERIFY-2888 — Linux, Fedora 45, no GPU device, no game files, no title

Verdict: PASS. Records a LEONIDA_CONSTANTS_ONCE measurement in d3d12/docs/findings.md and marks the switch "named in findings" (F = yes) in the generated d3d12/docs/switches.md. Every checkable claim matches the code — including the code's own comment at host.rs:9832, which records the same measurement with the same figures — and the hand-edit to switches.md is byte-identical to what tools/d3d12_switches.py regenerates for that row. The measurements themselves are not reproducible here.

Head d8de9127, base current main (8422def7), merge base 1e3e316c, 2 files, +20/−1: d3d12/docs/findings.md (+19), d3d12/docs/switches.md (+1/−1, one cell).

1. What it changes

  • d3d12/docs/findings.md: a new ## Table constant buffers filled once per list (2026-12-01) section describing the per-draw constant-buffer-view fills (11,578 fills/frame, 3,327 first of their bytes), what LEONIDA_CONSTANTS_ONCE does about them, the measured gains on an RTX 3080 (driver 32.0.16.2140) and an independent RTX 5070 (driver 621.40) check.
  • d3d12/docs/switches.md: the LEONIDA_CONSTANTS_ONCE row's F column (named in findings.md) changes from blank to yes.

2. The claims it makes, and which ones I checked

  • LEONIDA_CONSTANTS_ONCE, on by default, 0 turns it off — checked. host.rs:9832 "With LEONIDA_CONSTANTS_ONCE (on by default; 0: one fill each, as before)"; switches.md "on, 0 turns it off".
  • HostList::constants — checked. host.rs:3753 field constants: HashMap<...>, doc "Table constant buffers [HostList::constants] filled since the list"; the constants() fn at host.rs:9834.
  • FillTo::Slots — checked. host/card_steps.rs:190 variant Slots(Vec<(usize, u32)>); fill_tos() maps each slot to a To::Slot, i.e. the card re-points every slot of a fill it takes — consistent with the doc.
  • LEONIDA_CARD_STEPS=2 — checked. host/card_steps.rs:79 reads it; :360 "LEONIDA_CARD_STEPS=2 does it on the card".
  • constants_line frame-meter count — checked. host.rs:5717 fn constants_line, "For the frame-rate line"; it prints "table constant buffers filled per frame: {:.0} ({:.0} KB), {:.0} of them the first of their bytes in their list ({:.1} %, {:.0} KB)" — matching the doc's fills/KB/first/%/KB format.
  • frame-meter line names copies_fills_ms, steps_ms, card_steps_ms — checked. These are the millisecond form of the SPLIT_NAMES entries copies_fills_ns, steps_ns, card_steps_ns (host.rs:11139, :11132, :11141), which the frame-rate A/B line prints. Consistent.
  • -NoFrameGen — checked. d3d12/scripts/play-nvidia.ps1:76 [switch]$NoFrameGen.
  • The measurement numbers agree with the code's own comment — checked. host.rs:9832 records the same measurement: "Standing in the world, 71 % of these fills repeated bytes already filled in their list (11,600 a frame, 5.8 MB; 3,300 and 1.6 MB the first of theirs; RTX 3080, 2026-12-01). Switched every 20 s in one run (13 pairs): the lists' steps on the submitting thread -0.99 ms a frame, its copies and fills -0.85, the card idle behind it -0.77, the frame's median -0.39 (+-0.14); the card's work the same." The doc gives the same figures with more precision (11,578/3,327 vs the code's rounded 11,600/3,300; 28.7 % first vs 100−71 = 29 %). No contradiction.
  • switches.md F cell — checked. tools/d3d12_switches.py sets F = yes when findings.md names the switch; regenerating the page from the PR's sources produces the exact committed LEONIDA_CONSTANTS_ONCE row (F = yes, same Named in and same words). The hand-edit matches the generator.

3. What the tests do here

  • python3 -I -m unittest discover -s tests -p "test_docs_*.py" — 57 tests, all pass (43.1 s).
  • python3 -I scripts/check_no_game_data.py d3d12/docs/findings.md d3d12/docs/switches.md — exit 0.
  • python3 -I scripts/red_green.py 2888 --no-cargo — "red not constructible: the pull request changes no test" (expected for a docs-only change).
  • git merge-tree --write-tree origin/main pr2888 — merges cleanly.

4. Anything wrong in the text

  • Nothing wrong introduced by the PR. The new ## ... (2026-12-01) heading, **bold** lead-ins and 4-space code/table blocks match findings.md's conventions; the section is appended before the end of the file (no table of contents to update); the repeated-line docs test passes (no duplicated lines).
  • One pre-existing observation, not this PR's fault: the branch is based on an older main, so its committed switches.md still names LEONIDA_RENDER_SCALE_MIN in leonida-loader/hooks.rs while current main (after a later regeneration) names it in leonida-gpu/host/menu.rs. This does not affect the PR's own edit and merges cleanly (merge-tree exit 0); it only means the branch predates that regeneration.

5. What I did not check

  • The measurements themselves: the per-frame fill counts and the on/off deltas on the RTX 3080 (driver 32.0.16.2140) and the RTX 5070 (driver 621.40). These need those cards/drivers. I cross-checked them against the code's own comment (host.rs:9832) rather than re-measuring.
  • The "(from #2850)" context reference — I cannot read PR #2850 (no GitHub access); I verified only that the repo otherwise references it nowhere else.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7336042129 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2888#issuecomment-7336042129). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-12-02T05:32:35Z. --- ## VERIFY-2888 — Linux, Fedora 45, no GPU device, no game files, no title **Verdict: PASS.** Records a `LEONIDA_CONSTANTS_ONCE` measurement in `d3d12/docs/findings.md` and marks the switch "named in findings" (F = yes) in the generated `d3d12/docs/switches.md`. Every checkable claim matches the code — including the code's own comment at `host.rs:9832`, which records the same measurement with the same figures — and the hand-edit to `switches.md` is byte-identical to what `tools/d3d12_switches.py` regenerates for that row. The measurements themselves are not reproducible here. Head `d8de9127`, base current `main` (`8422def7`), merge base `1e3e316c`, 2 files, +20/−1: `d3d12/docs/findings.md` (+19), `d3d12/docs/switches.md` (+1/−1, one cell). ### 1. What it changes - `d3d12/docs/findings.md`: a new `## Table constant buffers filled once per list (2026-12-01)` section describing the per-draw constant-buffer-view fills (11,578 fills/frame, 3,327 first of their bytes), what `LEONIDA_CONSTANTS_ONCE` does about them, the measured gains on an RTX 3080 (driver 32.0.16.2140) and an independent RTX 5070 (driver 621.40) check. - `d3d12/docs/switches.md`: the `LEONIDA_CONSTANTS_ONCE` row's **F** column (named in findings.md) changes from blank to `yes`. ### 2. The claims it makes, and which ones I checked - **`LEONIDA_CONSTANTS_ONCE`, on by default, `0` turns it off** — checked. `host.rs:9832` "With `LEONIDA_CONSTANTS_ONCE` (on by default; `0`: one fill each, as before)"; `switches.md` "on, `0` turns it off". - **`HostList::constants`** — checked. `host.rs:3753` field `constants: HashMap<...>`, doc "Table constant buffers [`HostList::constants`] filled since the list"; the `constants()` fn at `host.rs:9834`. - **`FillTo::Slots`** — checked. `host/card_steps.rs:190` variant `Slots(Vec<(usize, u32)>)`; `fill_tos()` maps each slot to a `To::Slot`, i.e. the card re-points every slot of a fill it takes — consistent with the doc. - **`LEONIDA_CARD_STEPS=2`** — checked. `host/card_steps.rs:79` reads it; `:360` "LEONIDA_CARD_STEPS=2 does it on the card". - **`constants_line` frame-meter count** — checked. `host.rs:5717` `fn constants_line`, "For the frame-rate line"; it prints "table constant buffers filled per frame: {:.0} ({:.0} KB), {:.0} of them the first of their bytes in their list ({:.1} %, {:.0} KB)" — matching the doc's fills/KB/first/%/KB format. - **frame-meter line names `copies_fills_ms`, `steps_ms`, `card_steps_ms`** — checked. These are the millisecond form of the `SPLIT_NAMES` entries `copies_fills_ns`, `steps_ns`, `card_steps_ns` (`host.rs:11139`, `:11132`, `:11141`), which the frame-rate A/B line prints. Consistent. - **`-NoFrameGen`** — checked. `d3d12/scripts/play-nvidia.ps1:76` `[switch]$NoFrameGen`. - **The measurement numbers agree with the code's own comment** — checked. `host.rs:9832` records the same measurement: "Standing in the world, 71 % of these fills repeated bytes already filled in their list (11,600 a frame, 5.8 MB; 3,300 and 1.6 MB the first of theirs; RTX 3080, 2026-12-01). Switched every 20 s in one run (13 pairs): the lists' steps on the submitting thread -0.99 ms a frame, its copies and fills -0.85, the card idle behind it -0.77, the frame's median -0.39 (+-0.14); the card's work the same." The doc gives the same figures with more precision (11,578/3,327 vs the code's rounded 11,600/3,300; 28.7 % first vs 100−71 = 29 %). No contradiction. - **`switches.md` F cell** — checked. `tools/d3d12_switches.py` sets F = yes when findings.md names the switch; regenerating the page from the PR's sources produces the exact committed `LEONIDA_CONSTANTS_ONCE` row (F = yes, same `Named in` and same words). The hand-edit matches the generator. ### 3. What the tests do here - `python3 -I -m unittest discover -s tests -p "test_docs_*.py"` — 57 tests, all pass (43.1 s). - `python3 -I scripts/check_no_game_data.py d3d12/docs/findings.md d3d12/docs/switches.md` — exit 0. - `python3 -I scripts/red_green.py 2888 --no-cargo` — "red not constructible: the pull request changes no test" (expected for a docs-only change). - `git merge-tree --write-tree origin/main pr2888` — merges cleanly. ### 4. Anything wrong in the text - Nothing wrong introduced by the PR. The new `## ... (2026-12-01)` heading, `**bold**` lead-ins and 4-space code/table blocks match findings.md's conventions; the section is appended before the end of the file (no table of contents to update); the repeated-line docs test passes (no duplicated lines). - One pre-existing observation, not this PR's fault: the branch is based on an older `main`, so its committed `switches.md` still names `LEONIDA_RENDER_SCALE_MIN` in `leonida-loader/hooks.rs` while current `main` (after a later regeneration) names it in `leonida-gpu/host/menu.rs`. This does not affect the PR's own edit and merges cleanly (`merge-tree` exit 0); it only means the branch predates that regeneration. ### 5. What I did not check - The measurements themselves: the per-frame fill counts and the on/off deltas on the RTX 3080 (driver 32.0.16.2140) and the RTX 5070 (driver 621.40). These need those cards/drivers. I cross-checked them against the code's own comment (`host.rs:9832`) rather than re-measuring. - The "(from #2850)" context reference — I cannot read PR #2850 (no GitHub access); I verified only that the repo otherwise references it nowhere else.
MoonEyes commented 2026-12-02 18:01:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:01:05Z.


Verified on Linux: head d8de91272 merged into current main 45dc41f95 (clean merge; findings.md and switches.md auto-merged). Documentation only. Ready.

merge base 1e3e316c5 (340 commits behind main)
python -I tools/d3d12_switches.py --check d3d12/docs/switches.md        exit 0 (the "F = yes" column regenerates the same)
python -I scripts/check_no_game_data.py d3d12/docs/findings.md d3d12/docs/switches.md   exit 0

Checked the arithmetic in the new section: 3,327 / 11,578 = 28.7 % of fills, as written. The second run's whole-frame median (-0.175 +- 0.411 ms) is correctly called "no clear difference" rather than a gain; the per-phase deltas on the submitting thread are what both runs agree on. LEONIDA_CONSTANTS_ONCE is still on by default in HostList::constants, matching the text. CI on the head is green.

No code, so no red/green. This agrees with @imShangLi's PASS on the same head; nothing has been pushed since.

Verdict: ready.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353864480 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2888#issuecomment-7353864480). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:01:05Z. --- **Verified on Linux: head `d8de91272` merged into current `main` `45dc41f95` (clean merge; `findings.md` and `switches.md` auto-merged). Documentation only. Ready.** ``` merge base 1e3e316c5 (340 commits behind main) python -I tools/d3d12_switches.py --check d3d12/docs/switches.md exit 0 (the "F = yes" column regenerates the same) python -I scripts/check_no_game_data.py d3d12/docs/findings.md d3d12/docs/switches.md exit 0 ``` Checked the arithmetic in the new section: 3,327 / 11,578 = 28.7 % of fills, as written. The second run's whole-frame median (-0.175 +- 0.411 ms) is correctly called "no clear difference" rather than a gain; the per-phase deltas on the submitting thread are what both runs agree on. `LEONIDA_CONSTANTS_ONCE` is still on by default in `HostList::constants`, matching the text. CI on the head is green. No code, so no red/green. This agrees with @imShangLi's PASS on the same head; nothing has been pushed since. **Verdict: ready.** AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2888
No description provided.