native: count the descriptor records remirrored at submission (VICTORY_TRACE_DESCRIPTORS) #119

Manually merged
github merged 1 commit from github-bot/gh-119 into main 2026-11-26 18:09:26 +00:00 AGit
Owner

@⁠Olima34 on GitHub · 2026-11-26 17:24 UTC · original
Olima34:feat/trace-descriptor-remirror → main · +167 −0 · 5 files · 1 commits · merged 2026-11-26 18:09 UTC

First measuring PR for #43, as you suggested: how many descriptor records the title rewrites with plain stores, which no device call reports.

What. NativeHost::remirror_tables already compares each bound table's records with those it last mirrored, at every draw and dispatch. With VICTORY_TRACE_DESCRIPTORS set (any value):

  • it counts, per heap (keyed by its first descriptor address), the records it checked and those it found different;
  • NativeHost::execute counts submissions with a drop guard (error returns too), and the most records changed in one submission;
  • the 64-frame frame log (native draws so far) is followed by a descriptor remirror line: changed and checked since the last line, per frame, submissions, most in one submission, and the heaps sorted by records changed.

Off, the cost is one OnceLock read per table remirror and per submission.

Limits (in the doc bullet).

  • It sees only what that check sees: the first 16 entries per bound table, or more when the metadata says so.
  • It does not say which code wrote the records.
  • A record seen for the first time counts as changed, so the first lines after a load are high; the steady-state lines are the ones to read.

Next. A second PR finds the store sites themselves:

  • write-protect the pages of the shader-visible heaps between submissions;
  • on a write fault, record the title RIP (as an image offset) when the address is inside a descriptor range;
  • unprotect the page and resume the store. Host and HLE writes, and title stores that only share the page, are let through the same way.
    That answers "how many patch sites". I'll post it separately so this one stays small.

Test. native::descriptor_trace::tests::counts_add_up_by_heap_and_submission checks per-heap sums, the most per submission, the summary text and the sort order.

victory-gpu tests (arm64), Windows clippy and cargo xtask policy pass. One unrelated flake showed up once and passed on two reruns: texture_tests::a_texture_uploaded_blank_is_probed_at_each_submission, under a full parallel run. It shares the global title with other tests.

**@⁠Olima34** on GitHub · 2026-11-26 17:24 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/119) `Olima34:feat/trace-descriptor-remirror` → `main` · +167 −0 · 5 files · 1 commits · merged 2026-11-26 18:09 UTC First measuring PR for #43, as you suggested: how many descriptor records the title rewrites with plain stores, which no device call reports. **What.** `NativeHost::remirror_tables` already compares each bound table's records with those it last mirrored, at every draw and dispatch. With `VICTORY_TRACE_DESCRIPTORS` set (any value): - it counts, per heap (keyed by its first descriptor address), the records it checked and those it found different; - `NativeHost::execute` counts submissions with a drop guard (error returns too), and the most records changed in one submission; - the 64-frame frame log (`native draws so far`) is followed by a `descriptor remirror` line: changed and checked since the last line, per frame, submissions, most in one submission, and the heaps sorted by records changed. Off, the cost is one `OnceLock` read per table remirror and per submission. **Limits (in the doc bullet).** - It sees only what that check sees: the first 16 entries per bound table, or more when the metadata says so. - It does not say which code wrote the records. - A record seen for the first time counts as changed, so the first lines after a load are high; the steady-state lines are the ones to read. **Next.** A second PR finds the store sites themselves: - write-protect the pages of the shader-visible heaps between submissions; - on a write fault, record the title RIP (as an image offset) when the address is inside a descriptor range; - unprotect the page and resume the store. Host and HLE writes, and title stores that only share the page, are let through the same way. That answers "how many patch sites". I'll post it separately so this one stays small. **Test.** `native::descriptor_trace::tests::counts_add_up_by_heap_and_submission` checks per-heap sums, the most per submission, the summary text and the sort order. victory-gpu tests (arm64), Windows clippy and `cargo xtask policy` pass. One unrelated flake showed up once and passed on two reruns: `texture_tests::a_texture_uploaded_blank_is_probed_at_each_submission`, under a full parallel run. It shares the global title with other tests.
#43 asks how many descriptor records the title rewrites with plain
stores, which no device call reports. NativeHost::remirror_tables
already compares each bound table's records with those it last mirrored
at every draw and dispatch. With VICTORY_TRACE_DESCRIPTORS set, it now
counts per heap the records it checked and those it found changed, and
per submission the most changed; the frame log adds a "descriptor
remirror" line with the counts since its last line. Off, the cost is one
read of the switch per table and per submission.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 17:26:51 +00:00
github manually merged commit e37de12ad2 into main 2026-11-26 18:09:26 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-26 18:09 UTC · original

Merged together with #127, which builds on it, thanks.

**@⁠LakshanSivakumar** on GitHub · 2026-11-26 18:09 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/119#issuecomment-7200126595) Merged together with #127, which builds on it, thanks.
This discussion has been locked. Commenting is limited to contributors.
No description provided.