GPU: preserve execution ordering for buffer copies #387

Open
github-bot wants to merge 14 commits from github-bot/gh-387 into main AGit
Owner

@⁠aycow on GitHub · 2026-11-24 02:51 UTC · original
aycow:fix/gpu-buffer-copy-ordering → main · +1813 −128 · 8 files · 14 commits · open

Change

A title buffer copy or unaligned root CBV can read CPU staging before an earlier GPU write in the same title command list has run. The recording now cuts at a read of a known overlapping producer. Submission preparation completes the producer group before filling the dependent staging buffer. Unrelated work still batches.

The planner checks alias byte ranges for the dependency and whole pages for potentially withheld writes. For a staged reader after the last computed-address list, the host checks the mapping marks after the native fence. It publishes the prefix before preparing that reader only if no mapping missed and frame-level withholding is inactive. Otherwise the reader stages from published title memory. Actual withheld pages also guard against ordinary copyback through the same shadow.

An ordered buffer copy can now precede a refresh of the same shadow. On a miss, the fenced GPU ranges stay private and the refresh runs around them. Only the bytes the kernel reports writing to the title destination are reflected in those ranges, including writes through a known physical alias. Opaque host writes remain grouped.

A direct buffer-only root-CBV reader can now stage from a fenced producer before a later computed dispatch. This retains the address-map layout used by the producer and tracks the reader's derived buffer outputs through the final miss decision. Exact-range and marked-page copyback both hold those outputs on a miss. Independent writes still publish.

The interleaved path requires a single ordinary direct dispatch with known buffer outputs and a later buffer-only computed phase. Untracked readbacks, texture or dynamic descriptor effects, ambiguous shadow ownership, and replays across the phase boundary keep the original scheduling. These cases can still read the earlier published value. The PR leaves those paths available and does not change the scope of the title-memory miss policy.

An eligible staged read adds a native fence. Title workload frequency and cost remain unmeasured.

Synthetic validation

The current-main control at 13f91ca read 11 after a producer wrote 29. The revised title queue's CopyBufferRegion and all staged-CBV controls read 29. The plain WARP run required a device and passed 201 diagnostics GPU tests, with one ignored. Strict GPU diagnostics Clippy passed.

AMD Radeon Graphics, GeForce RTX 5070 Laptop GPU, and WARP passed the staged CBV, real title buffer copy, and write-withholding controls with full GPU-based validation. The native validation used a local Agility 1.620.2 adapter setup and startup sampler workaround. Neither is part of this PR.

On 53e5ee0, the computed fixture passed on AMD Radeon Graphics, GeForce RTX 5070 Laptop GPU, and WARP with full GPU-based validation. The staged root CBV and CPU copy both read 29 after a clean producer and 11 after a fresh miss or inherited withholding. The same-page refresh regression also preserved 29 for the native consumer and 55 from the neighboring CPU copy while withholding the computed dword from title memory. The hardware setup used Agility 1.620.2 with local startup compatibility adjustments for sampler validation and descriptor heap probing.

On f66fc14, the clean overlapping-copy case delivered 29 to the copied dword and the native consumer. After a miss, the private consumer retained 29, the neighboring CPU copy reached it as 55, and title memory retained 11 at the withheld source. AMD Radeon Graphics, GeForce RTX 5070 Laptop GPU, and WARP passed with the same full GPU-based validation setup. Additional controls cover physical aliases, same-value CPU overwrites, and unmapped destinations.

On be723f7, AMD Radeon Graphics, NVIDIA RTX 5070 Laptop GPU, and WARP passed six focused tests each with full GPU-based validation. The translated GFX10 root-CBV fixture validated its emitted DXIL and used the normal binding and dispatch path. All three native stages read 29. A clean run published [29, 29, 29]. A data-dependent late miss left title memory at [11, 0, 0] for both exact and page-marked derived writes, kept the unrelated output at 29, and caused the next refresh to discard the private value. A readback completion handler disabled private staging.

