Preserve CPU-visible data on GPU-owned readback errors #633

Open
holoslicer wants to merge 1 commit from holoslicer/Darner:fix/gpu-owned-readback-errors into Main
Contributor

Offline correctness tests on Windows x64 and an RTX 3090. Gameplay was not run. This change is for the optional GPU-owned readback path.

Contributor role (optional)

  • Fluxer ID: 1577921940104949761. Please grant the Contributor role when eligible.

What it changes

On c8258f95, a generated GPU producer wrote a pattern and a subsequent GPU consumer verified it. With DARNER_GPU_OWNED=1, injecting a missing COPY engine or a failed readback made the first CPU read return 0 when the corresponding GPU byte was 5. Both eager controls returned the expected data.

Enable lazy ownership only after the COPY engine initializes. Retry a recording failure once on a fresh engine while the device is healthy. After submission, check the real fence result, including the device-removed sentinel. On unrecoverable failure, report through the existing fatal GPU path while the block is still protected. A recording failure before submission can recover without exposing stale CPU bytes.

How it was tested

  • Tested revision: 0b8a05505e6cb7f75355cb4ea7b115c020c86187, based on c8258f95569c10fe75b5bfb785d3865b5deeefd9.
  • Run cargo test --locked -p darner-gpu --lib --features record --profile fast host::upcheck::tests::gpu_owned_readback_failure_paths -- --ignored --exact --nocapture on a D3D12 adapter. It checks absent-engine eager fallback, recovery after one recording failure, and two terminal cases. The last two check the page protection in the error reporter and use an expected child exit code. The partial-write case checks neighboring GPU-written bytes.
  • Run cargo test --locked -p darner-gpu --lib gpu_owned::tests::a_removed_fence_value_cannot_complete_readback -- --exact. Passed.
  • Four isolated D3D12 scenarios passed on the RTX 3090 with the recorded Series X renderer settings supplied to each child. The two recoverable cases matched the expected CPU and GPU contents. The two terminal cases reached the error handler with the affected page still protected. The fence-sentinel unit test also passed.
  • In a separate untimed off/on/on/off control, a D3D12 fence held the GPU producer in flight. With deferral enabled, one CPU thread read and a second partially wrote a different protected block. Both waited until the producer gate opened. Both enabled runs preserved all 131,072 bytes on the CPU and for the next GPU consumer. The eager references used the ordinary explicit settle. This exercised distinct blocks and did not test racing aliases of the same byte.
  • The full asset-policy check and both strict workspace Clippy gates passed. This opt-in correctness change leaves the default renderer path intact. Gameplay frame time, other adapters and simultaneous CPU alias access were outside this verification.
  • The third workspace gate did not pass end to end. In the restricted environment 1,824 enabled GPU tests passed and four HLE tests encountered loopback or NTFS permissions. Those HLE tests passed on the Windows host. In the native workspace run, 1,821 GPU tests passed and three intermittent tests failed in shared scratch, worker-pool unwind and alias writes into a full queue. All three passed in three fresh candidate processes apiece. Clean official main reproduced all three. With the same record feature as the candidate workspace, it reproduced the same shared-scratch refusal count (7 of 8) and the same first alias page (0 of 1,024 pixels). Its default-feature run reproduced the owner-unwind assertion. See also #539 and #547. The workspace attempts, isolated reruns and injected readback tests are separate results.

Checklist

  • Gameplay validation, unperformed. The changed path is opt-in and the error cases use deterministic injection.
  • One change based on main.
  • Diff follows the asset policy.
  • Dependencies recorded. Depends on none.

Checked for overlap

  • Searched open and closed issues and PRs and the files changed by open PRs.
  • Related: #57 prepares residency before submission. #594 and the related #596–601 branches touch the COPY submission for validation. #261 covered scheduling a different concurrent test. These changes do not handle a missing dedicated engine or the failed readback that exposed a protected page with stale bytes.
