Repository navigation
Conversation
…y from a snapshot, and bind unbound inputs as zeros A compute input in a placed buffer that does not alias title memory is a committed default buffer that holds zeros, so the bytes the title wrote exist only in title memory. With X2W_TRANSLATED_TITLE_INPUT_SNAPSHOT=1 (opt-in) the range (at most 16 MiB) is copied into a dedicated upload pool (128 MiB) so draw and texture uploads cannot starve it. A compute input whose four descriptor words are all zero is an unbound buffer: it reads zeros (16 bytes) instead of refusing the dispatch; an empty range with any non-zero word is still refused. The log names the source of each input and the render totals count GPU copies and snapshots.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9fbfc86a3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
…rect the launcher doc
|
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
AI-assisted; commands listed were executed locally. |
KelboLive
left a comment
There was a problem hiding this comment.
Good work on this. The approach is sound:
-
Dual upload pools (snapshot 128 MiB vs draw/texture 256 MiB) correctly prevents snapshots from starving draw uploads
-
Resolution order is correct: GPU copy (from X2W_TRANSLATED_INDIRECT_COPY_RANGES) -> snapshot -> refusal. The fallback chain is safe and the 16 MiB cap on snapshots is reasonable
-
Null descriptor handling: correctly produces 16 bytes of zeros for all-zero descriptor words, matching hardware behavior. The readable_window check before ring_copy is the right guard
-
indirect_table_buffer API expansion: added allow_title_snapshot parameter cleanly propagated from record_translated_dispatch
-
Tracking counters: atomic counters with snapshot KiB tracking gives good observability
Minor notes:
- The InputSource source field in IndirectBufferView is a clear 4-value enum. When this stabilizes consider a typed enum (similar to NullCause) rather than int, but not urgent
- The 128 MiB / 256 MiB split is hardcoded. If title pressure shows the pool balance needs tuning, make the split configurable. Not needed today
Looks good to merge. This unblocks #2860 and forms a solid foundation for the upload ring reuse work in #2847.
|
A run report for this PR, combined with #2902, on a local capture (counts only). The build and the run were done in an offline Windows Sandbox:
Without this PR (#2902 alone), the three compute pipelines that #2902 translates are all refused at Dispatch with With this PR:
One difference from this PR as written: the merge with #2849 conflicted in In an earlier run of the same merge, the title went past its first screen:
That run used the shared ring above, so it says nothing direct about the separate pool. AI-assisted. |
|
@Leyukaka thank you for this run report, and for testing this PR together with #2902 on top of current main. Two things we take from it:
This PR currently conflicts with main in AI-assisted; commands listed were executed locally. |
…ts get their own recycled pool Main's shared upload ring (reused once no recording can submit a chunk and every queue that used it has finished) is kept as it is. The snapshots take a second pool built the same way (128 MiB, chunks numbered after the ring's in the recording mask and the per-queue table) instead of the shared ring or a never-reused one, so a long run is not stopped by a full pool; the long-run case dispatches 384 MiB of snapshots over 48 frames.
… alias title memory, and asserts the snapshot log line
|
Stage-2 gate on the redesigned head (own recycled snapshot pool on top of #2849): Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
Mutant check (snapshot pool never recycled, AI-assisted; commands listed were executed locally. |
Part of #870
Fixes #2860
What this unblocks: translated compute dispatches whose input buffers were written by the title (placed buffers that do not alias title memory) and dispatches with an unbound input run instead of being refused, also in a long run.
Change
Runtime only (
d3d12_draw.inl,d3d12_xs_device.cpp,upload_reservation.h), plus a docs paragraph and test modes:X2W_TRANSLATED_TITLE_INPUT_SNAPSHOT=1(opt-in): an input in a placed buffer that does not alias title memory is read from a GPU copy this list made, else from a snapshot of at most 16 MiB copied from title memory at the dispatch.snapshot ring reservation refused: no unused capacity(report), and a pool that is never reused fills up over time. A reservation the pool cannot serve logsx2w-draw snapshot pool reservation refused: no unused capacity.Verification
Linux (executed locally):
git diff --check origin/main...HEAD: cleancmake -S . -B <dir> -DDXC_EXECUTABLE=/bin/true: configure rc 0tests/upload_reservation_check.cpp(newcheck_snapshot_pool: pool numbering, holds and discard in both pools, per-queue completion of a snapshot chunk, reuse of a finished unheld chunk) built with g++ and run: passesx86_64-w64-mingw32-g++ -fsyntax-only -std=c++20ond3d12_xs_device.cpp: no error in the changed code (the MinGW headers stop on MSVC-only constructs thatorigin/mainhas too)Win2025 (Windows Server 2025, Build 26100, MSVC 14.44.35207, D3D12 WARP) at
73b2d0ff73921cce81188d3e11cda6064ac3de87:ctest --preset dev -R '^(startup_compute_dispatch_input_|upload_reservation$)' --no-tests=error --output-on-failure: 3/3 passed (startup_compute_dispatch_input_warp,startup_compute_dispatch_input_hardware,upload_reservation)ctest --preset release -R '^(startup_compute_dispatch_input_|upload_reservation$)' --no-tests=error --output-on-failure: 3/3 passeddev:startup_compute_dispatch_input_warpand_hardwarefail withAssertionError: dispatch-input-snapshot-long: consumer exit 85afterx2w-draw snapshot pool reservation refused: no unused capacity;upload_reservationpasses.Tests:
startup_compute_dispatch_inputkeepsdispatch-input-snapshot(off: refused; on: all 320 words match; zero title memory runs on zeros) anddispatch-input-null, and addsdispatch-input-snapshot-long: 48 frames of dispatches whose 8 MiB title-memory input is snapshotted each frame with the queue completed between frames (384 MiB in all, three times the pool). Every frame must translate and give the first frame's words, the last frame must match the CPU reference on the D3D12 adapter, and no reservation may be refused.Real-hardware testing: @Makto94 - thanks for the help.
Source: Microsoft D3D12 documentation (placed resources, upload heaps, raw buffer SRVs).