The WARP submission-count control measured one native submission for disjoint work, and two for each dependent read. Closed-list replay reproduced the correct copied value. Tests include the same-page withholding case and the opaque-address case. The checks use original synthetic data. Title frame time remains unmeasured.

$env:VICTORY_TEST_ORDERING_REQUIRE_GPU = '1'
$env:VICTORY_D3D12_WARP = '1'
cargo test --locked -p victory-gpu --features diagnostics --lib a_gpu_producer_feeds_the_real_root_cbv_staging_path -- --nocapture --test-threads=1
cargo test --locked -p victory-gpu --features diagnostics --lib title_copy_buffer_region_reads_its_earlier_gpu_producer -- --nocapture --test-threads=1
cargo test --locked -p victory-gpu --features diagnostics --lib host::withholding:: -- --test-threads=1
cargo test --locked -p victory-gpu --features diagnostics --lib computed_tail_reads_after_the_fence_without_publishing_a_miss -- --ignored --nocapture --test-threads=1
cargo test --locked -p victory-gpu --features diagnostics --lib computed_tail_preserves_the_private_producer_across_a_page_refresh -- --ignored --nocapture --test-threads=1
cargo test --locked -p victory-gpu --features diagnostics --lib translated_root_cbv_writes_stay_private_on_late_miss -- --ignored --nocapture --test-threads=1
cargo test --locked -p victory-gpu --features diagnostics --lib translated_root_cbv_writes_publish_without_late_miss -- --ignored --nocapture --test-threads=1
cargo test --locked -p victory-gpu --features diagnostics --lib a_readback_sink_disables_private_staging -- --ignored --nocapture --test-threads=1

The existing branch history retains the earlier continuation and copyback work, including jeremygold02's independent WARP validation. This revision uses main's current command-list segmentation and copyback. Earlier validation · Previous head

AI-assisted using OpenAI Codex.

