perf: remember a refused buffer memory SRV for a short, validated time #2782
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2782
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2782"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@tedin7 on GitHub · 2026-11-26 08:43 UTC · original
tedin7:x2w-srv-refusal-cache→main· +649 −15 · 10 files · 15 commits · openPart of #1723
What this unblocks: frame time on titles that re-publish the same refused buffer SRV every frame. A tester log shows
viewat 18996 ms over 12120 calls and 654,893 slot-70 refusals, 545,784 of thembuffer_unavailable.What changed
device_memory_srv(src/startup_stubs/d3d12_memory_srv.inl) kept no memory of abuffer_unavailablerefusal. Each call repeated the placement scans,unplaced_memory_bufferwith itsmeasure_placed_buffermemory questions (a region-information call and, for partly committed or mapped allocations, aVirtualQuerywalk), and the view resolution, then refused again.src/startup_stubs/srv_refusal_cache.h: a bounded 256-slot negative cache. A cached refusal carries an exact proof, so a hit never refuses what the full path would publish:measure_placed_buffernow reports that page. A hit asks only that one page again (oneVirtualQuery) and the allocation base (one region-information call, no scan). The refusal holds exactly while that page stays uncommitted, so decommit and commit with an equal total are seen.refuse_memory_srv, so the census counters and the log limits are unchanged. A miss runs the full path unchanged.Review fix
A reviewer reproduced a stale refusal: reserve 128 KiB, commit the upper 64 KiB, the slot-70 request refuses; decommit the upper half, commit and fill the lower 64 KiB (same base, same reservation, same committed total), retry at once: no SRV was written. A region stamp is identical there. The witness page (the lower page, uncommitted at the first refusal) is now committed, so the entry misses and the full path runs. That sequence is the control in the test. The opt-in switch of the earlier revision is gone: the default is exact and covers the memory refusals.
What is not covered
VirtualQueryon a foreign committed page is not measured here; for an uncommitted or free page it does not walk committed ranges.Tests
tests/startup_srv_refusal_cache_check.cpp(pure header, a fake two-page allocation stands for the page query), registered asstartup_srv_refusal_cachewith eight negative controls (--mutate generation|witness|stamp|key|device|age|hits|unproven, each must fail): the page-move sequence misses while the witness holds before it; an uncommitted address hits without an allocation stamp and misses once committed; another base, an unreadable stamp or a new generation miss; a fully committed entry misses on any stamp change; key, device, age, hit limit and a backwards clock miss; a refusal without a proof is never cached.Verification
Win2025 gate on head
9f2752688(independent gate): dev 33/33 and release 33/33 pass, including the page-move witness sequence. The real share of the 545,784 refusals that get cached is not measured.AI-assisted; commands listed were executed locally.
Source: Microsoft D3D12 documentation, ID3D12Device::CreateShaderResourceView and the DirectX-Specs "Resource Binding" page (a view is created from the resource and descriptor state at call time).
@tedin7 on GitHub · 2026-11-26 09:03 UTC · original · edited 2026-11-26 10:34 UTC
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
9f27526889d3df9b58e9bd45394f0f49b07f2d44:--preset dev):cmake --build --preset dev --target startup_stream_consumer offscreen_check startup_srv_refusal_cache_check startup_placed_buffer_range_check -- -j 2):1.49s(configure1.89s)ctest --preset dev -R 'startup_memory_srv|startup_srv_refusal_cache|startup_placed_buffer|startup_unplaced' --parallel 6 --no-tests=error --output-on-failure): 33/33 passed (1.32s:startup_memory_srv_diag_hardware0.78s,startup_memory_srv_diag_warp0.78s,startup_memory_srv_diag_supported_control_warp0.80s,startup_memory_srv_volume_layout_control0.01s,startup_memory_srv_census0.03s,startup_memory_srv_buffer_unplaced-covers_control0.02s,startup_memory_srv_volume0.02s,startup_memory_srv_as0.02s,startup_memory_srv_volume_mips-overflow_control0.02s,startup_memory_srv_volume_2d-view_control0.02s,startup_memory_srv_volume_3d-view_control0.02s,startup_memory_srv_buffer_first-32_control0.02s,startup_memory_srv_buffer_unplaced-extent_control0.02s,startup_placed_buffer_range_region_only_control0.86s,startup_memory_srv_buffer0.02s,startup_memory_srv_buffer_exact-fit_control0.03s,startup_memory_srv_as_alignment_control0.03s,startup_srv_refusal_cache0.03s,startup_memory_srv_buffer_height_control0.02s,startup_memory_srv_as_offset_control0.02s,startup_placed_buffer_range0.91s,startup_memory_srv_as_state_control0.03s,startup_memory_srv_report0.02s,startup_srv_refusal_cache_unproven_control0.03s,startup_srv_refusal_cache_generation_control0.02s,startup_memory_srv_buffer_unplaced-heap-limit_control0.03s,startup_srv_refusal_cache_age_control0.03s,startup_srv_refusal_cache_hits_control0.03s,startup_srv_refusal_cache_device_control0.03s,startup_srv_refusal_cache_stamp_control0.02s,startup_srv_refusal_cache_key_control0.01s,startup_srv_refusal_cache_witness_control0.01s,startup_placed_buffer_range_walk_only_control1.18s)/O2(--preset release):cmake --build --preset release --target startup_stream_consumer offscreen_check startup_srv_refusal_cache_check startup_placed_buffer_range_check -- -j 2):1.77s(configure1.90s)ctest --preset release -R 'startup_memory_srv|startup_srv_refusal_cache|startup_placed_buffer|startup_unplaced' --parallel 6 --no-tests=error --output-on-failure): 33/33 passed (1.10s:startup_placed_buffer_range_region_only_control0.63s,startup_memory_srv_diag_warp0.66s,startup_memory_srv_volume_3d-view_control0.02s,startup_memory_srv_diag_supported_control_warp0.67s,startup_memory_srv_buffer_first-32_control0.02s,startup_memory_srv_diag_hardware0.68s,startup_memory_srv_as0.03s,startup_placed_buffer_range0.69s,startup_memory_srv_census0.03s,startup_srv_refusal_cache0.03s,startup_memory_srv_volume_mips-overflow_control0.02s,startup_memory_srv_report0.02s,startup_memory_srv_volume_layout_control0.03s,startup_memory_srv_volume0.03s,startup_memory_srv_volume_2d-view_control0.02s,startup_memory_srv_buffer_unplaced-heap-limit_control0.02s,startup_memory_srv_as_alignment_control0.03s,startup_memory_srv_buffer_unplaced-covers_control0.03s,startup_srv_refusal_cache_generation_control0.02s,startup_memory_srv_as_state_control0.02s,startup_memory_srv_buffer0.02s,startup_memory_srv_buffer_unplaced-extent_control0.02s,startup_memory_srv_as_offset_control0.02s,startup_memory_srv_buffer_height_control0.01s,startup_memory_srv_buffer_exact-fit_control0.02s,startup_srv_refusal_cache_unproven_control0.03s,startup_srv_refusal_cache_age_control0.02s,startup_srv_refusal_cache_hits_control0.02s,startup_srv_refusal_cache_witness_control0.02s,startup_srv_refusal_cache_device_control0.02s,startup_srv_refusal_cache_stamp_control0.01s,startup_srv_refusal_cache_key_control0.01s,startup_placed_buffer_range_walk_only_control0.97s)sccache: 8/10 hits; wall12.8sGate (independent peer review, same head): PASS, no blocking finding.
buffer_refusal_page_still_uncommittedreturns true (still refused) when VirtualQuery itself fails; returning false would send that rare case to the full path.AI-assisted; commands listed were executed locally.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 09:04 UTC · original · edited 2026-11-26 10:45 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
9f27526ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 09:09 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
8c46609955ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@ -306,6 +308,7 @@ void retire_placement(Wrapper* w)}}found->second.placement = Placement::none;x2w_startup::note_placement_change();@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 09:09 UTC · original
When a buffer SRV is refused because a normal slot-133 texture occupies the same base address, releasing that texture does not invalidate the cached refusal. Normal textures are recorded with
Placement::none, so this generation bump is skipped, even thoughaddress_resource_overlap()immediately stops considering the texture live after its reference count reaches zero. WithX2W_D3D12_RELEASE_RETIREDdisabled and no other publications, the generation and allocation stamp remain unchanged, causing an otherwise valid retry to be refused for up to 250 ms. Sincerefuse_memory_srv()leaves the destination untouched, a one-shot retry can leave a stale descriptor indefinitely. Advance the generation on relevant final releases even when no placement-index entry exists.Useful? React with 👍 / 👎.
@ -306,6 +308,7 @@ void retire_placement(Wrapper* w)}}found->second.placement = Placement::none;x2w_startup::note_placement_change();@tedin7 on GitHub · 2026-11-26 09:13 UTC · original
Fixed in
ef94abdd8. You are right:retire_placementonly bumps for resources with a placement entry, butaddress_resource_overlapandexisting_memory_bufferstop counting any resource when its reference count reaches zero.release()now callsnote_placement_change()at the last release of every title resource (beforeretire_placement). A refusal cached while the resource was live carries an older generation, so the next call runs the full path. Order: a reader that saw the resource live read the generation before the decrement, and the bump comes after it, so its stored entry is stale, not fresh.Not covered by a test that fails if this call is removed: that needs a device-level draw test (refuse by overlap, release, expect the next slot-70 call to publish); tracked as the follow-up in the body.
AI-assisted; commands listed were executed locally.
@R0Y00 on GitHub · 2026-11-26 09:28 UTC · original · requested changes
I reproduced the same-CommitSize case through production device slot 70 on
ef94abdd, Windows 11 26200, WARP and RTX 4060 Laptop. Starting from the source-builtdispatch-input-memory-viewbuffer, reserve 128 KiB, commit the upper 64 KiB only, and make the slot-70 request at the base (it correctly refuses). Decommit the upper 64 KiB and commit/fill the lower 64 KiB; the allocation base, reservation size and committed byte total are unchanged. Repeat the same request immediately.The immediate retry emitted no
memory SRV writtenon either adapter. The same second state in a fresh process, and the same retry after 300 ms, both published one SRV on each adapter. This probe isolates descriptor publication; it does not claim that the downstream translated dispatch accepts this partial-reservation case.A caller that requests the view once after committing it can therefore miss the descriptor indefinitely even though the cached entry itself expires. Please keep the default lookup exact. Limit caching to refusals whose inputs are fully proven by the stored key and memory state, or make approximate suppression explicitly opt-in and document the publication behavior. Keep the immediate same-total page-move case as a control.
@tedin7 on GitHub · 2026-11-26 09:46 UTC · original
Fixed in
7fdee8f75. Your sequence is right: the region stamp (base, size, committed total, flags) is identical when the committed pages move with the same total, so the cached refusal was reused for up to 250 ms.What changed:
X2W_SRV_REFUSAL_CACHE_MEMORY=1(off unless set), documented in the header and the PR body.--mutate memorymust fail): reserve 128 KiB, commit the upper 64 KiB, refuse; same stamp after moving the commit to the lower half; the default never hits, so the full path runs.Verification:
g++ -std=c++17 -Wall -Wextra -Isrc tests/startup_srv_refusal_cache_check.cpprc=0; all seven--mutatecontrols rc=1. The Windows build and WARP/hardware run are pending Stage-2. The PR is Draft until that passes.Honest limit: I do not know how many of the 545,784 refusals are memory independent, so the default speedup is unmeasured.
AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-26 10:28 UTC · original
Follow-up in the next push: the default now covers the memory refusals too, still exact.
Test: your sequence is a control (
--mutate witnessmust fail), plus seven more controls;g++ ... startup_srv_refusal_cache_check.cpprc=0, every--mutaterc=1. The Windows build and the WARP and hardware runs are pending Stage-2. The PR stays Draft until then.AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-26 10:34 UTC · original
Your page-move sequence (reserve 128 KiB, commit the upper 64 KiB, refuse; decommit it, commit the lower 64 KiB, retry at once) is now a test in
tests/startup_srv_refusal_cache_check.cppand it passes: the cached refusal misses because its witness page is committed after the move, so the full path runs. Its mutated control (--mutate witness) fails as it should.The independent Win2025 gate on head
9f2752688passed: dev 33/33 and release 33/33, including that sequence. The PR is Ready.AI-assisted; commands listed were executed locally.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 10:45 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
9f27526889ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@ -703,0 +772,4 @@if (buffer_refusal_cache().hit(refusal_key, refusal_stamp, GetTickCount64(), buffer_refusal_page_still_uncommitted)) {refuse_memory_srv(refused, "unavailable buffer at the supplied address", "buffer_unavailable", resource, input,destination);return;@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 10:45 UTC · original
With retained wrappers (
X2W_D3D12_RELEASE_RETIRED=0), a buffer can transition from zero references back to live viaadd_ref()orquery_interface(); this lifecycle is explicitly exercised bytests/startup_resource_address_index_check.cpp:242-244. For a view larger than the unplaced 256 MiB limit, a call while that buffer is released caches an independent refusal, but re-referencing the buffer makesexisting_memory_buffer()able to publish the same view. Neither reference-increment path advances the generation, so this early hit still refuses it for up to 250 ms, and a one-shot retry leaves its descriptor unchanged. Invalidate refusals on zero-to-positive resource-reference transitions in both paths.Useful? React with 👍 / 👎.
@tedin7 on GitHub · 2026-11-26 12:30 UTC · original
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
a4eeb366d995ff3204d7aa7cc1c62b8b9108400f:--preset dev):cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_placed_buffer_range_check startup_srv_refusal_cache_check -- -j 2):31.28s(configure2.14s)ctest --preset dev -R 'srv_refusal|resource_address_index|memory_srv|startup_d3d12' --parallel 2 --no-tests=error --output-on-failure): 34/34 passed (9.97s:startup_memory_srv_diag_supported_control_warp0.76s,startup_memory_srv_diag_warp0.77s,startup_memory_srv_diag_hardware0.77s,startup_resource_address_index_missing_control_warp0.73s,startup_memory_srv_census0.03s,startup_memory_srv_buffer_unplaced-covers_control0.02s,startup_memory_srv_volume_layout_control0.01s,startup_memory_srv_volume0.01s,startup_srv_refusal_cache_hits_control0.02s,startup_srv_refusal_cache_age_control0.02s,startup_memory_srv_as0.01s,startup_srv_refusal_cache_unproven_control0.02s,startup_srv_refusal_cache0.01s,startup_memory_srv_buffer_unplaced-heap-limit_control0.01s,startup_memory_srv_volume_mips-overflow_control0.01s,startup_memory_srv_volume_2d-view_control0.01s,startup_memory_srv_volume_3d-view_control0.01s,startup_srv_refusal_cache_device_control0.01s,startup_memory_srv_buffer_first-32_control0.01s,startup_memory_srv_buffer_exact-fit_control0.01s,startup_memory_srv_buffer0.01s,startup_memory_srv_buffer_unplaced-extent_control0.01s,startup_memory_srv_as_alignment_control0.01s,startup_memory_srv_buffer_height_control0.01s,startup_resource_address_index_skip_control0.01s,startup_memory_srv_as_offset_control0.01s,startup_memory_srv_as_state_control0.01s,startup_srv_refusal_cache_generation_control0.01s,startup_memory_srv_report0.02s,startup_srv_refusal_cache_stamp_control0.01s,startup_resource_address_index_unsync_control0.01s,startup_srv_refusal_cache_key_control0.01s,startup_srv_refusal_cache_witness_control0.02s,startup_resource_address_index9.78s)/O2(--preset release):cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_placed_buffer_range_check startup_srv_refusal_cache_check -- -j 2):75.21s(configure2.19s)ctest --preset release -R 'srv_refusal|resource_address_index|memory_srv|startup_d3d12' --parallel 2 --no-tests=error --output-on-failure): 34/34 passed (7.55s:startup_resource_address_index2.60s,startup_resource_address_index_missing_control_warp3.91s,startup_memory_srv_diag_warp2.45s,startup_memory_srv_diag_hardware3.69s,startup_srv_refusal_cache0.01s,startup_memory_srv_as0.02s,startup_memory_srv_buffer_first-32_control0.02s,startup_memory_srv_volume_3d-view_control0.02s,startup_memory_srv_census0.01s,startup_memory_srv_volume_layout_control0.01s,startup_memory_srv_volume0.01s,startup_memory_srv_volume_mips-overflow_control0.01s,startup_srv_refusal_cache_unproven_control0.01s,startup_memory_srv_buffer_unplaced-covers_control0.01s,startup_srv_refusal_cache_generation_control0.01s,startup_memory_srv_volume_2d-view_control0.01s,startup_memory_srv_as_alignment_control0.01s,startup_memory_srv_report0.02s,startup_memory_srv_buffer_unplaced-extent_control0.01s,startup_memory_srv_buffer_unplaced-heap-limit_control0.01s,startup_memory_srv_buffer_exact-fit_control0.01s,startup_srv_refusal_cache_witness_control0.01s,startup_srv_refusal_cache_age_control0.01s,startup_memory_srv_buffer0.01s,startup_memory_srv_as_state_control0.01s,startup_resource_address_index_unsync_control0.01s,startup_memory_srv_as_offset_control0.01s,startup_resource_address_index_skip_control0.01s,startup_memory_srv_buffer_height_control0.01s,startup_srv_refusal_cache_hits_control0.01s,startup_srv_refusal_cache_device_control0.01s,startup_srv_refusal_cache_stamp_control0.01s,startup_srv_refusal_cache_key_control0.01s,startup_memory_srv_diag_supported_control_warp0.90s)sccache: 5/26 hits; wall124.8sAI-assisted; commands listed were executed locally.
@ -703,0 +772,4 @@if (buffer_refusal_cache().hit(refusal_key, refusal_stamp, GetTickCount64(), buffer_refusal_page_still_uncommitted)) {refuse_memory_srv(refused, "unavailable buffer at the supplied address", "buffer_unavailable", resource, input,destination);return;@tedin7 on GitHub · 2026-11-26 12:30 UTC · original
Valid, thanks. Fixed in
79d926f0f(current heada4eeb366, which also merges main).add_ref()andquery_interface()now callnote_resource_reference()for title resources; when the count goes from 0 to 1 the placement generation advances, so a refusal cached while the buffer was released is not reused (same idea as the last-release bump).Test:
startup_srv_refusal_cache_checkchecks that 0->1 advances the generation and 1->2, 2->3 do not. Before the fix it does not build (no such function); after, it passes. Win2025 dev+release receipt ona4eeb366is in the PR comments (34/34 both presets); CI green.AI-assisted; commands listed were executed locally.
@SimSalabimse on GitHub · 2026-11-26 16:06 UTC · original
Hardware and WARP result for head
a4eeb366d995ff3204d7aa7cc1c62b8b9108400f: all pass. Part of #1723.Environment: Windows 11 25H2 (26200), MSVC 19.42,
devpreset, NVIDIA GeForce RTX 4070 Ti, driver 621.35 (32.0.16.2135). Tests run serially, one ctest process.Commands
Result (measured): 40/40 and 3/3 passed, exit code 0 for both.
startup_srv_refusal_cacheand its 8--mutatecontrols (generation, witness, stamp, key, device, age, hits, unproven), all as expected.startup_placed_buffer_rangeand its 2 controls (the PR changesplaced_buffer_range.h).d3d12_memory_srv.inl:startup_memory_srv_{census,report,buffer,as,volume}with their controls,startup_triage_run,runtime_startup_triage_run_cli_check.dxr_slot70_as_warp,startup_address_srv_warp,startup_memory_srv_diag_warp,startup_memory_srv_diag_supported_control_warp,startup_address_buffer_srv_warp,startup_address_volume_srv_warp.dxr_slot70_as_hardware,startup_address_srv_hardware,startup_memory_srv_diag_hardware,startup_address_buffer_srv_hardware,startup_address_volume_srv_hardware.What this shows: the change does not break the existing slot-70 memory SRV paths on a real NVIDIA adapter.
What this does not show: the cache test is a pure header test with no device variant, so no hardware test exercises a cache hit. I did not measure how many of the refusals in a real run get cached, or the frame time. That stays a hypothesis.
AI-Assisted
@tedin7 on GitHub · 2026-11-27 21:47 UTC · original
Verification: head
e524c2d55after the main merge and the latest fixes.Environment: Windows Server 2025 (build 26100), MSVC 14.44, D3D12 WARP and the hardware adapter, dev and release legs in parallel.
Commands (the same selection in both legs):
Result: 35/35 passed in both legs, including all eight
startup_srv_refusal_cache_*_controlmutants.AI-assisted; commands listed were executed locally.
@pigalot on GitHub · 2026-11-27 22:24 UTC · original · requested changes
Independently reviewed
e524c2d5integrated overmaine582a9a4(treec5a8ed51). The merge is clean andgit diff --cached --check origin/mainis clean.R0Y00's same-total page move (changes requested on
ef94abdd). The cache logic now handles it. A walk refusal is stored as awitness_pageproof: the first page, from the allocation base, that is not committed in the allocation. A hit re-asks only that page. I checked this against real memory with a small probe outside the repository. The probe calls the PR'smeasure_placed_buffer,region_stampandSrvRefusalCachewith the sameVirtualQuerybody asbuffer_refusal_page_still_uncommitted:In both cases the allocation base, size and committed total stay the same (65,536 and 131,072 bytes), so the region stamps are equal. The entry misses only because its witness page is now committed.
What I ran. I built
d3d12_xs_shim startup_stream_consumer offscreen_check startup_memory_srv_{as,buffer,census,report,volume}_check startup_placed_buffer_range_check startup_resource_address_index_check startup_srv_refusal_cache_checkindevandrelease, then ran:All 40 WARP and CPU tests pass, as do all 5 hardware tests, in both Debug and Release
/O2, with no skips.startup_srv_refusal_cachepasses, and its 8--mutatecontrols fail as they should.Mutants of my own. Each was applied alone, the targets above rebuilt in
dev, the tests run, and the source restored afterwards (git diff --quietclean).startup_srv_refusal_cachenote_placement_changeno longer advances the generationbuffer_refusal_page_still_uncommittedalways returns trueFinding.
tests/startup_srv_refusal_cache_check.cppruns the page move againstpage_still_uncommitted, a two-entry array. No test calls the production predicatebuffer_refusal_page_still_uncommittedor thedevice_memory_srvhit path. The second mutant brings back the behaviour R0Y00 reported onef94abdd: a cachedwitness_pagerefusal then survives the page move for up to 250 ms. With that mutant, every test above still passes. R0Y00 asked to "keep the immediate same-total page-move case as a control", and reproduced the case through production device slot 70.memory SRV written. The mutant above should fail it. A second request after a placement change would pin the generation bump at the same level.Non-blocking (hypothesis, not reproduced).
measure_placed_bufferruns its queries insidex2w_local::outside_run_breaks, because pages of a shared-view run read as reserved during an xmem run break. The hit path'sbuffer_refusal_stampandbuffer_refusal_page_still_uncommittedcallQueryVirtualMemoryInformationandVirtualQuerydirectly. WithX2W_XMEM_SHARED_VIEWS=1, a witness page that was committed after the refusal could read as reserved to a retry that lands inside a break. That retry would then hit, although the full path would wait for the break and publish. Wrapping both calls inoutside_run_breakswould rule this out. I did not build a run-break case.Verdict: changes requested on
e524c2d5for finding 1. The proof model reads correctly and holds against real memory in the probe above. R0Y00's changes request onef94abddstill stands, and I would leave the merge to R0Y00.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029. The hardware tests ran with the debug-layer settings each test chooses.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass one524c2d5.This reply was AI-assisted.
@tedin7 on GitHub · 2026-11-27 23:29 UTC · original
Thanks for the review. Pushed
eb6b918b3(merged with currentmain) for both findings.memory SRV writtenand four rendered pixels match. A second case pins the placement-release path.buffer_refusal_stampandbuffer_refusal_page_still_uncommittednow run insideoutside_run_breaks, likemeasure_placed_buffer, so a retry inside an xmem run break cannot hit on a witness page that reads as reserved.Verification:
eb6b918b:x2w_pipe.py win2025 2782 --regex '^(startup_srv_refusal_cache.*|startup_memory_srv.*|startup_address_buffer_srv.*|startup_address_srv.*|startup_placed_buffer_range.*)$' --forcestartup_address_buffer_srv_warpand_hardwareand thestartup_srv_refusal_cachecontrols. A first run at53ba0bb8had failed on a parsing bug in the Python check, fixed ineb6b918b.cmake -S . -B <tmp> -DDXC_EXECUTABLE=/bin/true,public_guard.py, mingw-fsyntax-onlyon the changed fixtures.AI-assisted; commands listed were executed locally.
@pigalot on GitHub · 2026-11-27 23:32 UTC · original · approved these changes
Retested
eb6b918bintegrated overmainfad97f47(tree677eaf7a). The merge is clean andgit diff --cached --check origin/mainis clean. This supersedes my changes-requested review one524c2d5.My finding on
e524c2d5(the page check was pinned only against a fake page table): addressed.buffer_refusal_page_still_uncommittedcan tell the two states apart. This is also R0Y00's same-CommitSize probe fromef94abdd, now as a test.53ba0bb8the check stopped atdest, address = match.groups(), because the acceleration-structure pattern has one capturing group.eb6b918breadsdestandaddressby name, and the check now runs to the end.My non-blocking hypothesis (hit-path queries outside
outside_run_breaks): addressed.buffer_refusal_stampandbuffer_refusal_page_still_uncommittednow run inside it, likemeasure_placed_buffer.What I ran. I built
d3d12_xs_shim startup_stream_consumer offscreen_check startup_memory_srv_as_check startup_memory_srv_buffer_check startup_memory_srv_census_check startup_memory_srv_report_check startup_memory_srv_volume_check startup_placed_buffer_range_check startup_resource_address_index_check startup_srv_refusal_cache_checkindevandrelease, then ran:/O2, with no skips, on WARP and the RTX 5090.startup_address_buffer_srv_{warp,hardware}reports "all 68 buffer SRV pixels exact; page move and placement release each published on retry".Mutants. Each was applied alone, the targets rebuilt in
dev,startup_address_buffer_srv_warpandstartup_srv_refusal_cache.*run, and the source restored afterwards (git diff --quietclean).buffer_refusal_page_still_uncommittedalways returns true (survived every test one524c2d5)000000ff, expecteddb0000ff(219)srv_placement_generationno longer bumped000000ff, expectede30000ff(227);startup_srv_refusal_cachefails tooNon-blocking. The merge replaced the description of
unplaced_memory_buffer'srefusalparameter with a shorter one. The earlier text named the three proof kinds (independent,fully_committed,witness_page) and said that a nullptr from a later step carries no proof. That was more useful.Verdict: approve on
eb6b918b. R0Y00's changes request onef94abddstill stands, so I am not merging. The new page-move case is meant to answer it.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass oneb6b918b. Theprpreset's filter does not includestartup_address_buffer_srv, so CI does not run the new cases.This reply was AI-assisted.
@JohnConnorNPC on GitHub · 2026-11-28 07:59 UTC · original
Thanks for the work on this. I did a static review of head
eb6b918b. It looks mergeable, with two test gaps, but it still needs R0Y00's re-review: the changes-requested review onef94abddstands, so the PR shows BLOCKED. The head does answer that request.9f275268makes the lookup exact by default (independent / fully_committed / witness_page proofs, no opt-in switch).eb6b918badds the slot-70 page-move control instartup_address_srv.cpp(commit the upper half, refuse, move the commitment, retry), and the checker requiresexpected one retry write.git merge-tree --write-tree origin/main <head>against mainc3204a9cgives rc=0. In the merged tree every index / unplaced / tiled / ref-increment writer still callsnote_placement_change.eb6b918b. GraphQLreviewThreadsgivesthreads=2 unresolved=0(both Codex P2s, fixed inef94abdd/79d926f0).base run rc=0 fails=0, and all 8--mutatecontrols give rc=1. Of 12 code mutants ofsrv_refusal_cache.h, 6 are killed and 6 survive: the key compare (3 forms), the backwards-clock guardnow_ms < e.noted_ms,proof.witness == 0innote()and the second-lock recheck.gh pr checks 2782shows Windows, gfx1013 and Linux Pythonpass. Windows ran100% tests passed out of 69, butgrep -cE 'srv_refusal|address_buffer_srv'over that log gives 0: theprpreset matches neither new test, so CI has not run them yet.SHOULD
!(e.key == key)from both hit checks survives (K_hit_no_key_compare: SURVIVED rc=0), and so does droppingview_b ==ordevice ==fromoperator==. The existing key and device cases pass only because their keys hash to different slots (198 vs 143 of 256). Probe: noterequest(kBase,0), then look uprequest(kBase,70), which lands in the same slot 198. The base giveshit=0and the mutanthit=1, so a colliding request would reuse another view's refusal. A collision case would pin it.buffer_unavailableline, andgrep -cE 'refusal_cache|SrvRefusal'over the two device test files gives 0. Removing thebuffer_refusal_cache().note(...)call would likely keep every test green (inferred, not built). The speed-up is also unmeasured (the body says "not measured"). A hit counter in the report, or one re-measure of slot-70viewtime, would back the title.NIT
c1with a non-noreply author email that GitHub links to no account. You may want to switch those to a noreply address before merge.Not run: no Windows or Wine build, no WARP or GPU. This covers static review, the trial merge and the header unit test with its mutants. Device-level claims rest on pigalot's and tedin7's runs.
This comment was AI-assisted.
@tedin7 on GitHub · 2026-11-28 21:58 UTC · original
Thanks @JohnConnorNPC. Pushed
780f53fd4(origin/main merged with a merge commit, no force push).What changed:
startup_srv_refusal_cache_checkfinds, for each of the eight key fields, a request that lands in the same cache slot as another one, and requires a miss. Dropping!(e.key == key)-style compares now fails: removingdevice ==,view_b ==orresource_b ==fromoperator==each fail the new case.prpreset not running these tests is a CI selection question for the maintainers.Verification:
g++ -std=c++17 -Wall -Wextra->srv refusal cache checks passed.780f53fd4:x2w_pipe.py win2025 2782 --regex '^(startup_srv_refusal_cache.*|startup_memory_srv.*|startup_address_srv.*|startup_address_buffer_srv.*|slot70.*)'-> 36/36 passed.@MasterDomino ready for review and merge when you have time. pigalot approved
eb6b918b; the old changes-requested review by @R0Y00 was onef94abddand the page-move case it asked for is on this head.AI-assisted; commands listed were executed locally.
@pigalot on GitHub · 2026-11-29 06:07 UTC · original · approved these changes
Retested
780f53fdintegrated overmain212d4b5f(treee09ddf73). The merge is clean andgit diff --cached --check origin/mainis clean. My approval oneb6b918bcarries over to this head.What changed since
eb6b918b.96b845a2mergesmain.git show --remerge-diff 96b845a2is empty, so the merge resolved without hand edits. In the PR's source files the only difference fromeb6b918bismain's own format-support change ind3d12_memory_srv.inl.780f53fdadds one case totests/startup_srv_refusal_cache_check.cpp: for each of the eight key fields it finds a request that lands in the same cache slot as another and requires a miss. No runtime code changed.note_placement_change;mainadded no new writer.JohnConnorNPC's points on
eb6b918b.main, and the tests that exist pin the direction that matters for correctness (a cached refusal never hides a view the full path would publish). The speed-up named in the PR title stays unmeasured, as the body says.What I ran. I built
d3d12_xs_shim startup_stream_consumer offscreen_check startup_memory_srv_as_check startup_memory_srv_buffer_check startup_memory_srv_census_check startup_memory_srv_report_check startup_memory_srv_volume_check startup_placed_buffer_range_check startup_resource_address_index_check startup_srv_refusal_cache_checkindevandrelease, then ran:/O2, with no skips.startup_address_buffer_srv_hardwarereports "all 68 buffer SRV pixels exact; page move and placement release each published on retry".Mutants. Each was applied alone, the targets rebuilt in
dev, the tests run, and the source restored afterwards (git diff --quietclean). Header mutants ranstartup_srv_refusal_cache; device mutants ran the five_warpdevice tests above.Killed (13):
hit;SrvRefusalKey::operator==(device,address,span_bytes,view_a,view_b,view_c,resource_a,resource_b), one mutant per field;note_placement_changeno longer advances the generation: failsstartup_srv_refusal_cacheand, separately,startup_address_buffer_srv_warp(placement-release pixel000000ff, expectede30000ff);buffer_refusal_page_still_uncommittedalways returns true: failsstartup_address_buffer_srv_warp(page-move pixel000000ff, expecteddb0000ff).Survive (5):
hitwithout its generation compare, and without its hit-limit compare. Both differ from the original only when another thread replaces the entry between the two locks; the test is single-threaded.proof.witness == 0guard innoteremoved.unplaced_memory_buffernever builds awitness_pageproof with a zero witness, so the guard is not reached from the stand-in.buffer_refusal_cache().note(...)call removed, and thehitcall replaced byfalse. Every device test still passes: this is point 2 above.Equivalent (3):
now_ms < e.noted_msguard removed: the unsigned difference wraps to a value abovekMaxAgeMs, so a backwards clock still misses.Title run. A run of
780f53fdagainst the baseline ofmain212d4b5fpassed:[pass] run_finishes: The run finished its input plan: ready 435.2 s after start, 4 cycles run.[pass] frames_present: 12 of 12 checkpoint frames captured, 0 black (baseline: 0 black).[pass] input_response: 4 of 4 input cycles changed the picture and changed it back (baseline: 4 of 4).[pass] matches_baseline: 12 of 12 checkpoint frames within 25 of the baseline (largest difference 12.0).I did not record a visual judgement of the frames.
Non-blocking.
unplaced_memory_buffer'srefusalparameter still applies.Verdict: approve on
780f53fd. R0Y00's changes request onef94abddstill stands, so I am not merging. The slot 70 page-move case added ineb6b918bis meant to answer it.Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. The hardware tests ran with
X2W_TEST_DEBUG_LAYER=1.CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass on780f53fd.This reply was AI-assisted.
@lukaslw-lab on GitHub · 2026-11-29 12:11 UTC · original · reviewed
Reviewed
780f53fd: read the diff, then merged it into a local build, ran its tests with ours (startup_srv_refusal_cache*,startup_memory_srv*,startup_address_srv*,startup_address_buffer_srv*,startup_placed_buffer_range*, plus our table-lock, view-token and retire families: 57/57 passed in release) and measured it in an A/B below. No code findings beyond the reviews above; adding numbers for the unmeasured speed-up.Workload. A 360 s startup run from a save on main
46226004+ #3097 with the opt-in D3D12 switches on (without this PR) ends withmemory SRV refusals (slot 70): total 4,732,251, of thembuffer_unavailable 4,625,002: about 12,800 per second, roughly 610 per frame, against 545,784 in the log the body cites. Slot 70 writes in the same run: 35,082,001 calls. The refusals come from 81 distinctbuffer_unavailableshapes (memory SRV refused shape N).A/B. Same build with and without this PR (
780f53fdmerged locally; the conflicts with #3393's table lock ind3d12_capture.inlandd3d12_xs_device.cppresolved by keepingTableWriteLockand addingnote_placement_change()), same switches, shader cache and input; means over 250–360 s, after the load has settled:buffer_unavailable(whole run)refuse_memory_srv), so the log cannot tell how often the cache hits. A total hit and miss counter in the existing census line would show whether the 256 slots keep this workload's refusals, or whether entries expire (250 ms, 1024 hits) or are pushed out before they are reused.RTX 3080 Ti, driver 32.0.16.1047, Windows 10 19045.
@JohnConnorNPC on GitHub · 2026-11-29 13:10 UTC · original
Thanks for the slot-collision case in
780f53fd. I re-checked the head against currentmain(c04e0dd6). The branch needs a merge ofmainbefore it can land, so I didn't re-review it in depth.git merge-tree --write-tree c04e0dd6 780f53fdexits 1, with conflicts insrc/startup_stubs/d3d12_capture.inl(two hunks) andsrc/startup_stubs/d3d12_xs_device.cpp(thepublish_placementcall). All three are against #3393's table lock. A resolution that keepsmain'sTableWriteLock(and thestd::optional<TableWriteLock>aroundpublish_placement) and addsnote_placement_change()looks enough. Innote_resourceit goes beside the lock. Inretire_placementit goes inside theif, afterplacement = Placement::none. Inpublish_placementit goes in the index callback. Could you mergemain(or rebase) and re-run the targeted tests on the merged head?tests/startup_srv_refusal_cache_check.cppfrom the head withg++ -std=c++17 -Wall -Wextraon Linux, and it givessrv refusal cache checks passed(rc=0). The three mutants that survived oneb6b918bnow fail. Dropping!(e.key == key)from both hit checks gives rc=1,FAIL found a slot collision for device. Droppingdevice ==fromoperator==gives the same line, rc=1. Droppingview_b ==gives rc=1,FAIL found a slot collision for view_b.srv_refusal_cache.his unchanged (sha25684838f9fda70).R0Y00's changes request on
ef94abddstill stands, so this needs their re-review once the conflict is resolved.Environment: Linux only: git objects,
git merge-tree, and the header test with its three mutants on scratch copies. I did no Windows, WARP or GPU run.This comment was AI-assisted.
@tedin7 on GitHub · 2026-11-30 13:58 UTC · original
Merged current
main(077bff3ac) to resolve conflicts; Linux C++ tests and negative controls pass.@lukaslw-lab on GitHub · 2026-11-30 18:00 UTC · original · reviewed
Reviewed
ca9b3164by reading the diff; not built or run. Our earlier A/B ran780f53fd. Themainmerge changes none of this PR's own lines.Verdict: comment. No MUST. The lookup is exact, but publishing requests now do extra work, and nothing shows that the cache hits yet.
src/startup_stubs/d3d12_memory_srv.inl:801).buffer_refusal_stampmakes one region-information call beforehit()on every buffer request. Before this PR, a request that publishes throughexisting_memory_buffer(line 814) made no memory query. Onlyfully_committedandwitness_pageentries compare the stamp, andnote()needs it only on a refusal. Reading the generation first, as now, and the stamp only after a key match whose proof needs it, or on the refusal path, keeps the lookup exact. In our run, slot 70 had 34.75 M calls, 5.85 M of thembuffer_unavailable. The census does not show how many are buffer requests that publish.Device::slot133), and each creation empties all 256 slots.note_lock, including the release to zero refs (d3d12_xs_device.cpp:1245). Scans take that lock after reading the generation, so a concurrent change can only make an entry stale.Tests:
startup_srv_refusal_cacheand its eight controls test the header with a fake page query. Thestartup_address_srvdraws 15 and 16 check that a retry publishes after a page move and after a release. CI ran none of them: theprfilter matches none of these tests.Run: main
46226004+ #3097, 360 s from a save, RTX 3080 Ti, driver 32.0.16.1047, Windows 10 19045.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.