startup: count new view records by slot behind an opt-in census #2613

Manually merged
github merged 1 commit from gh-pr/2613/head into gh-pr/2613/base 2026-11-27 01:07:27 +00:00
Owner

@⁠JVProg on GitHub · 2026-11-25 23:20 UTC · original
JVProg:startup/view-record-census → main · +435 −0 · 5 files · 1 commits · merged 2026-11-25 23:29 UTC

Change

X2W_D3D12_VIEW_CENSUS=1 (diagnostic only, off by default) shows which device slot adds view records.

  • New distinct records are counted by slot (17 to 22) and reported in a x2w-view-census distinct by slot: heartbeat line, with the record vector size and capacity and the view_ids size and bucket count.
  • Before an insertion that is expected to grow the vector or the hash buckets, the same fields are logged. The line is written before the allocation, so it is in the log if that allocation fails. The vector prediction uses its capacity; the map prediction uses the MSVC rehash rule. missed counts changes that no line announced.

Record identity (including range, format, stride and flags), ids and descriptor binding do not change. The census counts distinct byte contents, not distinct views. It does not measure container bytes or reduce them.

Not in this PR: record dump, call-stack collection, a record lifetime policy and the worker's allocation-failure recovery.

Refs #1199.

Verification

Base 444bf3a8, Windows 11 build 26300, D3D12 debug layer off (X2W_D3D12_DEBUG=0). The checks ran on the same changes before they were committed.

  • ctest --preset dev --no-tests=error -R "^startup_view_census" -V: 6 of 6 passed, on WARP and on an AMD Radeon RX 9070 XT (driver 32.0.32029.2010). No skips.
    • on: both streams run under a job commit limit 256 MiB above the commit held after setup. The fixture first checks that the limit refuses a larger allocation. The repeated stream added no record and grew nothing. The distinct stream was counted as 200,000 (slot 17), 3,000 (slot 18) and 100 (slot 22) new records; growth lines in the log match the counters (records 31, ids 11) and missed=0.
    • off: nothing is reported or logged without the switch.
    • vary (negative control): the stream meant to repeat changes every call, and the fixture reports FAIL: the repeated stream added records.
  • ctest --preset dev --no-tests=error -R "^(startup_d3d12|startup_resource_retire|docs_links|bidi)": 28 selected, no failures. Capability skips: the six startup_resource_retire*_debug1 cases (227, 230, 245, 248, 251, 255 in this build).
  • ctest --preset pr --no-tests=error, after a full cmake --build --preset dev: 38 selected, no failures. Capability skips: the 14 spirv_*_warp cases (SPIR-V tools not set up locally).
  • python -B tests/docs_links_check.py and python -B tests/bidi_controls_check.py: passed.

Limits: slots 19 to 21 are counted but not exercised by the fixture.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed. (docs/startup-runtime.md)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠JVProg** on GitHub · 2026-11-25 23:20 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2613) `JVProg:startup/view-record-census` → `main` · +435 −0 · 5 files · 1 commits · merged 2026-11-25 23:29 UTC ## Change `X2W_D3D12_VIEW_CENSUS=1` (diagnostic only, off by default) shows which device slot adds view records. - New distinct records are counted by slot (17 to 22) and reported in a `x2w-view-census distinct by slot:` heartbeat line, with the record vector size and capacity and the `view_ids` size and bucket count. - Before an insertion that is expected to grow the vector or the hash buckets, the same fields are logged. The line is written before the allocation, so it is in the log if that allocation fails. The vector prediction uses its capacity; the map prediction uses the MSVC rehash rule. `missed` counts changes that no line announced. Record identity (including range, format, stride and flags), ids and descriptor binding do not change. The census counts distinct byte contents, not distinct views. It does not measure container bytes or reduce them. Not in this PR: record dump, call-stack collection, a record lifetime policy and the worker's allocation-failure recovery. Refs #1199. ## Verification Base `444bf3a8`, Windows 11 build 26300, D3D12 debug layer off (`X2W_D3D12_DEBUG=0`). The checks ran on the same changes before they were committed. - `ctest --preset dev --no-tests=error -R "^startup_view_census" -V`: 6 of 6 passed, on WARP and on an AMD Radeon RX 9070 XT (driver 32.0.32029.2010). No skips. - `on`: both streams run under a job commit limit 256 MiB above the commit held after setup. The fixture first checks that the limit refuses a larger allocation. The repeated stream added no record and grew nothing. The distinct stream was counted as 200,000 (slot 17), 3,000 (slot 18) and 100 (slot 22) new records; growth lines in the log match the counters (records 31, ids 11) and `missed=0`. - `off`: nothing is reported or logged without the switch. - `vary` (negative control): the stream meant to repeat changes every call, and the fixture reports `FAIL: the repeated stream added records`. - `ctest --preset dev --no-tests=error -R "^(startup_d3d12|startup_resource_retire|docs_links|bidi)"`: 28 selected, no failures. Capability skips: the six `startup_resource_retire*_debug1` cases (227, 230, 245, 248, 251, 255 in this build). - `ctest --preset pr --no-tests=error`, after a full `cmake --build --preset dev`: 38 selected, no failures. Capability skips: the 14 `spirv_*_warp` cases (SPIR-V tools not set up locally). - `python -B tests/docs_links_check.py` and `python -B tests/bidi_controls_check.py`: passed. Limits: slots 19 to 21 are counted but not exercised by the fixture. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. (`docs/startup-runtime.md`) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
X2W_D3D12_VIEW_CENSUS=1 counts new distinct view records by device slot
and logs the record vector capacity and hash bucket count before an
insertion that is expected to grow either. Record identity, ids and
descriptor binding do not change.