**@⁠aycow** on GitHub · 2026-11-24 02:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/387) `aycow:fix/gpu-buffer-copy-ordering` → `main` · +1813 −128 · 8 files · 14 commits · open ## Change A title buffer copy or unaligned root CBV can read CPU staging before an earlier GPU write in the same title command list has run. The recording now cuts at a read of a known overlapping producer. Submission preparation completes the producer group before filling the dependent staging buffer. Unrelated work still batches. The planner checks alias byte ranges for the dependency and whole pages for potentially withheld writes. For a staged reader after the last computed-address list, the host checks the mapping marks after the native fence. It publishes the prefix before preparing that reader only if no mapping missed and frame-level withholding is inactive. Otherwise the reader stages from published title memory. Actual withheld pages also guard against ordinary copyback through the same shadow. An ordered buffer copy can now precede a refresh of the same shadow. On a miss, the fenced GPU ranges stay private and the refresh runs around them. Only the bytes the kernel reports writing to the title destination are reflected in those ranges, including writes through a known physical alias. Opaque host writes remain grouped. A direct buffer-only root-CBV reader can now stage from a fenced producer before a later computed dispatch. This retains the address-map layout used by the producer and tracks the reader's derived buffer outputs through the final miss decision. Exact-range and marked-page copyback both hold those outputs on a miss. Independent writes still publish. The interleaved path requires a single ordinary direct dispatch with known buffer outputs and a later buffer-only computed phase. Untracked readbacks, texture or dynamic descriptor effects, ambiguous shadow ownership, and replays across the phase boundary keep the original scheduling. These cases can still read the earlier published value. The PR leaves those paths available and does not change the scope of the title-memory miss policy. An eligible staged read adds a native fence. Title workload frequency and cost remain unmeasured. ## Synthetic validation The current-main control at `13f91ca` read `11` after a producer wrote `29`. The revised title queue's `CopyBufferRegion` and all staged-CBV controls read `29`. The plain WARP run required a device and passed 201 diagnostics GPU tests, with one ignored. Strict GPU diagnostics Clippy passed. AMD Radeon Graphics, GeForce RTX 5070 Laptop GPU, and WARP passed the staged CBV, real title buffer copy, and write-withholding controls with full GPU-based validation. The native validation used a local Agility 1.620.2 adapter setup and startup sampler workaround. Neither is part of this PR. On `53e5ee0`, the computed fixture passed on AMD Radeon Graphics, GeForce RTX 5070 Laptop GPU, and WARP with full GPU-based validation. The staged root CBV and CPU copy both read `29` after a clean producer and `11` after a fresh miss or inherited withholding. The same-page refresh regression also preserved `29` for the native consumer and `55` from the neighboring CPU copy while withholding the computed dword from title memory. The hardware setup used Agility 1.620.2 with local startup compatibility adjustments for sampler validation and descriptor heap probing. On `f66fc14`, the clean overlapping-copy case delivered `29` to the copied dword and the native consumer. After a miss, the private consumer retained `29`, the neighboring CPU copy reached it as `55`, and title memory retained `11` at the withheld source. AMD Radeon Graphics, GeForce RTX 5070 Laptop GPU, and WARP passed with the same full GPU-based validation setup. Additional controls cover physical aliases, same-value CPU overwrites, and unmapped destinations. On `be723f7`, AMD Radeon Graphics, NVIDIA RTX 5070 Laptop GPU, and WARP passed six focused tests each with full GPU-based validation. The translated GFX10 root-CBV fixture validated its emitted DXIL and used the normal binding and dispatch path. All three native stages read `29`. A clean run published `[29, 29, 29]`. A data-dependent late miss left title memory at `[11, 0, 0]` for both exact and page-marked derived writes, kept the unrelated output at `29`, and caused the next refresh to discard the private value. A readback completion handler disabled private staging. The WARP submission-count control measured one native submission for disjoint work, and two for each dependent read. Closed-list replay reproduced the correct copied value. Tests include the same-page withholding case and the opaque-address case. The checks use original synthetic data. Title frame time remains unmeasured. ```powershell $env:VICTORY_TEST_ORDERING_REQUIRE_GPU = '1' $env:VICTORY_D3D12_WARP = '1' cargo test --locked -p victory-gpu --features diagnostics --lib a_gpu_producer_feeds_the_real_root_cbv_staging_path -- --nocapture --test-threads=1 cargo test --locked -p victory-gpu --features diagnostics --lib title_copy_buffer_region_reads_its_earlier_gpu_producer -- --nocapture --test-threads=1 cargo test --locked -p victory-gpu --features diagnostics --lib host::withholding:: -- --test-threads=1 cargo test --locked -p victory-gpu --features diagnostics --lib computed_tail_reads_after_the_fence_without_publishing_a_miss -- --ignored --nocapture --test-threads=1 cargo test --locked -p victory-gpu --features diagnostics --lib computed_tail_preserves_the_private_producer_across_a_page_refresh -- --ignored --nocapture --test-threads=1 cargo test --locked -p victory-gpu --features diagnostics --lib translated_root_cbv_writes_stay_private_on_late_miss -- --ignored --nocapture --test-threads=1 cargo test --locked -p victory-gpu --features diagnostics --lib translated_root_cbv_writes_publish_without_late_miss -- --ignored --nocapture --test-threads=1 cargo test --locked -p victory-gpu --features diagnostics --lib a_readback_sink_disables_private_staging -- --ignored --nocapture --test-threads=1 ``` The existing branch history retains the earlier continuation and copyback work, including jeremygold02's independent WARP validation. This revision uses main's current command-list segmentation and copyback. [Earlier validation](https://git.gtahub.st/github/Marvisak--VIctory/pulls/387) · [Previous head](https://github.com/aycow/VIctory/tree/0899b7d7fd97e1e3d3fc54c1a2d8473a698e0c5c) AI-assisted using OpenAI Codex.
The CPU may change constants inside a broad UAV declaration during submission preparation. Refresh them before GPU execution and keep an accurate copyback baseline.

