Fix source offsets in upcopy readback #1530

Merged
Gauss999 merged 2 commits from upstream-pr/1530 into main 2026-11-29 08:16:56 +00:00
Gauss999 commented 2026-11-28 21:19:01 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Gauss999 on 2026-11-28T21:19:01Z.


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.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5544670167 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1530). Originally posted by [Gauss999](https://github.com/Gauss999) on 2026-11-28T21:19:01Z. --- ## 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.
babuakhil commented 2026-11-28 22:14:38 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by babuakhil on 2026-11-28T22:14:38Z.


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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246597188 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1530#issuecomment-7246597188). Originally posted by [babuakhil](https://github.com/babuakhil) on 2026-11-28T22:14:38Z. --- 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).
Gauss999 commented 2026-11-28 22:50:20 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Gauss999 on 2026-11-28T22:50:20Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7247018136 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1530#issuecomment-7247018136). Originally posted by [Gauss999](https://github.com/Gauss999) on 2026-11-28T22:50:20Z. --- 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.
babuakhil commented 2026-11-28 23:04:01 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by babuakhil on 2026-11-28T23:04:01Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7247175290 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1530#issuecomment-7247175290). Originally posted by [babuakhil](https://github.com/babuakhil) on 2026-11-28T23:04:01Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!1530
No description provided.