GPU: a thread's processor time since an earlier reading saturates at zero #2300
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2302"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by denkencar-sketch on 2026-11-25T10:05:43Z.
Summary
A failed
GetThreadTimesreads zeros, and the unchecked subtraction of a thread's processor time panicked in checked builds and wrapped in release. It now saturates at zero. This is defensive: the trigger is hard to reach, since both readings come from the same thread.Testing
Test
thread_time_never_runs_backwardsfails onmainand passes with this change.cargo test --workspace --lockedpasses apart from known flakes:modules::dstorage::tests::a_page_list_filled_after_its_request_startsfails now and then onmaintoo, and so does a parallel-run flake invictory-gpu's lib tests (watch::anddescriptor::host::tests, 2 of 40 runs on pristinemain).Not tried: a run in the game.
AI-assisted.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:19:18Z.
Review: COMMENTED
thread_cpu_since saturates instead of panicking when a query reads zeros. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:21:30Z.
Automated triage for the maintainers.
Proposed close. This guards
thread_cpu_sinceincrates/victory-gpu/src/pipeline.rsagainst a later reading that is smaller than an earlier one. Both readings come fromGetThreadTimes(GetCurrentThread(), ...)on the same thread, around one translation (seepipeline.rsaround line 114 andpipeline/make.rsline 73). A thread's processor times only increase, and that call on the current-thread pseudo-handle does not fail in practice; the description itself says the trigger is hard to reach. The new test passes(u64::MAX, u64::MAX)as the earlier reading, which checks only what the new code does, not anything that can happen at run time. Evidence that a real run hits this path would change the verdict.This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by denkencar-sketch on 2026-11-25T23:12:04Z.
Closing per triage: \GetThreadTimes\ on the current thread does not go backwards in practice and there is no real-run repro.
Pull request closed