Reported-by: Kevin Pratap Sidhu <[email protected]>

Reference: 7a037533f8
Use the existing title-byte dependency planner when a submission records shader-side buffer writes, including submits without buffer-copy continuations. Split at overlapping staged reads and retain a single native submission for non-overlapping work.
Exercise the live unaligned root CBV route and the title CopyBufferRegion thunk, with direct-aligned and separately submitted controls. Keep the known failing tests opt-in.
Check mapping misses after the last computed list and before publishing its data to a dependent CPU fill or buffer copy. Keep page refreshes in one batch when they can replace a private producer. Suppress ordinary copyback that overlaps actual withheld pages of the same shadow.
After a miss at the final computed-address boundary, protect fenced writer ranges from whole-page refreshes. Forward only destination spans the kernel reports delivering, including through known title mappings, and update comparison snapshots for those spans. Keep opaque host writes grouped.
Stage a dependent root CBV privately only across bounded buffer dispatches with known outputs. Keep the prefix address-map layout and suppress both marked-page and exact-range writes derived from the private input until the full submission decides whether to publish. Preserve independent writes and use the original schedule when effects cannot be tracked.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:02:07 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:24 UTC · original

Thanks @⁠aycow for the execution-order regression coverage. I tested head b5d18276f5160fa60ac49c1f3c34ea2bbf8059a6 with the buffer-copy GPU tests:

$env:VICTORY_TEST_BUFFER_COPY='1'; $env:VICTORY_D3D12_WARP='1'; cargo test --locked -p victory-gpu --features diagnostics --lib list::buffer_copy_tests:: -- --test-threads=1

Result: 17 passed, 0 failed (46 filtered out). The cases cover ordered copies across lists/submissions, CPU/GPU staging handoffs, overlapping and disjoint ranges, copyback, and resource lifetime. I also tried the optional GPU-based-validation flag, but its debug-layer initialization was unavailable (0x887A002D); the test suite passed with that optional mode disabled.

**@⁠jeremygold02** on GitHub · 2026-11-24 04:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7121995395) Thanks @⁠aycow for the execution-order regression coverage. I tested head `b5d18276f5160fa60ac49c1f3c34ea2bbf8059a6` with the buffer-copy GPU tests: ``` $env:VICTORY_TEST_BUFFER_COPY='1'; $env:VICTORY_D3D12_WARP='1'; cargo test --locked -p victory-gpu --features diagnostics --lib list::buffer_copy_tests:: -- --test-threads=1 ``` Result: 17 passed, 0 failed (46 filtered out). The cases cover ordered copies across lists/submissions, CPU/GPU staging handoffs, overlapping and disjoint ranges, copyback, and resource lifetime. I also tried the optional GPU-based-validation flag, but its debug-layer initialization was unavailable (`0x887A002D`); the test suite passed with that optional mode disabled.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 04:29 UTC · original

Thanks, @⁠jeremygold02, for independently running all 17 buffer-copy tests on WARP and for including the exact command and head. The 0x887A002D detail also helps distinguish this run from the separate Agility SDK GPU-validation pass. I’m following up on the dirty-copy timing to see how much is spent refreshing source bytes, waiting for GPU completion, and copying writes back.

**@⁠aycow** on GitHub · 2026-11-24 04:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7122062656) Thanks, @⁠jeremygold02, for independently running all 17 buffer-copy tests on WARP and for including the exact command and head. The `0x887A002D` detail also helps distinguish this run from the separate Agility SDK GPU-validation pass. I’m following up on the dirty-copy timing to see how much is spent refreshing source bytes, waiting for GPU completion, and copying writes back.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 04:46 UTC · original

Thanks again for the independent WARP run. The draft now includes df2276b, which speeds up dirty-buffer copyback while preserving the bytewise merge when the title changed memory after the GPU snapshot.

