Stop the shader warm-up file walk when its time budget expires #356
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!356
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-356"
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?
@ANDREANIADS on GitHub · 2026-11-26 21:44 UTC · original
ANDREANIADS:fix-warm-scan-deadline→a-publier· +93 −46 · 1 files · 2 commits · openFixes #293.
Previously, once
VICTORY_WARM_SECONDSexpired, worker threads stopped starting translations but the outer loop kept reading every remaining archive from every root. It also scanned and hashed new data before noticing the limit. A shader-free directory could run to completion without reporting the cutoff.The deadline now gates the directory walk, file reads, archive scanning and workers' acquisition of new jobs. Reads and translations already in flight can complete. A later unlimited run can reuse completed cache entries. Two regression tests cover a zero budget and expiry between files across multiple roots.
Validation
A deterministic comparison of the original and changed warm-up functions used real directory traversal, file reads, worker threads and hashing with a controlled clock and shader cache. The original passed 1/5 cases, and the change passed all 5. When expiry was forced during the first read, the original read and scanned all three files and started three workers. The fix read that first file, then stopped before scanning it or starting a worker. Another case confirmed the next run reused the result of a translation that finished in flight.
I also compared two full Windows
victory.exebuilds on the same 64 MiB shader-free fixture (eight 8 MiB files in two roots, one worker). WindowsGetProcessIoCountersreported the following reads forvictory translate --warm all:VICTORY_WARM_SECONDS=0With a one-second budget, a second synthetic fixture visited the same 8 MiB root up to 512 times (4 GiB of possible reads). The baseline scanned all entries in 5.3 s. The patched command read part of the fixture and reported stopping at 1.0 s. Times are from this PC.
All four zero-budget and unlimited commands exited successfully. Only the patched zero-budget run reported stopping at the time limit. The complete CLI binary test suite passed: 24 passed, 0 failed, 0 ignored, including both new tests. For local validation I used Rust 1.98.0 MSVC and an offline dependency lock, with matching dependency versions in the before/after binaries. The repository pins Rust 1.98.1. No game assets were used.
Implemented and tested with Codex.
@lvndrpup on GitHub · 2026-11-27 04:58 UTC · original · reviewed
This no longer merges into
a-publier: #332 (merged as038c507, "--warm uses every logical core by default") addedjobs_is_at_least_one_worker_and_every_core_by_defaultat the same spot intranslate.rs's tests where this PR adds its two. That is the only conflict, and keeping all three tests resolves it.I merged
d18892ainto4eb6cfdthat way and checked it on Windows 11 build 26300, Rust 1.98.1, debug:cargo test -p victory: 34 passed, among themwarm_zero_budget_stops_without_scanning,warm_expiry_during_a_file_stops_this_root_and_later_rootsand #332's test.cargo clippy -p victory --all-targets -- -D warnings: clean.The bug is still on
a-publier:VICTORY_WARM_SECONDSthere only stops new shaders from being taken (translate.rs:183), and the walk itself has no deadline. A rebase ontoa-publierwith the three tests kept should be all this needs.@adrianmjim on GitHub · 2026-11-27 06:26 UTC · original
Tested on RX 7900 XT (RDNA3), driver 32.0.32029.2010, Windows 11 26300, Rust 1.98.1, release builds. Base a-publier
4eb6cfdvs4eb6cfd+ this PR (d18892a), merged locally. Real game install: 109 files, 93 of them within MAX_FILE (2 GiB), 41.25 GiB in total.--jobs 4, fresh shader cache for each run.Walk only (
translate --warm <list>with a list that matches no hash, so nothing is translated):VICTORY_WARM_SECONDS=0: PR 0.07 s, no game file read. Base 46.4 s, reads all 41.25 GiB.With translation (
translate --warm all):Other notes:
warm()doc says "nothing is made on the GPU". No pipelines are made (the cache only getsshaders/). Butprecompileopens the host D3D12 device, andprobe_view_limitcreates descriptor heaps on it. This line is unchanged by the PR.Not tested: the full test suite on the merge, other GPUs, and budgets other than 0/5/30 s.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.