Shader tests: differential fuzzing against an RDNA2 interpreter ("oracle") #403
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/403"
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 avatarmanz/VIctory-7900XTX. Originally posted by simbaui4life on 2026-11-27T00:18:11Z.
A differential fuzzer for the shader translator, as tests. One commit on
014d52d; there is no change to the translator, andTRANSLATOR_VERSIONis unchanged.Why: the translator's tests check chosen cases. This one checks whole random programs against a model of the RDNA2 ISA that shares no code with the translator, on the GPU the translation runs on. It covers EXEC-narrowed branches, SCC, VCC and cross-lane reads and writes. It found the faults fixed in the s_min/s_max and lane-select PR (
simbaui4life:fix/salu-minmax-scc-lane-masks) and the scalars-after-lane-branches PR (simbaui4life:fix/scalars-after-lane-branches), and four that are still open (below).How it works (
crates/victory-shader/src/emit/oracle_tests.rs,cfg(all(test, windows)))v_readlane/v_writelane/v_readfirstlane.spill::build,structure,resource::track,io::raise,emit_with_retries.emit::hostand compared lane by lane with an interpreter that shares nothing with the translator (not the decoder, the IR or the lowering).TEST_HOST_WAVE), once with exact forms only (VICTORY_WAVE_LOCAL=idiom) and once as the default.Running it
oracle_encoding_reads_back_as_the_instructions_meant,oracle_interpreter_follows_the_isa_on_known_cases.#[ignore]d:VICTORY_ORACLE_RUNS=200 VICTORY_ORACLE_SEED=1 cargo test -p victory-shader --lib oracle_fuzz -- --ignored --nocapture --test-threads=1VICTORY_ORACLE_OUT=<file>writes the report.VICTORY_ORACLE_AVOID=salu_in_branch,minmax_scc,lane_range,writelane_inactive,mask_dataleaves out the known classes, so new ones stand out.Open findings on main (RTX 4070 Ti, so wave64 runs on two 32-lane host waves)
v_writelane_b32to a lane EXEC leaves out: the console writes it, here it is not written.v_cmpunder narrowed EXEC: the console writes 0, here they keep what they had.v_readfirstlane_b32is taken per 32-lane half (the shortcut documented inlower.rs). This one goes away withVICTORY_WAVE_WIDE=1.Tested (RTX 4070 Ti, driver 621.01, Windows 11 26200)
cargo clippy -p victory-shader --all-targets -- -D warnings, the same with--all-features, andcargo test -p victory-shader(304 passed, 0 failed, the two default oracle tests included).Not tested: AMD hardware. On an RDNA card wave64 runs natively, so the wave64 findings above may not show there.
No game data in the commits.
🤖 Generated with Claude Code
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.