In eight alternating optimized AMD samples per revision, median total time for 128 dirty 1 MiB copies fell from 191.12 to 102.55 ms. The sparse workload fell from 90.72 to 73.77 ms. Both revisions produced matching outputs and byte counts. All 18 focused cases passed on AMD, NVIDIA, and WARP with the D3D12 debug layer and full GPU-based validation. The actual #322 composition also passed its mapping controls and the copy cases.

Could an independent tester run a controlled in-game A/B of b5d1827 and df2276b with the same integration stack, scene, settings, and diagnostics flags? Total submission time, copyback time and bytes, and frames completed before any device removal would help distinguish the copyback gain from timing variance.

**@⁠aycow** on GitHub · 2026-11-24 04:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7122328223) Thanks again for the independent WARP run. The draft now includes `df2276b`, which speeds up dirty-buffer copyback while preserving the bytewise merge when the title changed memory after the GPU snapshot. In eight alternating optimized AMD samples per revision, median total time for 128 dirty 1 MiB copies fell from 191.12 to 102.55 ms. The sparse workload fell from 90.72 to 73.77 ms. Both revisions produced matching outputs and byte counts. All 18 focused cases passed on AMD, NVIDIA, and WARP with the D3D12 debug layer and full GPU-based validation. The actual #322 composition also passed its mapping controls and the copy cases. Could an independent tester run a controlled in-game A/B of `b5d1827` and `df2276b` with the same integration stack, scene, settings, and diagnostics flags? Total submission time, copyback time and bytes, and frames completed before any device removal would help distinguish the copyback gain from timing variance.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 18:13 UTC · original

