startup: look up memory SRV resources through an address index #2335

Merged
NiiRoZz merged 1 commit from upstream-pr/2343 into main 2026-11-25 14:09:59 +00:00
NiiRoZz commented 2026-11-25 12:59:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T12:59:14Z.


Change

The table of noted resources (resource_infos) is never pruned, and the wrappers live for the process. Four by-address lookups
(existing_memory_texture, address_resource_overlap, gpu_written_overlap, existing_memory_buffer) walked all of it under
the shared note_lock on every slot 70 call. Every note_view/note_copy writer waited behind that walk.

  • src/startup_stubs/resource_address_index.h keeps resources by the title memory they start at. It only narrows the candidates:
    each lookup still applies its original predicate and live-reference filter (refs <= 0 skipped, placement checks) to them,
    so the answers are unchanged, including "two live matches means none". Wrapper lifetime behavior is unchanged: no process
    exit, no new flag, no change to AddRef/QueryInterface.
  • Entries stay as long as the canonical record does, and the table is never pruned. Nothing is erased at release; a released
    wrapper is skipped by the lookup's filter and found again if it is referenced again. A separate lifetime policy can decide
    later when entries may go.
  • note_resource stores the record and the index entry as one step (store_indexed): the index node is allocated first, then
    the record is updated; if that throws, the new index node is erased, so the record and the index are both new or both old.
    Re-noting a resource replaces its entry (new node before the old one is dropped).
  • Slot 133 inserts into the index inside the same exclusive note_lock hold that publishes the placement (an optional hook
    argument of publish_placement; a throw undoes the record and the placement node).
  • X2W_RESOURCE_INDEX_CHECK accepts only 1 and 2; any other value is off. =1 checks on every memory SRV call that each
    live resource with title memory is in the index (the shared lock is released through every path, the process ends after).
    =2 skips the index inserts: startup_resource_address_index_missing_control_warp passes only if the check reports it.
  • Test startup_resource_address_index compares the index with a full scan (180,000 lookups) across release, re-reference,
    address reuse (dead entries plus live ones at one base), overlapping live ranges, re-notes with another size, unaligned bases,
    and directed edges (a base at address + span - 1 is found, at address + span is not). It injects allocation failures
    (replaced operator new, as startup_placement_alloc does) into store_indexed for a new key and a re-note and checks the
    record and the index stay in step. Controls that must fail: --mutate skip (one insert dropped) and --mutate unsync
    (index insert first, left behind when the record update fails). Moving the forward loop bound by one (it->first + 1 < to)
    also fails the test (checked by hand, not a registered test).

AI-assisted (Claude Code).

Verification

Base 214ed093 (origin/main), head c647f84d (single commit). Windows 11 build 26300.

  • cmake --build --preset dev: clean.
  • ctest --preset dev --no-tests=error --timeout 120 -R '^(startup_(address_[a-z_0-9]*_warp|address_srv_warp|memory_srv[a-z_0-9-]*|placement_[a-z_]*|resource_address_index[a-z_]*|indirect_(dispatch|draw|draw_indexed|translated_indexed|requests)_warp|list_copy_warp)|era_heap_[a-z_]*|offscreen_warp)$':
    40 passed, 0 skipped, 0 failed (ctest reports no skips).
  • The same command with X2W_RESOURCE_INDEX_CHECK=1 in the environment: 40 passed, 0 skipped, 0 failed.
  • python -B tests/docs_links_check.py, python -B tests/bidi_controls_check.py: pass. git diff --check: clean.
  • Adapters: WARP for the _warp tests; the hardware test in the selection (startup_memory_srv_diag_hardware) ran on a
    physical GPU (adapter, driver and debug-layer status are printed by the test, not recorded here).

Local observation, measured on the earlier revision of this change that erased entries at the last release (one local run each, instrumented build, not reproducible from the repository; the two runs reached different
scenes and the shader cache differed, so this is not a clean A/B): the mean cost of the by-address SRV call fell from about
100 us (0.8 M calls, 80.6 s) to about 8.5 us (3.28 M calls, 27.8 s) over the same 100 s window. Before the change the median
scan cost grew from about 45 us to about 120 us as the table grew. No frame-rate claim is made.