Offline correctness tests on Windows x64 and an RTX 3090. Gameplay was not run. This change is for the optional GPU-owned readback path. ## Contributor role (optional) - Fluxer ID: 1577921940104949761. Please grant the Contributor role when eligible. ## What it changes On `c8258f95`, a generated GPU producer wrote a pattern and a subsequent GPU consumer verified it. With `DARNER_GPU_OWNED=1`, injecting a missing COPY engine or a failed readback made the first CPU read return 0 when the corresponding GPU byte was 5. Both eager controls returned the expected data. Enable lazy ownership only after the COPY engine initializes. Retry a recording failure once on a fresh engine while the device is healthy. After submission, check the real fence result, including the device-removed sentinel. On unrecoverable failure, report through the existing fatal GPU path while the block is still protected. A recording failure before submission can recover without exposing stale CPU bytes. ## How it was tested - Tested revision: `0b8a05505e6cb7f75355cb4ea7b115c020c86187`, based on `c8258f95569c10fe75b5bfb785d3865b5deeefd9`. - Run `cargo test --locked -p darner-gpu --lib --features record --profile fast host::upcheck::tests::gpu_owned_readback_failure_paths -- --ignored --exact --nocapture` on a D3D12 adapter. It checks absent-engine eager fallback, recovery after one recording failure, and two terminal cases. The last two check the page protection in the error reporter and use an expected child exit code. The partial-write case checks neighboring GPU-written bytes. - Run `cargo test --locked -p darner-gpu --lib gpu_owned::tests::a_removed_fence_value_cannot_complete_readback -- --exact`. Passed. - Four isolated D3D12 scenarios passed on the RTX 3090 with the recorded Series X renderer settings supplied to each child. The two recoverable cases matched the expected CPU and GPU contents. The two terminal cases reached the error handler with the affected page still protected. The fence-sentinel unit test also passed. - In a separate untimed off/on/on/off control, a D3D12 fence held the GPU producer in flight. With deferral enabled, one CPU thread read and a second partially wrote a different protected block. Both waited until the producer gate opened. Both enabled runs preserved all 131,072 bytes on the CPU and for the next GPU consumer. The eager references used the ordinary explicit settle. This exercised distinct blocks and did not test racing aliases of the same byte. - The full asset-policy check and both strict workspace Clippy gates passed. This opt-in correctness change leaves the default renderer path intact. Gameplay frame time, other adapters and simultaneous CPU alias access were outside this verification. - The third workspace gate did not pass end to end. In the restricted environment 1,824 enabled GPU tests passed and four HLE tests encountered loopback or NTFS permissions. Those HLE tests passed on the Windows host. In the native workspace run, 1,821 GPU tests passed and three intermittent tests failed in shared scratch, worker-pool unwind and alias writes into a full queue. All three passed in three fresh candidate processes apiece. Clean official main reproduced all three. With the same record feature as the candidate workspace, it reproduced the same shared-scratch refusal count (7 of 8) and the same first alias page (0 of 1,024 pixels). Its default-feature run reproduced the owner-unwind assertion. See also #539 and #547. The workspace attempts, isolated reruns and injected readback tests are separate results. ## Checklist - [ ] Gameplay validation, unperformed. The changed path is opt-in and the error cases use deterministic injection. - [x] One change based on main. - [x] Diff follows the asset policy. - [x] Dependencies recorded. Depends on none. ## Checked for overlap - [x] Searched open and closed issues and PRs and the files changed by open PRs. - Related: #57 prepares residency before submission. #594 and the related #596–601 branches touch the COPY submission for validation. #261 covered scheduling a different concurrent test. These changes do not handle a missing dedicated engine or the failed readback that exposed a protected page with stale bytes.
holoslicer changed title from WIP: [pr-fix][rendering][memory] Preserve CPU-visible data on GPU-owned readback errors to [pr-fix][rendering][memory] Preserve CPU-visible data on GPU-owned readback errors 2026-12-05 19:48:18 +00:00
TrustNo1 changed title from [pr-fix][rendering][memory] Preserve CPU-visible data on GPU-owned readback errors to Preserve CPU-visible data on GPU-owned readback errors 2026-12-06 03:25:51 +00:00
Owner

Test needed — commit 0b8a0550; what to check:

On c8258f95, a generated GPU producer wrote a pattern and a subsequent GPU consumer verified it. With DARNER_GPU_OWNED=1, injecting a missing COPY engine or a failed readback made the first CPU read return 0 when the corresponding GPU byte was 5. Both eager controls returned the expected data.

Enable lazy ownership only after the COPY engine initializes. Retry a recording failure once on a fresh engine while the device is healthy. After submission, check the real fence result, including the device-removed sentinel. On unrecoverable failure, report through the existing fatal GPU path while the block is still protected. A recording failure before submission can recover without exposing stale CPU bytes.

Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.

Reply testing to take this run; it's free again after 24 h with no results.

**Test needed** — commit `0b8a0550`; what to check: On `c8258f95`, a generated GPU producer wrote a pattern and a subsequent GPU consumer verified it. With `DARNER_GPU_OWNED=1`, injecting a missing COPY engine or a failed readback made the first CPU read return 0 when the corresponding GPU byte was 5. Both eager controls returned the expected data. Enable lazy ownership only after the COPY engine initializes. Retry a recording failure once on a fresh engine while the device is healthy. After submission, check the real fence result, including the device-removed sentinel. On unrecoverable failure, report through the existing fatal GPU path while the block is still protected. A recording failure before submission can recover without exposing stale CPU bytes. Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture. Reply `testing` to take this run; it's free again after 24 h with no results.
This pull request has changes conflicting with the target branch.
  • crates/darner-gpu/src/gpu_owned.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/gpu-owned-readback-errors:holoslicer-fix/gpu-owned-readback-errors'
git switch 'holoslicer-fix/gpu-owned-readback-errors'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'holoslicer-fix/gpu-owned-readback-errors'
git switch 'holoslicer-fix/gpu-owned-readback-errors'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'holoslicer-fix/gpu-owned-readback-errors'
git switch 'holoslicer-fix/gpu-owned-readback-errors'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'holoslicer-fix/gpu-owned-readback-errors'
git switch 'Main'
git merge --squash 'holoslicer-fix/gpu-owned-readback-errors'
git switch 'Main'
git merge --ff-only 'holoslicer-fix/gpu-owned-readback-errors'
git switch 'Main'
git merge 'holoslicer-fix/gpu-owned-readback-errors'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
TrustNo1/Darner!633
No description provided.