Published 709647f on this branch, following @⁠KevinPratap's #1322 repro. Current UAV declarations are now recorded during preparation and snapshotted before execution, after synchronous CPU refreshes. The focused fixture changed the observed constant from 11 to 43 and preserved the GPU write (77) and later CPU write (61). All 19 buffer-ordering tests passed on each of AMD Radeon Graphics, RTX 5070 Laptop and WARP with full GBV. Both workspace Clippy configurations passed. Duff's changed-byte concurrent copyback work (#1024) remains a separate candidate for measuring fragmented writes.

**@⁠aycow** on GitHub · 2026-11-24 18:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7140337928) Published 709647f on this branch, following @⁠KevinPratap's #1322 repro. Current UAV declarations are now recorded during preparation and snapshotted before execution, after synchronous CPU refreshes. The focused fixture changed the observed constant from 11 to 43 and preserved the GPU write (77) and later CPU write (61). All 19 buffer-ordering tests passed on each of AMD Radeon Graphics, RTX 5070 Laptop and WARP with full GBV. Both workspace Clippy configurations passed. Duff's changed-byte concurrent copyback work (#1024) remains a separate candidate for measuring fragmented writes.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 18:47 UTC · original

I tested a new byte-precise candidate composed on 709647f, retaining Duff's authored change. SIMD comparison, a 4 KiB fallback for inaccessible neighbors, and fewer journal operations passed all 23 tests on AMD Radeon Graphics, RTX 5070 Laptop and WARP with full GBV. The partially mapped fixture preserved all 1,008 valid writes and took 2.786 ms of CPU copyback.

For five alternating optimized Windows samples over 4 MiB, old byte runs versus this candidate were 6.713→2.217 ms dense, 4.234→1.658 ms sparse, and 784.636→634.196 ms fragmented. The changed-byte candidate remains separate from this draft because fragmented workloads still need one guarded kernel write per run. A protection query or VirtualLock is insufficient to guarantee the saved destination mapping survives through direct stores. The synchronous ordering fix on the draft stays independently reviewable.

**@⁠aycow** on GitHub · 2026-11-24 18:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7141146594) I tested a [new byte-precise candidate](https://github.com/aycow/VIctory/blob/5b3f458/docs/copyback-changed-byte-cost.md) composed on 709647f, retaining Duff's authored change. SIMD comparison, a 4 KiB fallback for inaccessible neighbors, and fewer journal operations passed all 23 tests on AMD Radeon Graphics, RTX 5070 Laptop and WARP with full GBV. The partially mapped fixture preserved all 1,008 valid writes and took 2.786 ms of CPU copyback. For five alternating optimized Windows samples over 4 MiB, old byte runs versus this candidate were 6.713→2.217 ms dense, 4.234→1.658 ms sparse, and 784.636→634.196 ms fragmented. The changed-byte candidate remains separate from this draft because fragmented workloads still need one guarded kernel write per run. A protection query or VirtualLock is insufficient to guarantee the saved destination mapping survives through direct stores. The synchronous ordering fix on the draft stays independently reviewable.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 19:01 UTC · original

Published 0899b7d to this PR. Exact rgarage and 709647f both reproduced stale staged root and table constants (11) when an earlier closed list in the same submission wrote 29. The normal path had bypassed title-byte dependency planning when no buffer-copy continuation existed. The fix uses that planner for recorded GPU writes and splits only when the later staging read overlaps. Both staged routes now read 29, and the permanent regression verifies two native calls for overlapping work and one for unrelated work.

All 20 buffer-ordering tests plus the nine material staging controls passed on each of AMD and NVIDIA hardware and WARP with full GBV. Both strict workspace Clippy configurations and asset policy passed. This resolves the ordinary two-list case. The title colour operand source, copies inside one native list, and the separate concurrent-write copyback cost are still open.

**@⁠aycow** on GitHub · 2026-11-24 19:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7141493323) Published 0899b7d to this PR. Exact rgarage and 709647f both reproduced stale staged root and table constants (11) when an earlier closed list in the same submission wrote 29. The normal path had bypassed title-byte dependency planning when no buffer-copy continuation existed. The fix uses that planner for recorded GPU writes and splits only when the later staging read overlaps. Both staged routes now read 29, and the permanent regression verifies two native calls for overlapping work and one for unrelated work. All 20 buffer-ordering tests plus the nine [material staging controls](https://github.com/aycow/VIctory/blob/ba373a2/docs/material-input-boundaries.md) passed on each of AMD and NVIDIA hardware and WARP with full GBV. Both strict workspace Clippy configurations and asset policy passed. This resolves the ordinary two-list case. The title colour operand source, copies inside one native list, and the separate concurrent-write copyback cost are still open.
Author
Owner

@⁠aycow on GitHub · 2026-11-24 21:24 UTC · original

The new diagnostics composition passed its allocation/reset control on AMD and WARP. The independent 4 MiB CPU reconciliation profile found that 131,072 checked writes took 1,805.63 ms with Win32 and 114.69 ms with the native primitive already under review in #1215. Replay into an explicitly owned fixture mapping took 2.50 ms, and the metadata-only control took 2.18 ms. The direct path depends on ownership of the mapping and its protection. The guard and partial-mapping behavior of a general write backend remains under review, so #387 stays in draft. Contributor coordination and protection result.

AI-assisted using Codex.

**@⁠aycow** on GitHub · 2026-11-24 21:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7144892088) The new diagnostics composition passed its allocation/reset control on AMD and WARP. The independent 4 MiB CPU reconciliation profile found that 131,072 checked writes took 1,805.63 ms with Win32 and 114.69 ms with the native primitive already under review in #1215. Replay into an explicitly owned fixture mapping took 2.50 ms, and the metadata-only control took 2.18 ms. The direct path depends on ownership of the mapping and its protection. The guard and partial-mapping behavior of a general write backend remains under review, so #387 stays in draft. [Contributor coordination and protection result](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1215). AI-assisted using Codex.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:15 UTC · original · edited 2026-11-26 01:22 UTC

Automated triage for the maintainers.