Limits

  • The index grows with the never-pruned table, and dead entries at a reused address are still visited and filtered, so lookup
    cost at a heavily reused address grows with the reuse count.
  • The table itself is still never pruned; only the lookups stopped walking all of it.
  • The failure control injects into store_indexed and the header's index; the glue in note_resource and the slot 133 hook is
    covered by the existing placement tests and the check mode, not by a device-level allocation-failure test.
  • The equivalence test uses synthetic resources; the check mode compares presence in the index only, not lookup answers, on
    real calls.
  • Fixtures only; this does not show full-title startup.

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. None changed; I found no docs/experiments.md row
    convention for runtime lookup performance changes, so none was added.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code); the commands above were run locally.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6605031653 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2343). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T12:59:14Z. --- ## Change The table of noted resources (`resource_infos`) is never pruned, and the wrappers live for the process. Four by-address lookups (`existing_memory_texture`, `address_resource_overlap`, `gpu_written_overlap`, `existing_memory_buffer`) walked all of it under the shared `note_lock` on every slot 70 call. Every `note_view`/`note_copy` writer waited behind that walk. - `src/startup_stubs/resource_address_index.h` keeps resources by the title memory they start at. It only narrows the candidates: each lookup still applies its original predicate and live-reference filter (`refs <= 0` skipped, placement checks) to them, so the answers are unchanged, including "two live matches means none". Wrapper lifetime behavior is unchanged: no process exit, no new flag, no change to `AddRef`/`QueryInterface`. - Entries stay as long as the canonical record does, and the table is never pruned. Nothing is erased at release; a released wrapper is skipped by the lookup's filter and found again if it is referenced again. A separate lifetime policy can decide later when entries may go. - `note_resource` stores the record and the index entry as one step (`store_indexed`): the index node is allocated first, then the record is updated; if that throws, the new index node is erased, so the record and the index are both new or both old. Re-noting a resource replaces its entry (new node before the old one is dropped). - Slot 133 inserts into the index inside the same exclusive `note_lock` hold that publishes the placement (an optional hook argument of `publish_placement`; a throw undoes the record and the placement node). - `X2W_RESOURCE_INDEX_CHECK` accepts only `1` and `2`; any other value is off. `=1` checks on every memory SRV call that each live resource with title memory is in the index (the shared lock is released through every path, the process ends after). `=2` skips the index inserts: `startup_resource_address_index_missing_control_warp` passes only if the check reports it. - Test `startup_resource_address_index` compares the index with a full scan (180,000 lookups) across release, re-reference, address reuse (dead entries plus live ones at one base), overlapping live ranges, re-notes with another size, unaligned bases, and directed edges (a base at `address + span - 1` is found, at `address + span` is not). It injects allocation failures (replaced `operator new`, as `startup_placement_alloc` does) into `store_indexed` for a new key and a re-note and checks the record and the index stay in step. Controls that must fail: `--mutate skip` (one insert dropped) and `--mutate unsync` (index insert first, left behind when the record update fails). Moving the forward loop bound by one (`it->first + 1 < to`) also fails the test (checked by hand, not a registered test). AI-assisted (Claude Code). ## Verification Base `214ed093` (origin/main), head `c647f84d` (single commit). Windows 11 build 26300. - `cmake --build --preset dev`: clean. - `ctest --preset dev --no-tests=error --timeout 120 -R '^(startup_(address_[a-z_0-9]*_warp|address_srv_warp|memory_srv[a-z_0-9-]*|placement_[a-z_]*|resource_address_index[a-z_]*|indirect_(dispatch|draw|draw_indexed|translated_indexed|requests)_warp|list_copy_warp)|era_heap_[a-z_]*|offscreen_warp)$'`: 40 passed, 0 skipped, 0 failed (ctest reports no skips). - The same command with `X2W_RESOURCE_INDEX_CHECK=1` in the environment: 40 passed, 0 skipped, 0 failed. - `python -B tests/docs_links_check.py`, `python -B tests/bidi_controls_check.py`: pass. `git diff --check`: clean. - Adapters: WARP for the `_warp` tests; the hardware test in the selection (`startup_memory_srv_diag_hardware`) ran on a physical GPU (adapter, driver and debug-layer status are printed by the test, not recorded here). Local observation, measured on the earlier revision of this change that erased entries at the last release (one local run each, instrumented build, not reproducible from the repository; the two runs reached different scenes and the shader cache differed, so this is not a clean A/B): the mean cost of the by-address SRV call fell from about 100 us (0.8 M calls, 80.6 s) to about 8.5 us (3.28 M calls, 27.8 s) over the same 100 s window. Before the change the median scan cost grew from about 45 us to about 120 us as the table grew. No frame-rate claim is made. ## Limits - The index grows with the never-pruned table, and dead entries at a reused address are still visited and filtered, so lookup cost at a heavily reused address grows with the reuse count. - The table itself is still never pruned; only the lookups stopped walking all of it. - The failure control injects into `store_indexed` and the header's index; the glue in `note_resource` and the slot 133 hook is covered by the existing placement tests and the check mode, not by a device-level allocation-failure test. - The equivalence test uses synthetic resources; the check mode compares presence in the index only, not lookup answers, on real calls. - Fixtures only; this does not show full-title startup. ## 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. None changed; I found no `docs/experiments.md` row convention for runtime lookup performance changes, so none was added. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code); the commands above were run locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tedin7 commented 2026-11-25 14:04:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:01:35Z.

