feat(tools): add the shader corpus sweep and its comparison #286
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/286"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by Sandile-0511 on 2026-11-27T08:45:57Z.
What this changes
Refs #282
Puts the shader corpus sweep in the repository, without any shader data, as asked on #258 (https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/258#issuecomment-7213183271). Anyone with a dump of their own can now check a translator change against every shader the title registers, and see what it does by output and not only by counts.
crates/victory-shader/examples/sweep.rstranslates every<stage>_<hash>.bincontainer of a folder with the native host's options (wave32_host,zero_copy_memory) and prints one line per shader:ok,refused,panic,timeoutormissing, then the output fingerprint or the reason, then the milliseconds. It has worker threads (-j), a list of files (--list), a time limit per shader (--timeout, 120 s by default: the stuck worker is left running and another takes its place) and--showfor the host-side description in place of the fingerprint. It is an example of the crate so that it is always built with the translator of the tree it sits in.tools/corpus/compare.shtallies one sweep (outcomes per stage, refusal reasons by count) or compares two: newly translated, regressions, output changed, other reason now.--world FILEadds how many of each are among the shaders a reference run bound. It is bash and awk likerun-summary.sh, with a--self-teston made-up sweeps that CI'smacos-scriptsjob now runs.docs/native-host.md(dump your own corpus withVICTORY_DUMP_ALL_SHADERS=1 VICTORY_DUMP_REFUSED=<folder>, sweep two builds, compare, what the fingerprint is, what a sweep does not cover, and that the corpus and the sweep files stay outside the repository), and a short section inAGENTS.md.The fingerprint is the one behind the numbers already posted on #258: std's
DefaultHasherover the DXIL, then over theDebugtext of the rest of theHostShader. A test pins it.Things to know before reviewing:
cargo xtask policyallows no.pyfile without an exception. Its output is the same byte for byte on the sweeps I had (see below).crates/victory-shader/Cargo.tomlgains an[[example]]entry withtest = true, socargo test -p victory-shaderand CI'scargo test --workspacerun the sweep's tests. The manifest is part ofSOURCE_HASH, so the on-disk translation cache is made again once, as after any change to the crate's sources.thread_counts, rectangle lists,extra_params) or anything after translation. The docs say so.HostShaderfields. A change that adds a field changes every fingerprint. The docs say so too.How it was tested
cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: not run, the change touches none of these cratescargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warningsAlso:
cargo test -p victory-shader: the 330 library tests and the 5 new sweep tests pass (one line per container, in name order, the same again on a second sweep;--show; the fingerprint covers the DXIL and the host description, and its definition is pinned; a panic is a line; a translation past the limit is given up on and the sweep goes on). These ran on macOS only: CI's Windows job is their first run there.cargo xtask policy: 372 files ok.cargo test -p xtaskpasses./bin/bash tools/corpus/compare.sh --self-test: ok with bash 3.2 and macOS's awk. Not run with gawk or mawk.2a3b03d, swept my 21,608 shaders at-j 4in 2 min 14 s. 17,479 translate and 4,129 are refused, and every line's outcome, fingerprint and reason is identical to the baseline sweep those numbers came from.compare.shagainst the Python script it replaces: identical output on 16 invocations over real sweeps (the tally with and without a world list, eleven pairs of sweeps,--show 0and--show 3,--names).Checklist
VICTORY_*variable and documented (none added)Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T10:32:30Z.
Thank you. This is the sweep I asked for, with no shader data in it, and the docs say that the corpus and the sweep files never go into the repository. It is a draft, so I will read it again when you mark it ready.
Two questions. Does the shell comparison give the same counts as the numbers you posted in #258 on the sweeps you had (the text says byte for byte; please say it was checked on the real ones)? And the change to
ci.ymlis one line; I will look at it myself. I have not run it.