Skip to content

Make translate failure examples stable across workers - #673

Open
timorjay wants to merge 1 commit into
Marvisak:mainfrom
timorjay:timorjay/translate-stable-failure-examples
Open

timorjay wants to merge 1 commit into
Marvisak:mainfrom
timorjay:timorjay/translate-stable-failure-examples

Conversation

@timorjay

Copy link
Copy Markdown

Running victory translate on the same input sometimes picks a different example for the same failure. Each worker kept the first label it saw, and the first worker to merge got to choose the example for the report. That makes otherwise identical reports harder to compare across machines.

The tally now keeps the lexicographically smallest label among the failures it records for each reason. The same rule applies within a worker and when merging workers. The regression test covers both merge orders, with and without --list.

On Windows 11 I used one synthetic file containing 256 empty, 32-byte DXBC containers. At d2a4bae, 32 identical runs with --jobs 4 reported nine different example offsets. With this change, 32 runs each at 1, 4 and 12 workers all reported 256 failures and @0x0. Reversing two input file arguments with --list also preserved both detail lines and the same example.

cargo test --locked --workspace --no-fail-fast completed with 265 passed, 0 failed and 4 ignored. No game data was needed for these tests. OpenAI Codex (GPT-6) assisted with the patch, reproduction and report.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally on macOS 26 arm64, rustc 1.98.1 (aarch64-apple-darwin, rust-toolchain.toml):

Same setup as #664 (main's app crate doesn't compile on macOS; #235's head merged locally, uncommitted, additive conflict resolved):

  • cargo check -p victory --locked: clean
  • cargo test -p victory --locked: 1 passed, 0 failed — the new stability test for translate failure examples passes.

Approving.

@LAKSHYA-cmd-tech LAKSHYA-cmd-tech left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. cargo test -p victory passes cleanly (2 passed, including ailure_example_is_independent_of_worker_order). Keeping the lexicographically smallest label for each failure reason guarantees deterministic, reproducible translation error reports across multi-threaded workers.

@geiyiliyabumo

Copy link
Copy Markdown
Contributor

Independent verification of 3ba3f79c1 merged with main (ffe310e, clean merge) on Windows 11 Pro (26100), Rust 1.98.1 (x86_64-pc-windows-msvc): PASS.

  • cargo xtask policy → asset policy: 154 files ok
  • cargo clippy --workspace --all-targets --locked -- -D warnings → pass (0 warnings)
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings → pass (0 warnings)
  • cargo test -p victory --locked → 2 passed, 0 failed (new translate::tests::failure_example_is_independent_of_worker_order passes across both list modes and merge orders)
  • Diff review: Tally::record_failure cleanly selects the lexicographically smallest label both per-worker and during Tally::merge, making failure example reporting deterministic across worker counts and scheduling order.

AI-assisted; synthetic tests only, no game files.

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 3ba3f79 on Windows 11, RTX 5070, MSVC: cargo test -p victory 2 passed, including failure_example_is_independent_of_worker_order. Clippy's 1 warning is the existing field_reassign_with_default in victory-hle xmem.rs:747, not from this PR.

  • Choosing the minimum label is order-independent both within a worker and across merges, and record_failure is the single place that applies it.
  • Small cost: example() is now evaluated for every failure, even when list is off, where before it ran only the first time per reason. It's a format! per refused program, so negligible next to the translation work.
  • Labels compare as strings, so @0x10 sorts before @0x9. That doesn't matter for determinism, just worth knowing if anyone expects the "lowest address".

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…e across workers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ErRusso

ErRusso commented Nov 24, 2026

Copy link
Copy Markdown

Audit: ✅ Looks good (needs Windows to fully compile)