Review: COMMENTED


Review of head f50dae926aa83675569829fa14b72044bb438e85 (Linux-only review; no Windows run).

Verdict: no blockers (P1=0). One test-strength gap (P2=1).

Commands executed locally in a worktree at that SHA:

  • git diff --check origin/main...HEAD: clean
  • python3 tests/docs_links_check.py: self-test passed, 19 files / 453 links
  • python3 tests/bidi_controls_check.py: 1631 files, no bidi controls
  • g++ -std=c++20 -Isrc tests/startup_resource_address_index_check.cpp then run: "120000 lookups agree with a scan of up to 300 resources" (rc 0)
  • same binary with --mutate stale: reports "scan and index disagree" (the WILL_FAIL control is real)
  • CI at review time: Linux, Windows and gfx1013 jobs were still pending. Windows/WARP result not verified here.

What I checked (reasoning, matches the code)

  • for_each_reaching returns a superset of what address_span_touches accepts. The index extent is max(bytes, Width for buffers, 1), which is never smaller than the lookup-side bytes. Every call site still re-applies its original predicate, so answers are unchanged, including "two matches means none".
  • existing_memory_texture and existing_memory_buffer query span 1 at address; both predicates require the resource to contain or start at address, which the backward/forward walk covers.
  • Slot 133: index_resource runs inside the same exclusive note_lock hold via publish_placement's also hook, with correct rollback on throw. Insert in note_resource is erase+insert, so re-noting is idempotent.
  • Lock discipline OK: exclusive for insert/erase, shared for lookups.

P2 tests/startup_resource_address_index_check.cpp:81-93 does not kill an off-by-one at the end of the span.
Mutation I ran: in resource_address_index.h for_each_reaching, forward loop condition it->first < to changed to it->first < to - (to > from). This drops a resource whose base is exactly the last byte of [from, from+span). The unit test still passed (rc 0), so the randomized test is blind to it. The test bases are all multiples of 4096 ((1 + pick(4096)) * 4096), so a base equal to address + span - 1 almost never occurs. Suggest a few unaligned bases, or a directed case with base = address + span - 1 and base = address + span.
(My other mutation, >= to > on the backward max_extent break, is equivalent: it only visits one more candidate. Not a finding.)