Still needs work. The only push since the last triage is 86c3887, a merge of current main that keeps the recorded copyback layout. The branch merges cleanly and CI (check) passes. None of the three earlier asks has been addressed yet:

  • Split. The interleaved private-staging path is still in this PR: interleaved_reader, Batch::allow_private_reader/stage_private/preserve_gpu_writes, and draw/interleaved_tests.rs. Please limit this PR to the ordering cut and submission split (list.rs, cpu_read_boundaries, computed_tail) and put the rest in a follow-up.
  • Title cost. There is still no in-game before/after for the fence and CPU wait each dependent read adds (submissions per frame, submission time, number of cuts in a fixed scene).
  • Failure mode. Host::require_batch_fence still calls fail, while a failed wait in main's submit loop only logs. Please make the two consistent or explain why the split path has to abort.

yumaste's report (a later CPU CopyBufferRegion into a dword the GPU wrote earlier in the same list or submission loses to the GPU copyback) looks like the same planner gap from the destination side. It would be worth folding in or answering here.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7148328225) · edited 2026-11-26 01:22 UTC <!-- victory-triage v1 head=86c3887b29ac36c40e7c281829ccc66b38b6d4eb verdict=needs-work at=2026-11-26T01:22:38Z --> Automated triage for the maintainers. **Still needs work.** The only push since the last triage is `86c3887`, a merge of current `main` that keeps the recorded copyback layout. The branch merges cleanly and CI (`check`) passes. None of the three earlier asks has been addressed yet: - **Split.** The interleaved private-staging path is still in this PR: `interleaved_reader`, `Batch::allow_private_reader`/`stage_private`/`preserve_gpu_writes`, and `draw/interleaved_tests.rs`. Please limit this PR to the ordering cut and submission split (`list.rs`, `cpu_read_boundaries`, `computed_tail`) and put the rest in a follow-up. - **Title cost.** There is still no in-game before/after for the fence and CPU wait each dependent read adds (submissions per frame, submission time, number of cuts in a fixed scene). - **Failure mode.** `Host::require_batch_fence` still calls `fail`, while a failed wait in `main`'s submit loop only logs. Please make the two consistent or explain why the split path has to abort. yumaste's report (a later CPU `CopyBufferRegion` into a dword the GPU wrote earlier in the same list or submission loses to the GPU copyback) looks like the same planner gap from the destination side. It would be worth folding in or answering here. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠aycow on GitHub · 2026-11-25 01:02 UTC · original · edited 2026-11-25 16:58 UTC

I reproduced the remaining ordering defect on upstream 42363ab using WARP with the preview Agility runtime, debug layer, and full GPU-based validation. In the same command list a GPU producer wrote 29, but the title CopyBufferRegion and the staged unaligned root CBV received the earlier value 11. The aligned root CBV and the separately submitted unaligned control both received 29. The draft’s continuation planner predates current bindless and computed-address dependencies, and the same-list staging path still needs a fix. The branch remains a conflicted draft while that ordering and ownership are unresolved.

Current-main recheck at 67e8ae1: WARP still observed [29,29,11,11] for the aligned same-list, unaligned separate-submission, unaligned same-batch, and unaligned same-list controls. The title CopyBufferRegion also returned 11 after its producer wrote 29. The existing wait segments do not provide this staging handoff, and the old draft conflicts with the current submission and texture code. The branch remains a draft pending a fix that honors current write withholding and copyback ownership.

**@⁠aycow** on GitHub · 2026-11-25 01:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7149152885) · edited 2026-11-25 16:58 UTC I reproduced the remaining ordering defect on upstream `42363ab` using WARP with the preview Agility runtime, debug layer, and full GPU-based validation. In the same command list a GPU producer wrote `29`, but the title `CopyBufferRegion` and the staged unaligned root CBV received the earlier value `11`. The aligned root CBV and the separately submitted unaligned control both received `29`. The draft’s continuation planner predates current bindless and computed-address dependencies, and the same-list staging path still needs a fix. The branch remains a conflicted draft while that ordering and ownership are unresolved. Current-main recheck at `67e8ae1`: WARP still observed `[29,29,11,11]` for the aligned same-list, unaligned separate-submission, unaligned same-batch, and unaligned same-list controls. The title `CopyBufferRegion` also returned `11` after its producer wrote `29`. The existing wait segments do not provide this staging handoff, and the old draft conflicts with the current submission and texture code. The branch remains a draft pending a fix that honors current write withholding and copyback ownership.
Author
Owner

