Bitcode clean-up: FxHash tables and join keys allocated once #269
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!269
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@amine23012004 on GitHub · 2026-11-26 13:56 UTC · original
amine23012004:perf/bitcode-opt-fx-hash→main· +87 −79 · 5 files · 2 commits · openBitcode 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.