P3 / nits

  • src/startup_stubs/d3d12_memory_srv.inl check_resource_address_index: the ExitProcess(3) path returns without ReleaseSRWLockShared. Harmless since the process exits, but an RAII guard would be tidier.
  • revive_check makes a late AddRef on a retired resource kill the process (exit 3). The behavior change is documented in the PR body; fine as a deliberate fail-loud, just worth the maintainers confirming no title does AddRef-after-zero in practice (Win2025 run will show it).

PR is not Draft, MERGEABLE, title is neutral, no clean-room concerns seen in the diff.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058083750 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2343#pullrequestreview-6058083750). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:01:35Z. **Review:** COMMENTED --- Review of head `f50dae926aa83675569829fa14b72044bb438e85` (Linux-only review; no Windows run). **Verdict: no blockers (P1=0). One test-strength gap (P2=1).** Commands executed locally in a worktree at that SHA: - `git diff --check origin/main...HEAD`: clean - `python3 tests/docs_links_check.py`: self-test passed, 19 files / 453 links - `python3 tests/bidi_controls_check.py`: 1631 files, no bidi controls - `g++ -std=c++20 -Isrc tests/startup_resource_address_index_check.cpp` then run: "120000 lookups agree with a scan of up to 300 resources" (rc 0) - same binary with `--mutate stale`: reports "scan and index disagree" (the WILL_FAIL control is real) - CI at review time: Linux, Windows and gfx1013 jobs were still pending. Windows/WARP result not verified here. **What I checked (reasoning, matches the code)** - `for_each_reaching` returns a superset of what `address_span_touches` accepts. The index extent is `max(bytes, Width for buffers, 1)`, which is never smaller than the lookup-side `bytes`. Every call site still re-applies its original predicate, so answers are unchanged, including "two matches means none". - `existing_memory_texture` and `existing_memory_buffer` query span 1 at `address`; both predicates require the resource to contain or start at `address`, which the backward/forward walk covers. - Slot 133: `index_resource` runs inside the same exclusive `note_lock` hold via `publish_placement`'s `also` hook, with correct rollback on throw. Insert in `note_resource` is erase+insert, so re-noting is idempotent. - Lock discipline OK: exclusive for insert/erase, shared for lookups. **P2** `tests/startup_resource_address_index_check.cpp:81-93` does not kill an off-by-one at the end of the span. Mutation I ran: in `resource_address_index.h` `for_each_reaching`, forward loop condition `it->first < to` changed to `it->first < to - (to > from)`. This drops a resource whose base is exactly the last byte of `[from, from+span)`. The unit test still passed (rc 0), so the randomized test is blind to it. The test bases are all multiples of 4096 (`(1 + pick(4096)) * 4096`), so a base equal to `address + span - 1` almost never occurs. Suggest a few unaligned bases, or a directed case with base = address + span - 1 and base = address + span. (My other mutation, `>=` to `>` on the backward `max_extent` break, is equivalent: it only visits one more candidate. Not a finding.) **P3 / nits** - `src/startup_stubs/d3d12_memory_srv.inl` `check_resource_address_index`: the `ExitProcess(3)` path returns without `ReleaseSRWLockShared`. Harmless since the process exits, but an RAII guard would be tidier. - `revive_check` makes a late AddRef on a retired resource kill the process (exit 3). The behavior change is documented in the PR body; fine as a deliberate fail-loud, just worth the maintainers confirming no title does AddRef-after-zero in practice (Win2025 run will show it). PR is not Draft, MERGEABLE, title is neutral, no clean-room concerns seen in the diff. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-25 14:04:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T13:15:58Z.

Review: CHANGES_REQUESTED


The address index should preserve the current wrapper lifetime behavior. This revision makes a later AddRef or QueryInterface terminate the process, and the documented race can still leave a live wrapper absent from the index when a reference is taken before retirement finishes. Remove the new process exit from the lookup optimization. Keeping zero-reference candidates and applying the existing live-reference filter is one way to preserve the scan results while narrowing candidates by address. A separately reviewed lifetime policy can establish when those entries may be removed.