@⁠aycow on GitHub · 2026-11-25 17:40 UTC · original

Updated #387 at 4be4f82 with the current-main ordering fix. The original same-list and same-batch staged reads now return 29 instead of 11, and the title buffer copy returns the producer's 29 through the real queue. AMD, NVIDIA, and WARP passed the focused controls with full GPU-based validation. The WARP suite passed 201 tests and strict GPU Clippy passed.

A dependency can split a submission only when earlier copyback is safe. The new controls keep disjoint work batched and block a cut across potentially withheld pages or opaque computed-address writes. The PR description lists the reproduction and the remaining staging limitation for those batches.

**@⁠aycow** on GitHub · 2026-11-25 17:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7169831091) Updated #387 at `4be4f82` with the current-main ordering fix. The original same-list and same-batch staged reads now return `29` instead of `11`, and the title buffer copy returns the producer's `29` through the real queue. AMD, NVIDIA, and WARP passed the focused controls with full GPU-based validation. The WARP suite passed 201 tests and strict GPU Clippy passed. A dependency can split a submission only when earlier copyback is safe. The new controls keep disjoint work batched and block a cut across potentially withheld pages or opaque computed-address writes. The PR description lists the reproduction and the remaining staging limitation for those batches.
Author
Owner

@⁠yumaste on GitHub · 2026-11-25 21:16 UTC · original

I tested a related ordering case on this PR's head (be723f7). A guest CopyBufferRegion reads from a separate CPU buffer and overwrites a dword previously written by the GPU. The GPU copy-back wins when both commands are in one list or in two lists in the same submission. Separate submissions preserve the later CPU copy.

yumaste/VIctory@b65714d extends the existing guarded submission boundary to overlaps with the copy destination. With the patch, the destination holds the CPU value in all three layouts. The planner test also checks that a potentially withheld write on the same page still prevents an early boundary.

The guest-entry regression passes on Microsoft WARP and on the default hardware adapter. The standard WARP diagnostics suite passed 205 tests with 9 ignored, and strict GPU Clippy passed. An explicit run of eight ignored draw tests had the same seven failures on the PR head and on the patched branch in my setup. All buffers were synthetic. AI-assisted with Codex.

**@⁠yumaste** on GitHub · 2026-11-25 21:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/387#issuecomment-7174852688) I tested a related ordering case on this PR's head (`be723f7`). A guest `CopyBufferRegion` reads from a separate CPU buffer and overwrites a dword previously written by the GPU. The GPU copy-back wins when both commands are in one list or in two lists in the same submission. Separate submissions preserve the later CPU copy. [yumaste/VIctory@b65714d](https://github.com/yumaste/VIctory/commit/b65714db158bff7d47888221bf76b614ae07a052) extends the existing guarded submission boundary to overlaps with the copy destination. With the patch, the destination holds the CPU value in all three layouts. The planner test also checks that a potentially withheld write on the same page still prevents an early boundary. The guest-entry regression passes on Microsoft WARP and on the default hardware adapter. The standard WARP diagnostics suite passed 205 tests with 9 ignored, and strict GPU Clippy passed. An explicit run of eight ignored draw tests had the same seven failures on the PR head and on the patched branch in my setup. All buffers were synthetic. AI-assisted with Codex.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/387/head:github-bot/gh-387'
git switch 'github-bot/gh-387'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-387'
git switch 'github-bot/gh-387'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-387'
git switch 'github-bot/gh-387'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-387'
git switch 'main'
git merge --squash 'github-bot/gh-387'
git switch 'main'
git merge --ff-only 'github-bot/gh-387'
git switch 'main'
git merge 'github-bot/gh-387'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!387
No description provided.