Refs #1199

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:07:25 +00:00
github manually merged commit c3c8532a68 into gh-pr/2613/base 2026-11-27 01:07:27 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 23:26 UTC · original · reviewed

Review of head c3c8532a (comment only).

Result: no blocking findings in the code.

Checked:

  • The census is off unless X2W_D3D12_VIEW_CENSUS is set. With it unset, note_view only reads the cached flag, so record identity, ids and descriptor binding do not change.
  • Counters and the pre-growth lines are written with note_lock held. The heartbeat reader takes the lock shared. Slot index slot - 17 is range-checked.
  • The log line is written before push_back, so it survives a failed allocation. missed catches growth that no line announced.
  • Sibling code: the new env flag uses the same x2w_local::env_on as the other opt-in flags. Docs section added in docs/startup-runtime.md. No other open or merged PR adds this census (searched "view census").
  • This is a diagnostic only and does not claim to advance startup, so there is no executable result to verify.

Commands run (Linux, exact head in a worktree):

  • git diff --check origin/main...HEAD: clean
  • python3 tests/docs_links_check.py: 507 links ok
  • python3 tests/bidi_controls_check.py: ok
  • The new test startup_view_census is a Windows C++ fixture. It cannot run on Linux, so the Windows run is done separately and its receipt will follow.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 23:26 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2613#pullrequestreview-6066395267) · **reviewed** Review of head c3c8532a (comment only). Result: no blocking findings in the code. Checked: - The census is off unless `X2W_D3D12_VIEW_CENSUS` is set. With it unset, `note_view` only reads the cached flag, so record identity, ids and descriptor binding do not change. - Counters and the pre-growth lines are written with `note_lock` held. The heartbeat reader takes the lock shared. Slot index `slot - 17` is range-checked. - The log line is written before `push_back`, so it survives a failed allocation. `missed` catches growth that no line announced. - Sibling code: the new env flag uses the same `x2w_local::env_on` as the other opt-in flags. Docs section added in `docs/startup-runtime.md`. No other open or merged PR adds this census (searched "view census"). - This is a diagnostic only and does not claim to advance startup, so there is no executable result to verify. Commands run (Linux, exact head in a worktree): - `git diff --check origin/main...HEAD`: clean - `python3 tests/docs_links_check.py`: 507 links ok - `python3 tests/bidi_controls_check.py`: ok - The new test `startup_view_census` is a Windows C++ fixture. It cannot run on Linux, so the Windows run is done separately and its receipt will follow. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 23:28 UTC · original

Win2025 WARP receipt for head c3c8532a.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit c3c8532a6884d1187fb8156004865b966499c380:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_view_census -- -j 2): 1.42s (configure 0.00s)
    • Test (ctest --preset dev -R '^startup_view_census' --parallel 4 --no-tests=error --output-on-failure): 6/6 passed (1.30s: startup_view_census_off_warp 0.15s, startup_view_census_off_hardware 0.08s, startup_view_census_vary_warp 0.85s, startup_view_census_vary_hardware 0.69s, startup_view_census_warp 1.07s, startup_view_census_hardware 1.17s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_view_census -- -j 2): 1.31s (configure 0.00s)
    • Test (ctest --preset release -R '^startup_view_census' --parallel 4 --no-tests=error --output-on-failure): 6/6 passed (0.65s: startup_view_census_off_warp 0.24s, startup_view_census_off_hardware 0.04s, startup_view_census_vary_warp 0.37s, startup_view_census_warp 0.47s, startup_view_census_hardware 0.52s, startup_view_census_vary_hardware 0.25s)
  • sccache: 6/6 hits; wall 8.4s

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 23:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2613#issuecomment-7177621222) Win2025 WARP receipt for head c3c8532a. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `c3c8532a6884d1187fb8156004865b966499c380`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_view_census -- -j 2`): `1.42s` (configure `0.00s`) - Test (`ctest --preset dev -R '^startup_view_census' --parallel 4 --no-tests=error --output-on-failure`): **6/6 passed** (`1.30s`: `startup_view_census_off_warp` `0.15s`, `startup_view_census_off_hardware` `0.08s`, `startup_view_census_vary_warp` `0.85s`, `startup_view_census_vary_hardware` `0.69s`, `startup_view_census_warp` `1.07s`, `startup_view_census_hardware` `1.17s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_view_census -- -j 2`): `1.31s` (configure `0.00s`) - Test (`ctest --preset release -R '^startup_view_census' --parallel 4 --no-tests=error --output-on-failure`): **6/6 passed** (`0.65s`: `startup_view_census_off_warp` `0.24s`, `startup_view_census_off_hardware` `0.04s`, `startup_view_census_vary_warp` `0.37s`, `startup_view_census_warp` `0.47s`, `startup_view_census_hardware` `0.52s`, `startup_view_census_vary_hardware` `0.25s`) - `sccache`: 6/6 hits; wall `8.4s` AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.