Also keep the canonical record and secondary index in sync on allocation failure. In note_resource the canonical map is updated before index_resource erases the old entry and allocates a new one. If that allocation fails, a live record can remain invisible to the new lookup. Please add a source-built publish/failure control and compare the index with the old scan across release, address reuse and overlapping live ranges.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058293426 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2343#pullrequestreview-6058293426). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T13:15:58Z. **Review:** CHANGES_REQUESTED --- The address index should preserve the current wrapper lifetime behavior. This revision makes a later AddRef or QueryInterface terminate the process, and the documented race can still leave a live wrapper absent from the index when a reference is taken before retirement finishes. Remove the new process exit from the lookup optimization. Keeping zero-reference candidates and applying the existing live-reference filter is one way to preserve the scan results while narrowing candidates by address. A separately reviewed lifetime policy can establish when those entries may be removed. Also keep the canonical record and secondary index in sync on allocation failure. In note_resource the canonical map is updated before index_resource erases the old entry and allocates a new one. If that allocation fails, a live record can remain invisible to the new lookup. Please add a source-built publish/failure control and compare the index with the old scan across release, address reuse and overlapping live ranges.
tedin7 commented 2026-11-25 14:04:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:35:11Z.

Review: COMMENTED


Review of head c647f84d0da7f939404a9606667a685962f41bcd (Linux-side review; no Win2025 run was started, CI "Build and test on Windows" is green on this head).

Verdict: no code blockers. One description problem (P2), two nits.

The index narrows candidates and each of the four lookups re-applies its original predicate, so the answers match the old scan. I checked each lookup by hand:

  • existing_memory_texture / existing_memory_buffer: for_each_reaching(address, 1, ...) yields every entry whose [base, base+max(bytes,1)) contains address. The buffer extent is max(bytes, Width), so it is a superset of the old address - base < width test. "Two matches means none" is kept (match=nullptr; return true).
  • address_resource_overlap / gpu_written_overlap: forward walk base in [from, from+span) plus backward walk bounded by max_extent. Together they cover both arms of address_span_touches. The saturating to is fine.
  • publish_placement hook: the index insert runs inside the same exclusive hold, and a throw erases the node and the record (d3d12_xs_device.cpp:3969, placement_publish.h:37-50).
  • store_indexed order (index node first, then record, undo on throw) is sound; unsync control covers it.

Findings

P2 PR description is stale against this head. It describes the earlier head f50dae92, not c647f84d:

  • It says the entry is erased in retire_placement and that AddRef/QueryInterface after the last release exits with code 3. This head does neither: retire_placement (d3d12_capture.inl:208) is untouched, entries are never removed ("an entry stays as long as the record does"), and a re-referenced resource is simply found again.
  • It names control startup_resource_address_index_stale_control / --mutate stale. The head has startup_resource_address_index_skip_control and ..._unsync_control (CMakeLists.txt ~L648-657).
  • The Verification block quotes base ea468f30 / head f50dae92 and "39 passed". Those results do not belong to this head; please re-run and update (a Stage-2 Win2025 run for this SHA would do).
  • The "Limits" entries about the release-then-reference assert no longer apply.

P3 nit resource_address_index.h: max_extent never shrinks and entries are never erased, so the backward walk can stay wider than needed after one big resource, and erase() is now unused outside tests/rollback. Harmless; a short comment would help.

P3 nit d3d12_memory_srv.inl:138: the new comment line is over 170 characters; wrap it.

