Bitcode clean-up: FxHash tables and join keys allocated once #269
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/269"
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 amine23012004 on 2026-11-26T13:56:48Z.
Bitcode clean-up: FxHash tables and join keys allocated once
What. The bitcode optimiser's tables (
known,read,Facts,joins) used the standard library's SipHash. Profiling a translation showed hashing their small integer keys as the largest single cost ofemit. They now use the FxHash thatstructure.rsalready had; it moves to a smallcrate::fxmodule so both share it (no new dependency). Each join's key is also built at its final size and sorted withsort_unstable(its elements are totally ordered, so the result is the same) instead of collected, sorted and then grown by one.Same output. DXIL is byte-for-byte identical before/after on the programs below, compared against two separate runs of
main. SipHash is seeded per process, so the output could not depend on the tables' iteration order before this either.Measured (Linux, release, best of 25,
emitonly; synthetic pixel programs: blocks of 8 VALU ops underv_cmpx/s_cbranch_execzwith EXEC saved and restored, ending inexp mrtz):Second commit:
lowertoo.lower's tables keyed byir::Value(values, floats, lane bits, phi sites, uniform values...) were the next SipHash cost once the optimiser's were gone; they now usecrate::fxas well (aSetalias is added). The per-block sections thatwave::sectionsreturns keep their std type. Same DXIL byte for byte;emiton 4,805 instructions goes from 33 ms to 29.4 ms on top of the first commit.These are synthetic programs, not the title's shaders: I have not measured
victory shaderson a real dump, so the real-world gain is unconfirmed.Checks.
cargo test -p victory-shader(209 passed),cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc -- -D warningsclean.Independent of #268 (the
ir::buildchange); the two touch different files.🤖 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.