Relay: a fence wait cut short by a lost device says so, not "fence 18446744073709551615" #993

Merged
kibagami-nc merged 2 commits from upstream-pr/993 into main 2026-11-29 08:16:57 +00:00
kibagami-nc commented 2026-11-28 10:53:41 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T10:53:41Z.


Why

Once the device is removed, GetCompletedValue returns u64::MAX for every fence. The relay already takes that as the device gone (fence_reached, since fxceless#1366's check came in). But its message prints the value as it is:

ERROR victory_gpu::host: relay: fence 18446744073709551615 did not reach 312701; device removed: ... (0x887A0006)

On #972 that was read as an underflow of ours, "the fence value the relay read is 0 - 1", when the cause was the hang named after it: 0x887A0006, the card no longer responding. Device-removed reports are common here, and each one now carries that number.

The change

wait_host_fence's message comes from fence_short. A lost device is named as such:

relay: the device was lost before fence value 312701 was reached (once it is, every fence reads u64::MAX); device removed: ... (0x887A0006)

A fence that read a real value short of its target is told as before: relay: fence 6 did not reach 7. Nothing else changes, and the failure is still a failure.

Tests

  • New host::a_lost_device_is_named_not_its_fence_value: the lost-device text names the target and not 18446744073709551615. The other text is unchanged.
  • cargo test -p victory-gpu --lib --locked: 454 passed, 36 ignored.
  • Clippy (-D warnings, default and --all-features): nothing in the changed lines. It stops on main's own manual_is_multiple_of (fixed in #665). With that lint allowed, both builds are clean.

No game files, dumps or extracted data are included.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5539369119 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/993). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T10:53:41Z. --- ## Why Once the device is removed, `GetCompletedValue` returns `u64::MAX` for every fence. The relay already takes that as the device gone (`fence_reached`, since fxceless#1366's check came in). But its message prints the value as it is: ``` ERROR victory_gpu::host: relay: fence 18446744073709551615 did not reach 312701; device removed: ... (0x887A0006) ``` On #972 that was read as an underflow of ours, "the fence value the relay read is 0 - 1", when the cause was the hang named after it: `0x887A0006`, the card no longer responding. Device-removed reports are common here, and each one now carries that number. ## The change `wait_host_fence`'s message comes from `fence_short`. A lost device is named as such: ``` relay: the device was lost before fence value 312701 was reached (once it is, every fence reads u64::MAX); device removed: ... (0x887A0006) ``` A fence that read a real value short of its target is told as before: `relay: fence 6 did not reach 7`. Nothing else changes, and the failure is still a failure. ## Tests - **New** `host::a_lost_device_is_named_not_its_fence_value`: the lost-device text names the target and not `18446744073709551615`. The other text is unchanged. - **`cargo test -p victory-gpu --lib --locked`**: 454 passed, 36 ignored. - **Clippy** (`-D warnings`, default and `--all-features`): nothing in the changed lines. It stops on `main`'s own `manual_is_multiple_of` (fixed in #665). With that lint allowed, both builds are clean. No game files, dumps or extracted data are included.
Exopus-0x65f7ad0 commented 2026-11-28 13:00:40 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Exopus-0x65f7ad0 on 2026-11-28T13:00:40Z.


Looks right. The u64::MAX branch matches fence_reached, and the test pins both wordings.

One optional addition while you're in wait_host_fence: the fence alone can name why the device went away. In #972 the reason (0x887A0006 hung or 0x887A0005 reset) had to be dug out of other lines. Something like:

let reason = if completed == u64::MAX {
    // SAFETY: a live fence; GetDevice only adds a reference.
    unsafe { fence.GetDevice::<ID3D12Device>() }
        .ok()
        .map(|d| unsafe { d.GetDeviceRemovedReason() })
        .and_then(|r| r.err().map(|e| format!(" ({:#010x})", e.code().0)))
        .unwrap_or_default()
} else { String::new() };

Then add reason to the lost-device wording. That way a pasted line alone tells a hang from a reset. Fine to leave for a follow-up.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239624015 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/993#issuecomment-7239624015). Originally posted by [Exopus-0x65f7ad0](https://github.com/Exopus-0x65f7ad0) on 2026-11-28T13:00:40Z. --- Looks right. The `u64::MAX` branch matches `fence_reached`, and the test pins both wordings. One optional addition while you're in `wait_host_fence`: the fence alone can name **why** the device went away. In #972 the reason (`0x887A0006` hung or `0x887A0005` reset) had to be dug out of other lines. Something like: ```rust let reason = if completed == u64::MAX { // SAFETY: a live fence; GetDevice only adds a reference. unsafe { fence.GetDevice::<ID3D12Device>() } .ok() .map(|d| unsafe { d.GetDeviceRemovedReason() }) .and_then(|r| r.err().map(|e| format!(" ({:#010x})", e.code().0))) .unwrap_or_default() } else { String::new() }; ``` Then add `reason` to the lost-device wording. That way a pasted line alone tells a hang from a reset. Fine to leave for a follow-up.
kibagami-nc commented 2026-11-28 13:13:25 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T13:13:25Z.


Thanks for the review. The reason is already on that line: wait_host_fence reports through fail(), and fail() asks GetDeviceRemovedReason and appends it. #972's line has both halves:

ERROR victory_gpu::host: relay: fence 18446744073709551615 did not reach 312701;
      device removed: GPU 不响应更多的命令 (0x887A0006)

With this PR it reads relay: the device was lost before fence value 312701 was reached (...); device removed: ... (0x887A0006). The pasted line alone tells a hang from a reset. Asking from the fence too would print the code twice.

So I left the code as it was, and added a note to fence_short's doc that fail() names the reason (b4a2be5), so it doesn't get asked twice later. In #972 the hard part was the u64::MAX printed as a value, which sent the reading toward an underflow; that is what this PR changes.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7239781678 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/993#issuecomment-7239781678). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T13:13:25Z. --- Thanks for the review. The reason is already on that line: `wait_host_fence` reports through `fail()`, and `fail()` asks `GetDeviceRemovedReason` and appends it. #972's line has both halves: ``` ERROR victory_gpu::host: relay: fence 18446744073709551615 did not reach 312701; device removed: GPU 不响应更多的命令 (0x887A0006) ``` With this PR it reads `relay: the device was lost before fence value 312701 was reached (...); device removed: ... (0x887A0006)`. The pasted line alone tells a hang from a reset. Asking from the fence too would print the code twice. So I left the code as it was, and added a note to `fence_short`'s doc that `fail()` names the reason (b4a2be5), so it doesn't get asked twice later. In #972 the hard part was the `u64::MAX` printed as a value, which sent the reading toward an underflow; that is what this PR changes.
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!993
No description provided.