Commands run locally (Linux, worktree at the head above)

  • git diff --stat origin/main...HEAD: 7 files, +497/-32.
  • g++ -std=c++17 -O1 -Isrc tests/startup_resource_address_index_check.cpp: builds. Default run exit 0: "180000 lookups agree with a scan of 400 resources (192 live) across release, re-reference, address reuse, re-note and span-end edges". --mutate skip exit 1 and --mutate unsync exit 1 (both controls fail as intended).
  • python3 tests/docs_links_check.py: pass (19 files, 457 links). python3 tests/bidi_controls_check.py: pass. git diff --check origin/main...HEAD: clean.
  • Mutations of the new index logic, reverted with git checkout -- .:
    • max_extent update removed: killed (exit 1).
    • backward-walk break >= to >; extent < to <=; extent max(bytes,1) to bytes; forward bound < to <=; single group: all survive. These only widen the candidate set (or change speed), and the callers' own predicates filter them, so they are behavior-equivalent by design, not test gaps.
  • Not run: the _warp / X2W_RESOURCE_INDEX_CHECK fixtures (Windows only). The CI Windows job passed on this head.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6058578383 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2343#pullrequestreview-6058578383). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:35:11Z. **Review:** COMMENTED --- Review of head `c647f84d0da7f939404a9606667a685962f41bcd` (Linux-side review; no Win2025 run was started, CI "Build and test on Windows" is green on this head). ## Verdict: no code blockers. One description problem (P2), two nits. The index narrows candidates and each of the four lookups re-applies its original predicate, so the answers match the old scan. I checked each lookup by hand: - `existing_memory_texture` / `existing_memory_buffer`: `for_each_reaching(address, 1, ...)` yields every entry whose `[base, base+max(bytes,1))` contains `address`. The buffer extent is `max(bytes, Width)`, so it is a superset of the old `address - base < width` test. "Two matches means none" is kept (`match=nullptr; return true`). - `address_resource_overlap` / `gpu_written_overlap`: forward walk `base in [from, from+span)` plus backward walk bounded by `max_extent`. Together they cover both arms of `address_span_touches`. The saturating `to` is fine. - `publish_placement` hook: the index insert runs inside the same exclusive hold, and a throw erases the node and the record (`d3d12_xs_device.cpp:3969`, `placement_publish.h:37-50`). - `store_indexed` order (index node first, then record, undo on throw) is sound; `unsync` control covers it. ## Findings P2 `PR description` is stale against this head. It describes the earlier head `f50dae92`, not `c647f84d`: - It says the entry is erased in `retire_placement` and that AddRef/QueryInterface after the last release exits with code 3. This head does neither: `retire_placement` (`d3d12_capture.inl:208`) is untouched, entries are never removed ("an entry stays as long as the record does"), and a re-referenced resource is simply found again. - It names control `startup_resource_address_index_stale_control` / `--mutate stale`. The head has `startup_resource_address_index_skip_control` and `..._unsync_control` (`CMakeLists.txt` ~L648-657). - The Verification block quotes base `ea468f30` / head `f50dae92` and "39 passed". Those results do not belong to this head; please re-run and update (a Stage-2 Win2025 run for this SHA would do). - The "Limits" entries about the release-then-reference assert no longer apply. P3 nit `resource_address_index.h`: `max_extent` never shrinks and entries are never erased, so the backward walk can stay wider than needed after one big resource, and `erase()` is now unused outside tests/rollback. Harmless; a short comment would help. P3 nit `d3d12_memory_srv.inl:138`: the new comment line is over 170 characters; wrap it. ## Commands run locally (Linux, worktree at the head above) - `git diff --stat origin/main...HEAD`: 7 files, +497/-32. - `g++ -std=c++17 -O1 -Isrc tests/startup_resource_address_index_check.cpp`: builds. Default run exit 0: "180000 lookups agree with a scan of 400 resources (192 live) across release, re-reference, address reuse, re-note and span-end edges". `--mutate skip` exit 1 and `--mutate unsync` exit 1 (both controls fail as intended). - `python3 tests/docs_links_check.py`: pass (19 files, 457 links). `python3 tests/bidi_controls_check.py`: pass. `git diff --check origin/main...HEAD`: clean. - Mutations of the new index logic, reverted with `git checkout -- .`: - `max_extent` update removed: killed (exit 1). - backward-walk `break` `>=` to `>`; `extent` `<` to `<=`; extent `max(bytes,1)` to `bytes`; forward bound `<` to `<=`; single group: all survive. These only widen the candidate set (or change speed), and the callers' own predicates filter them, so they are behavior-equivalent by design, not test gaps. - Not run: the `_warp` / `X2W_RESOURCE_INDEX_CHECK` fixtures (Windows only). The CI Windows job passed on this head. AI-assisted; commands listed were executed locally.
