Repository navigation
Conversation
…ZY_TEXTURES=1 Fixes R0Y00#2764, Refs R0Y00#2379, R0Y00#1199
# Conflicts: # docs/experiments.md # docs/startup-runtime.md
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
KelboLive
left a comment
There was a problem hiding this comment.
LGTM — clean opt-in lazy materialization of slot-133 read-only textures.
- Defers desktop CreateCommittedResource until first copy, CPU-map, or translated draw bind.
- Null placeholder SRV descriptors refresh in place on materialization, including CopyDescriptorsSimple copies.
- Untouched textures retire cleanly at guest Release(); in-flight computes stay live via retire_hold.
- Lock ordering (draw_lock -> lazy_texture_mutex -> note_lock -> retire_lock) and publication hook handle descriptor race windows.
- Test fixture covers budget delta, selective materialization, SRV refresh with copies, prepare/overwrite/resume race, and Release-before-first-use dispatch_translated path.
- Documentation updated in experiments.md and startup-runtime.md.
The approach is consistent with existing slot-133 and retired-resource patterns.
KelboLive
left a comment
There was a problem hiding this comment.
LGTM — clean opt-in lazy materialization of slot-133 read-only textures.
- Defers desktop CreateCommittedResource until first copy, CPU-map, or translated draw bind.
- Null placeholder SRV descriptors refresh in place on materialization, including CopyDescriptorsSimple copies.
- Untouched textures retire cleanly at guest Release(); in-flight computes stay live via retire_hold.
- Lock ordering (draw_lock -> lazy_texture_mutex -> note_lock -> retire_lock) and publication hook handle descriptor race windows.
- Test fixture covers budget delta, selective materialization, SRV refresh with copies, prepare/overwrite/resume race, and Release-before-first-use dispatch_translated path.
- Documentation updated in experiments.md and startup-runtime.md.
The approach is consistent with existing slot-133 and retired-resource patterns.
Leyukaka
left a comment
There was a problem hiding this comment.
Changes requested on 0218284. Evidence: reading the diff, the head blobs and main 212d4b5, plus git merge-tree. Nothing was built or run; the race and the surviving mutations below are found by reading, not reproduced.
Blocking:
- The Write/ReadFromSubresource/GetHeapProperties trigger is unreachable.
forward_slotmaterializes underif constexpr (N == 12 || N == 13 || N == 14)(d3d12_xs_device.cpp:762-763), butbuild_tablesinstalls resource slots 8-11 only (:8133-8136; :8137-8138 "Desktop Resource 12-14 ... are not installed until a call site confirms them") andenable_objectforwards 3-6 (:7985-7988). docs/startup-runtime.md lists these three calls as materialization triggers. Fix: remove the branch and the doc entry, or install the slots with a test. - The CBV view record shrinks from 16 to 12 bytes (:5180
N == 17 ? 12; main :5267N == 17 ? 16). It came in with 9bab583, is not in #2773 (7986f2a), is not gated by the switch and is not mentioned in the PR body.note_viewhashes the stored bytes, so slot-17 views that differ only in bytes 12-15 now share one id, and every slot-17 record reportsdesc_bytes12. The new fixture creates no slot-17 view. Fix: move it to its own PR with a test, or drop it. resource_mapmaterializes only when the resource has no guest memory pointer yet (:4878-4880), and the lazy path sets that pointer to the placement address (:5868). For a non-null address, Map returns that address and never materializes, same as the eager path (:5910). Both docs list Map as a trigger. Fix: drop it from the trigger lists, or say it applies to no slot-133 texture.
Refresh ordering (read from the code):
view_slotwrites the desktop descriptor at :5383 and updates the shadow afterwards, inrecord_view->note_view(:5389).materialize_lazy_textureruns its refresh after releasinglazy_texture_mutex(:6156), checksshadow[slot] == record_idunder note_lock shared and writes T's SRV (:6190-6211). If another thread's desktop write for view X lands before that check and itsnote_viewafter it, the slot holds T while its record names X. The comment at :6188-6189 does not cover this, because the desktop write is outside note_lock.copy_descriptor_runhas the same window: CopyDescriptorsSimple at :5489,note_copyat :5490.refresh_copied_lazy_viewsthen repairs the slot only if the copied record names a lazy texture (:5459-5461).- The 4b hook runs complete slot-24 and slot-18 calls (desktop write and shadow update) between the snapshot and the refresh, so it does not exercise this ordering.
- Fix: do the desktop write and the shadow update under one lock in both paths, or have the refresh take a lock the writers hold across both steps.
Applies with the switch off; the off control returns after the creation checks (test :491-520) and reaches none of it:
forward_slotreturns 0, S_OK, DXGI_ERROR_NOT_FOUND or E_FAIL for any wrapper with a nullreal(:760-771), on slots 3-6 of every kind. main dereferences it (:765).record_translated_dispatchcallsretire_holdfor every non-tiled sampled input (d3d12_compute_dispatch.inl:798), which changes X2W_D3D12_RELEASE_RETIRED=1 for textures that are not lazy.device_residencydrops null entries and returns S_OK when none remain (:1417-1420).- Fix: gate these on the switch, or extend the
offcontrol to run them.
Error reporting: the eager path returns the CreateCommittedResource failure (:5902); the lazy path returns S_OK for any description (:5879-5880) and the failure shows only at first use. Worth a line in the docs.
Tests:
- The pull_request job runs
cmake --build --preset prandctest --preset pr(windows.yml:489-493). Neither theprtargets nor its test filter in CMakePresets.json includestartup_slot133_lazy_textures_*, so run 46140793329 did not build or run the fixture. docs/experiments.md reports the debug1 cases skipped (77). Fix: add the target and the WARP cases to theprpreset. - The fixture uses one 2D R8G8B8A8_UNORM texture shape, 1 mip, with a described TEXTURE2D SRV. By reading, these changes would not fail it:
- any edit to the resource-dimension branches of
lazy_null_srv_desc(:5118-5137), reached only without a described dimension; - the packed-format lazy branch in
view_slot(:5306-5308); - the UNKNOWN-dimension and short-record paths of
create_lazy_srv(:5422-5433); - reverting the CBV change.
- any edit to the resource-dimension branches of
Rebase: git merge-tree --write-tree origin/main reports two conflicts, both with main's trace_compute_output_use lines: list_copy_buffer_region in list_copy.inl and resource_unmap in d3d12_xs_device.cpp. #2773 is still open at 7986f2a, an ancestor of this head.
|
Review of head This needs a rebase. SHOULD
MUST I won't repeat the blocking points of the open changes request on this head, or the duplicate with #2773. Both still apply. Held: conflicting, with a standing changes request. AI-assisted. |
This is the replacement review PR for #2773, synchronized with upstream
mainat24fcd0b5742abb2fcaba8066093d70829df956a3. The merge exposed a fixture-only mismatch: current main requires anativecompiler-revision marker on synthetic compute manifests, so the slot-133 fixture now writesx2w::native_compute_output_revision. No slot-133 runtime behavior was changed to accommodate the test.The original PR remains open and overlaps this revision. Please keep only one and mark #2773 as superseded if this replacement is selected; this PR does not close it.
Validation
cmake --build out\build\release --target startup_slot133_lazy_textures_check startup_stream_consumer d3d12_xs_shim— passed in Release.ctest --test-dir out\build\release --no-tests=error -R '^(startup_resource_retire_title_(warp_debug0|off_warp|hardware_debug0|off_hardware)|startup_resource_retire_views_(warp_debug0|keep_warp|noretire_warp)|startup_slot133_lazy_textures_(warp_debug0|hardware_debug0|noretire_warp|off_warp)|startup_view_census_(warp|off_warp|vary_warp)|startup_view_alloc_(records|materialized|ids)(_control)?_warp|startup_title_heap_device_warp)$' --output-on-failure— 21/21 passed, including all slot-133 cases and the reported Release retirement cases.$env:X2W_D3D12_PERMISSIVE='1'; $env:X2W_D3D12_DEBUG='1'; python -B tests\startup_sampler_heap_check.py wrapped out\build\release\d3d12_xs.dll warp— passed; descriptor-token copies matched.$env:X2W_FXC='C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\fxc.exe'; python -B tests\startup_frame_copy_check.py out\build\release\startup_stream_consumer.exe warp— passed; 32 pixels exact, one refresh for changed contents and none for unchanged contents.startup_slot133_lazy_textures_hardware_debug0and both resource-retirement hardware cases passed on NVIDIA GeForce RTX 3050 6GB Laptop GPU, driver32.0.16.2140, Windows 10 Pro 26H2 build26300.10075, debug layer off; tested commit02182842cc3d0c7b5ebaec9c46077d9b6dfe8f23./O2job was skipped.