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

Manually merged
github merged 2 commits from github-bot/gh-993 into main 2026-11-29 08:22:18 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 10:53 UTC · original
kibagami-nc:diag/lost-device-fence-message → main · +24 −3 · 1 files · 2 commits · merged 2026-11-29 08:16 UTC

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.

**@⁠kibagami-nc** on GitHub · 2026-11-28 10:53 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/993) `kibagami-nc:diag/lost-device-fence-message` → `main` · +24 −3 · 1 files · 2 commits · merged 2026-11-29 08:16 UTC ## 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.
Once the device is removed, every fence reads u64::MAX, and the relay
already takes that as the device gone (fence_reached). Its message still
printed it as a value: "relay: fence 18446744073709551615 did not reach
312701; device removed: ... (0x887A0006)", which was read as an
underflow of ours (#972) when the cause was the hang named after it.

The message now says the device was lost before that fence value was
reached. A fence that read a real value short of its target is told as
before.
A review asked for the removal reason (hung or reset) in the lost-device
wording. fail() already adds it to the same line ("; device removed: ...
(0x887A0006)", as in #972's log), so the note says so instead of asking twice.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:31:23 +00:00
Author
Owner

@⁠Exopus-0x65f7ad0 on GitHub · 2026-11-28 13:00 UTC · original

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.

**@⁠Exopus-0x65f7ad0** on GitHub · 2026-11-28 13:00 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/993#issuecomment-7239624015) 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.
Author
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 13:13 UTC · original

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.

**@⁠kibagami-nc** on GitHub · 2026-11-28 13:13 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/993#issuecomment-7239781678) 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.
github manually merged commit 3d8c33591f into main 2026-11-29 08:22:18 +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!993
No description provided.