NiiRoZz commented 2026-11-25 14:05:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T13:31:19Z.


Pushed c647f84d (rebased on main). The process exit, the retired flag and revive_check are removed; AddRef and QueryInterface are unchanged. Index entries now stay as long as the canonical record, and each lookup's own live-reference filter skips dead ones, so a wrapper referenced again is found again.

note_resource allocates the index node first and undoes it if the record store throws, so record and index are both new or both old. A source-built control injects allocation failures into that step; the test compares the index with the full scan over 180,000 lookups across release, re-reference, address reuse (including two live matches), overlapping ranges, re-notes and unaligned bases, with two registered must-fail controls (a skipped insert; an index insert left behind when the record update fails).

The second review's span-end cases are added (address + span - 1 found, address + span not found); moving the forward bound by one now fails the test (checked by hand, not a registered test). The check function releases its lock on every path.

40 of 40 selected tests pass on WARP plus one hardware test, also with X2W_RESOURCE_INDEX_CHECK=1. Limits: the failure control covers the record/index step, not a device-level allocation failure in the glue; lookup cost at a heavily reused address grows with the reuse count because dead entries are visited and filtered.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7163896919 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2343#issuecomment-7163896919). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T13:31:19Z. --- Pushed c647f84d (rebased on main). The process exit, the `retired` flag and `revive_check` are removed; `AddRef` and `QueryInterface` are unchanged. Index entries now stay as long as the canonical record, and each lookup's own live-reference filter skips dead ones, so a wrapper referenced again is found again. `note_resource` allocates the index node first and undoes it if the record store throws, so record and index are both new or both old. A source-built control injects allocation failures into that step; the test compares the index with the full scan over 180,000 lookups across release, re-reference, address reuse (including two live matches), overlapping ranges, re-notes and unaligned bases, with two registered must-fail controls (a skipped insert; an index insert left behind when the record update fails). The second review's span-end cases are added (`address + span - 1` found, `address + span` not found); moving the forward bound by one now fails the test (checked by hand, not a registered test). The check function releases its lock on every path. 40 of 40 selected tests pass on WARP plus one hardware test, also with `X2W_RESOURCE_INDEX_CHECK=1`. Limits: the failure control covers the record/index step, not a device-level allocation failure in the glue; lookup cost at a heavily reused address grows with the reuse count because dead entries are visited and filtered. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-25 15:01:36 +00:00
R0Y00 commented 2026-11-25 15:01:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T14:09:48Z.

Review: APPROVED


Rechecked c647f84d. The existing reference behavior is restored. The index stays with the canonical records, each query still applies its original predicates, and an allocation failure leaves both structures in step. On the local Windows MSVC /O2 build the source-built check agreed with the scan across 180,000 lookups and passed all three injected allocation-failure cases. Skipping an index insert and leaving an index entry after a failed store each failed as expected. This clears my prior review. The startup timing in the description is an observation from the earlier revision.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6059150405 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2343#pullrequestreview-6059150405). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T14:09:48Z. **Review:** APPROVED --- Rechecked `c647f84d`. The existing reference behavior is restored. The index stays with the canonical records, each query still applies its original predicates, and an allocation failure leaves both structures in step. On the local Windows MSVC /O2 build the source-built check agreed with the scan across 180,000 lookups and passed all three injected allocation-failure cases. Skipping an index insert and leaving an index entry after a failed store each failed as expected. This clears my prior review. The startup timing in the description is an observation from the earlier revision.
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
R0Y00/Xbox2Windows!2335
No description provided.