Fix source offsets in upcopy readback #1530

Manually merged
github merged 2 commits from github-bot/gh-1530 into main 2026-11-29 08:21:55 +00:00 AGit
Owner

@⁠Gauss999 on GitHub · 2026-11-28 21:19 UTC · original
Gauss999:patch-3 → main · +92 −22 · 1 files · 2 commits · merged 2026-11-29 08:16 UTC

Summary

  • preserve independent src_at and dst_at offsets in the Up record
  • use src_at only for source readback, and dst_at for destination, base, and reporting
  • add a synthetic regression test with distinct source and destination offsets

Tests

  • No local build or tests were run; this was a web-only edit.
  • Added the up_keeps_copy_offsets_independent unit test; CI awaits approval.
**@⁠Gauss999** on GitHub · 2026-11-28 21:19 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1530) `Gauss999:patch-3` → `main` · +92 −22 · 1 files · 2 commits · merged 2026-11-29 08:16 UTC ## Summary - preserve independent `src_at` and `dst_at` offsets in the `Up` record - use `src_at` only for source readback, and `dst_at` for destination, base, and reporting - add a synthetic regression test with distinct source and destination offsets ## Tests - No local build or tests were run; this was a web-only edit. - Added the `up_keeps_copy_offsets_independent` unit test; CI awaits approval.
Preserve independent Cmd::CopyBuffer source and destination offsets and cover their recording with a synthetic unit test.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 21:19:15 +00:00
Author
Owner

@⁠babuakhil on GitHub · 2026-11-28 22:14 UTC · original

Built and ran this on Windows, since it hadn't been run yet: Windows 11, Rust 1.98.1 (pinned), applied on current main (d4b5d51); cherry-picks cleanly.

  • clippy (--all-features) reports nothing in upcopies.rs
  • with --features diagnostics: up_keeps_copy_offsets_independent passes, and all 25 replay tests pass

Heads-up for CI: like the rest of replay, this is #[cfg(all(windows, feature = "diagnostics"))]. Without the feature the test doesn't exist (cargo test -p victory-gpu --lib -- upcopies runs 0 tests), so CI's cargo test --workspace --locked won't run it.

The fix reads right. On main, ups drops src_at into the .., and the readback then asks for the source at the destination's offset (asked.push((self.objects[&src].res.clone(), at, len)) with at = dst_at). So for any copy with src_at != dst_at, the "comes" words are read from the wrong place. Here the source is read at src_at, and the destination, its base, the reported word offsets and the declared pieces all stay on dst_at, as before.

One gap in the test: it checks that Up::new puts each field in its place, but not the readback, which is where the bug was. It couldn't fail on main either, since Up doesn't exist there. A test that pins the three ranges the readback asks for (destination and base at dst_at, source at src_at), for example by moving the asked pushes into a small function, would catch this coming back. Not a blocker.

Not checked: a replay run with a real capture, which this path needs (I have no capture to run).

**@⁠babuakhil** on GitHub · 2026-11-28 22:14 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1530#issuecomment-7246597188) Built and ran this on Windows, since it hadn't been run yet: Windows 11, Rust 1.98.1 (pinned), applied on current `main` (`d4b5d51`); cherry-picks cleanly. - clippy (`--all-features`) reports nothing in `upcopies.rs` - with `--features diagnostics`: `up_keeps_copy_offsets_independent` passes, and all 25 `replay` tests pass **Heads-up for CI:** like the rest of `replay`, this is `#[cfg(all(windows, feature = "diagnostics"))]`. Without the feature the test doesn't exist (`cargo test -p victory-gpu --lib -- upcopies` runs 0 tests), so CI's `cargo test --workspace --locked` won't run it. **The fix reads right.** On `main`, `ups` drops `src_at` into the `..`, and the readback then asks for the source at the destination's offset (`asked.push((self.objects[&src].res.clone(), at, len))` with `at = dst_at`). So for any copy with `src_at != dst_at`, the "comes" words are read from the wrong place. Here the source is read at `src_at`, and the destination, its base, the reported word offsets and the declared pieces all stay on `dst_at`, as before. **One gap in the test:** it checks that `Up::new` puts each field in its place, but not the readback, which is where the bug was. It couldn't fail on `main` either, since `Up` doesn't exist there. A test that pins the three ranges the readback asks for (destination and base at `dst_at`, source at `src_at`), for example by moving the `asked` pushes into a small function, would catch this coming back. Not a blocker. Not checked: a replay run with a real capture, which this path needs (I have no capture to run).
Exercise destination, base, and source ranges with independent offsets.
Author
Owner

@⁠Gauss999 on GitHub · 2026-11-28 22:50 UTC · original

Applied the non-blocking feedback from @⁠babuakhil. The new Up::readback helper is used to extend asked, and the regression test now checks all three (resource, offset, length) entries with distinct offsets (src_at = 0x80, dst_at = 0x200): destination and base read at dst_at, while source reads at src_at. The original fix remains intact, including dst_at for reported word offsets and declared pieces.

I have not run a local build/test or a real-capture replay; this update was made through the web editor.

**@⁠Gauss999** on GitHub · 2026-11-28 22:50 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1530#issuecomment-7247018136) Applied the non-blocking feedback from @⁠babuakhil. The new `Up::readback` helper is used to extend `asked`, and the regression test now checks all three `(resource, offset, length)` entries with distinct offsets (`src_at = 0x80`, `dst_at = 0x200`): destination and base read at `dst_at`, while source reads at `src_at`. The original fix remains intact, including `dst_at` for reported word offsets and declared pieces. I have not run a local build/test or a real-capture replay; this update was made through the web editor.
Author
Owner

@⁠babuakhil on GitHub · 2026-11-28 23:04 UTC · original

Re-checked with de61ce5 on d4b5d51 (Windows 11, Rust 1.98.1): builds, clippy (--all-features) reports nothing in upcopies.rs, and with --features diagnostics up_keeps_copy_offsets_independent passes with the new readback assertions (25/25 replay tests). The test now pins the source at src_at and the destination and base at dst_at, which is what the fix is about. Looks good to me; still not run against a real capture.

**@⁠babuakhil** on GitHub · 2026-11-28 23:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1530#issuecomment-7247175290) Re-checked with `de61ce5` on `d4b5d51` (Windows 11, Rust 1.98.1): builds, clippy (`--all-features`) reports nothing in `upcopies.rs`, and with `--features diagnostics` `up_keeps_copy_offsets_independent` passes with the new `readback` assertions (25/25 `replay` tests). The test now pins the source at `src_at` and the destination and base at `dst_at`, which is what the fix is about. Looks good to me; still not run against a real capture.
github manually merged commit 2d40dbd676 into main 2026-11-29 08:21:55 +00:00
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/trustno1-coder--VIctory-NVIDIA!1530
No description provided.