Reviewed this PR as part of an audit of mergeable PRs.

  • Scope: apps/victory/src/translate.rs (+47/-10). Makes the stored failure example deterministic regardless of parallel worker order: fail() and the new record_failure() always keep the lexicographically smallest label, and merge() uses record_failure instead of or_insert_with which had a race on the initial example. The new test verifies stability across worker order permutations (both list modes, both merge orders, 4 variants).
  • Merges cleanly into main.
  • Test note: The victory binary crate's test suite depends on victory-gpu which doesn't compile on Linux (pre-existing #[cfg(windows)] gating gap). The logic is straightforward and the test surface is self-contained in translate.rs.

No issues found in the diff.

@molodayamama

Copy link
Copy Markdown

Independent Windows check of 3ba3f79c1952da6db19fb7960a960e41d3e225c2 (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).

  • cargo test -p victory --locked --bin victory failure_example_is_independent_of_worker_order -- --test-threads=1 --nocapture: 1 passed.

The fixture records translation-failure examples in different arrival orders and verifies that the output example is stable. No shader corpus used.

Only source-built synthetic fixtures were used. AI-assisted verification.

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…ey, in-flight dedup, and AOT warm-up

Conflicts resolved by hand:
- victory-shader/build.rs: one main() that computes the source hash
  (this PR) and then opts test binaries into an app-local Agility SDK
  runtime (upstream main), both unchanged.
- translate.rs: this PR's file work queue, fed by the fork's
  scan_entries() so traversal errors are still counted and reported;
  Tally keeps the cache counters and the smallest-label example (Marvisak#673).
- shader_cache.rs doc: this PR's wording with plain backticks (Marvisak#675).
- victory-pipeline cache.rs: this PR's get_or_convert_bytes path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 25, 2026
Where a fork-only change duplicates upstream's own version of a feature,
upstream's is kept and the fork's dropped:
- victory-shader is upstream's crate with the fork-only merges replayed
  onto it oldest first; those that do not apply onto upstream are dropped
  (37 of 63: among them Marvisak#704/raw views, gather4_l, the lane-mask and Marvisak#308
  ports, Marvisak#947, Marvisak#1022, Marvisak#1112, Marvisak#1090, Marvisak#1182). Marvisak#284 (legacy fused madds) and
  Marvisak#98 (permlane16 in whole-wave sections) are dropped too: the first
  disagrees with upstream's hardware-checked model, the second refused 46
  programs upstream translates.
- translate: upstream's --cache replaces Marvisak#254's write-cache and work queue;
  Marvisak#378, Marvisak#517, Marvisak#673 and the victory.toml console are re-applied.
- victory-gpu: upstream's stride table, page table and heap views replace
  the fork's Marvisak#704/stride-table wiring; fork-only fixes re-applied on top.

Package (shaders.rpf, translate --validate --list, counts): vertex/pixel
emitted 12559 -> 14295 of 14337, compute 2359 -> 2628 validated, mesh
2730 -> 2811 validated. Tests: the failures left (rect fourth corner,
two stride tests, row order, gather4 at a level, memory table, dynamic
heap slots) fail on upstream main as well on this host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. In apps/victory/src/translate.rs, Tally::fail and Tally::merge now both go through record_failure, which keeps the smallest example label for each reason, so the reported example no longer depends on which worker saw or merged a failure first. The minimum over all failures does not depend on order, and the new test failure_example_is_independent_of_worker_order checks this across both merge orders, with and without --list. Two small notes: the example closure is now always evaluated, not only on the first failure (a cheap format!). Also, "smallest" means string order, so @0x10 sorts before @0x2. That is still deterministic, which is the goal.

Thanks for the rebase onto 940d32f. It merges cleanly and keeps the upstream dump-directory test, so this is the first content review.

CI: passing (check).


Generated by Claude Code

@timorjay
timorjay force-pushed the timorjay/translate-stable-failure-examples branch from 3ba3f79 to d2f4344 Compare November 25, 2026 05:00
@timorjay

Copy link
Copy Markdown
Author

Rebased onto 940d32f in d2f4344. Both the upstream dump-directory test and the worker-order regression test are in the branch, and GitHub reports a clean merge with main.

Retested on Windows with synthetic inputs. All 11 unit tests for the victory CLI passed. For a file with 256 containers, all 96 runs selected many.bin@0x0 (32 runs each with 1, 4, and 12 workers). With z.bin before a.bin, unmodified main reported z.bin@0x0. The rebased PR selected a.bin@0x0 in both input orders and kept the detailed output identical.

The full workspace run on this machine had the same five test failures on both commits, two in victory-gpu and three in victory-shader. The GitHub Actions check for this PR passed.

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
geiyiliyabumo pushed a commit to geiyiliyabumo/VIctory that referenced this pull request Nov 25, 2026
…-440-111a

Shaders: keep SCC uniform for two-mask s_cmp_eq/lg (Marvisak#440)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants