victory-shader: hash the lowering tables with Fx instead of SipHash (lowering -16%) #1002

Closed
github-bot wants to merge 3 commits from gh-pr/1002/head into gh-pr/1002/base
Owner

@⁠pes7 on GitHub · 2026-11-24 14:52 UTC · original
pes7:perf/shader-fx-hash → main · +446 −127 · 7 files · 3 commits · closed without merging

Title: Shaders: the lowering tables hash with SipHash - one shared Fx hasher takes 16% off the lowering stage

Rebased onto main 940d32f (head 21ff7f6). The numbers below are from ffe310e, the base they were measured on, because lower.rs and structure.rs were both rewritten upstream since. The map sites upstream added in those files are on the same Fx hasher now - 22 of them in lower.rs alone - otherwise the file would carry two hashers and the claim would only hold for the tables this change knew about. The one place that stays on std::collections is Structured's public fields: they are pub, so a private hasher there is a private type in a public interface, which clippy -D warnings rejects. cargo test --workspace --locked passes, DXIL differential tests included (247 in this crate).

Where the time goes

emit/lower.rs keeps thirty tables keyed by Value, a register or a block index: vals, floats, bools,
lane_bits, phi_at, def_block, params, descriptors, scalar, exports, interps, handles, edges,
ballots, sections... They were std::collections::HashMap, whose default hasher is SipHash-1-3 with a random
per-process seed: setup, two rounds per word, finalisation. structure.rs had already noticed this ("The tables
below have small integer keys; SipHash dominated run time") and defined an Fx multiply-rotate hasher for its own
tables; the lowering stage, which is the larger half of a translation, never got it.

What changes

  • crates/victory-shader/src/hash.rs: the Fx hasher and Map/Set aliases, moved out of structure.rs
    (same 20 lines of hasher; structure.rs now imports it).
  • emit/lower.rs: 26 HashMap and 4 HashSet fields become Map/Set.
  • emit/wave.rs: sections() returns a Map (its caller stores it in one).
  • emit/bench_tests.rs: an #[ignore]d test that builds synthetic GFX10 compute programs - no game data - of
    256 to 16 384 instructions and times each stage, so this change and the next one are numbers rather than
    impressions. cargo test --release -p victory-shader --lib bench_tests -- --ignored --nocapture.

No emitted byte changes: these are lookup tables, and nothing iterates them. The one table whose order reaches the
output (user_reads, the user-data slots) is a BTreeMap and stays one.

Measured

One binary each, the same synthetic programs, ten interleaved rounds per arm (alternating, best of the ten) so the
machine's other work hits both arms:

instructions stage before after ratio
256 lowering 593 514 0.867
1 024 lowering 529 428 0.809
4 096 lowering 514 430 0.837
16 384 lowering 543 463 0.853
256 whole translation 1002 912 0.910
1 024 whole translation 981 920 0.938
4 096 whole translation 1046 968 0.925
16 384 whole translation 1068 965 0.904

Nanoseconds per instruction. ir::build, structure, resource and io are unchanged, as they should be.

Correctness

  • DXIL is byte-identical for all four program sizes: the bench prints an FNV-1a over the emitted bytes, and the
    four digests match between the two arms.
  • cargo test --workspace --locked
  • cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features
  • cargo xtask policy

No game data used anywhere.

Not included

A second experiment, ir::build building its per-instruction reads/writes as (Reg, Value) pairs instead of
Vec<Reg> then a second Vec (two allocations per instruction saved), measured -12 to -20% on ir::build but
was a wash over the whole translation, so it is not in this diff. Say the word if you want it measured again on
main.

**@⁠pes7** on GitHub · 2026-11-24 14:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1002) `pes7:perf/shader-fx-hash` → `main` · +446 −127 · 7 files · 3 commits · closed without merging Title: **Shaders: the lowering tables hash with SipHash - one shared Fx hasher takes 16% off the lowering stage** Rebased onto `main` `940d32f` (head `21ff7f6`). The numbers below are from `ffe310e`, the base they were measured on, because `lower.rs` and `structure.rs` were both rewritten upstream since. The map sites upstream added in those files are on the same Fx hasher now - 22 of them in `lower.rs` alone - otherwise the file would carry two hashers and the claim would only hold for the tables this change knew about. The one place that stays on `std::collections` is `Structured`'s public fields: they are `pub`, so a private hasher there is a private type in a public interface, which `clippy -D warnings` rejects. `cargo test --workspace --locked` passes, DXIL differential tests included (247 in this crate). ## Where the time goes `emit/lower.rs` keeps thirty tables keyed by `Value`, a register or a block index: `vals`, `floats`, `bools`, `lane_bits`, `phi_at`, `def_block`, `params`, `descriptors`, `scalar`, `exports`, `interps`, `handles`, `edges`, `ballots`, `sections`... They were `std::collections::HashMap`, whose default hasher is SipHash-1-3 with a random per-process seed: setup, two rounds per word, finalisation. `structure.rs` had already noticed this ("The tables below have small integer keys; SipHash dominated run time") and defined an Fx multiply-rotate hasher for its own tables; the lowering stage, which is the larger half of a translation, never got it. ## What changes - `crates/victory-shader/src/hash.rs`: the `Fx` hasher and `Map`/`Set` aliases, moved out of `structure.rs` (same 20 lines of hasher; `structure.rs` now imports it). - `emit/lower.rs`: 26 `HashMap` and 4 `HashSet` fields become `Map`/`Set`. - `emit/wave.rs`: `sections()` returns a `Map` (its caller stores it in one). - `emit/bench_tests.rs`: an `#[ignore]`d test that builds synthetic GFX10 compute programs - no game data - of 256 to 16 384 instructions and times each stage, so this change and the next one are numbers rather than impressions. `cargo test --release -p victory-shader --lib bench_tests -- --ignored --nocapture`. No emitted byte changes: these are lookup tables, and nothing iterates them. The one table whose order reaches the output (`user_reads`, the user-data slots) is a `BTreeMap` and stays one. ## Measured One binary each, the same synthetic programs, ten interleaved rounds per arm (alternating, best of the ten) so the machine's other work hits both arms: | instructions | stage | before | after | ratio | |---:|---|---:|---:|---:| | 256 | lowering | 593 | 514 | **0.867** | | 1 024 | lowering | 529 | 428 | **0.809** | | 4 096 | lowering | 514 | 430 | **0.837** | | 16 384 | lowering | 543 | 463 | **0.853** | | 256 | whole translation | 1002 | 912 | **0.910** | | 1 024 | whole translation | 981 | 920 | **0.938** | | 4 096 | whole translation | 1046 | 968 | **0.925** | | 16 384 | whole translation | 1068 | 965 | **0.904** | Nanoseconds per instruction. `ir::build`, `structure`, `resource` and `io` are unchanged, as they should be. ## Correctness - **DXIL is byte-identical** for all four program sizes: the bench prints an FNV-1a over the emitted bytes, and the four digests match between the two arms. - `cargo test --workspace --locked` - `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features` - `cargo xtask policy` No game data used anywhere. ## Not included A second experiment, `ir::build` building its per-instruction `reads`/`writes` as `(Reg, Value)` pairs instead of `Vec<Reg>` then a second `Vec` (two allocations per instruction saved), measured **-12 to -20% on `ir::build`** but was a wash over the whole translation, so it is not in this diff. Say the word if you want it measured again on `main`.
emit/lower.rs keeps thirty tables keyed by Value, a register or a block
index, and asks them about every instruction of every program. They used
HashMap's default SipHash. structure.rs already had an Fx hasher for the
same reason ("SipHash dominated run time"), but the lowering stage, the
larger half of a translation, never got it.

Move the hasher to crate::hash and use its Map/Set in emit/lower.rs and
wave::sections. No emitted byte changes: nothing iterates these tables,
and the one order that reaches the output (user_data) is a BTreeMap.

Measured with the new emit::bench_tests (synthetic GFX10 compute programs,
no game data), ten interleaved rounds per arm, nanoseconds per instruction:

  instrs   lowering before -> after    whole translation
     256      593 -> 514  (0.867)        1002 -> 912  (0.910)
    1024      529 -> 428  (0.809)         981 -> 920  (0.938)
    4096      514 -> 430  (0.837)        1046 -> 968  (0.925)
   16384      543 -> 463  (0.853)        1068 -> 965  (0.904)

The emitted DXIL is byte-identical for all four sizes. ir::build,
structure, resource and io are unchanged, as they should be.

cargo test --workspace --locked: 342 passed, 0 failed, 7 ignored.
Both clippy configurations clean; cargo xtask policy: 173 files ok.
The straight-line program the bench builds has a single block and no phis,
so it cannot say anything about loop handling, which every real shader
has. This adds a second shape: the same body with an `s_cmp_eq_u32` and an
`s_cbranch_scc1` back edge, so the pipeline sees three blocks and the phis
on the header.

Measured with both shapes in one session (min of six runs each, the two
tests alternating so the machine's noise hits both arms): the loop shape
costs 1.07 / 1.14 / 1.11 times the straight-line one per instruction at
256 / 1024 / 4096 instructions. 8192 is the largest body that fits: the
back edge is an `i16` of words.

So blocking, the phis and the loop header add about 10%, and `lower` and
`ir::build` stay within a few percent of their straight-line figures -
there is no large hidden cost in that part to chase.

No game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:16:39 +00:00
github-bot closed this pull request 2026-11-26 04:16:40 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 15:12 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 0e33bfe: cargo test -p victory-shader passes, 120 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 15:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/1002#issuecomment-7135647439) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 0e33bfe: `cargo test -p victory-shader` passes, 120 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠pes7 on GitHub · 2026-11-24 16:08 UTC · original

Independent follow-up, review them in any order: #1033 (one file, +25/-25) removes two of the four allocations ir::build makes per instruction - ir::build -13%, whole translation -4.7%, byte-identical output. It does not touch anything in this diff.

**@⁠pes7** on GitHub · 2026-11-24 16:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/1002#issuecomment-7137189045) Independent follow-up, review them in any order: **#1033** (one file, +25/-25) removes two of the four allocations `ir::build` makes per instruction - `ir::build` -13%, whole translation -4.7%, byte-identical output. It does not touch anything in this diff.
Author
Owner

@⁠pes7 on GitHub · 2026-11-24 18:30 UTC · original

Combined measurement of the three open ones, since the individual numbers overlap: this PR, #1033 and #1180 together, one binary pair, twelve interleaved rounds per arm (best of each), nanoseconds per instruction on main ffe310e vs the three applied:

instructions stage main all three ratio
16 384 lower 519 419 0.81
16 384 resource 22 15 0.68
16 384 structure 40 34 0.85
16 384 ir::build 408 372 0.91
16 384 whole translation 1 038 881 0.85
instructions whole translation main -> all three ratio
256 986 -> 852 0.864
1 024 964 -> 810 0.840
4 096 1 014 -> 844 0.832
16 384 1 038 -> 881 0.849

So about -15% per translation together, and the emitted DXIL is byte-identical at all four sizes.

decode is the one stage that pays: it resolves the name it used to be spared (#1180), 110 -> 113 at 16k, and grows Instruction by two words. That is inside the run-to-run spread here, but it is the honest trade.

The remaining profile after all three, per instruction at 16k: lower 419 (48%), SSA construction 259, decode 113, structure 34, io 25, resource 15. The next thing worth attacking is the lowering dispatcher (a match on ~250 opcode-name string arms), which is a structural change, not a one-liner.

**@⁠pes7** on GitHub · 2026-11-24 18:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1002#issuecomment-7140751207) Combined measurement of the three open ones, since the individual numbers overlap: this PR, #1033 and #1180 together, one binary pair, twelve interleaved rounds per arm (best of each), nanoseconds per instruction on `main` `ffe310e` vs the three applied: | instructions | stage | `main` | all three | ratio | |---:|---|---:|---:|---:| | 16 384 | `lower` | 519 | 419 | **0.81** | | 16 384 | `resource` | 22 | 15 | **0.68** | | 16 384 | `structure` | 40 | 34 | **0.85** | | 16 384 | `ir::build` | 408 | 372 | **0.91** | | 16 384 | *whole translation* | **1 038** | **881** | **0.85** | | instructions | whole translation `main` -> all three | ratio | |---:|---:|---:| | 256 | 986 -> 852 | **0.864** | | 1 024 | 964 -> 810 | **0.840** | | 4 096 | 1 014 -> 844 | **0.832** | | 16 384 | 1 038 -> 881 | **0.849** | So about **-15% per translation** together, and the emitted DXIL is byte-identical at all four sizes. `decode` is the one stage that pays: it resolves the name it used to be spared (#1180), 110 -> 113 at 16k, and grows `Instruction` by two words. That is inside the run-to-run spread here, but it is the honest trade. The remaining profile after all three, per instruction at 16k: `lower` 419 (48%), SSA construction 259, `decode` 113, `structure` 34, `io` 25, `resource` 15. The next thing worth attacking is the lowering dispatcher (a `match` on ~250 opcode-name string arms), which is a structural change, not a one-liner.
Author
Owner

@⁠pes7 on GitHub · 2026-11-24 18:31 UTC · original

Thanks - that is the verification this PR needed, and on AMD rather than the Blackwell box I measured on.

Two notes so the record is exact:

  • The head has moved from 0e33bfe to 74e2dbf. The only difference is a second commit that adds the gfx10::decode column to the bench (emit/bench_tests.rs); no production code changed, so your result stands for the current head too.
  • The change itself is CPU-bound, so RDNA3 vs Blackwell does not move the numbers - the card only matters for the valu_tests half of the suite, which you also ran green.

If you have a minute, the numbers themselves are reproducible on your machine with:

cargo test --release -p victory-shader --lib bench_tests -- --ignored --nocapture

It prints nanoseconds per instruction per stage at 256/1k/4k/16k instructions on synthetic GFX10 programs (no game data), and an FNV over the emitted DXIL so a diff shows up immediately. On my machine (Ryzen, Windows 11) lower goes 593 -> 514 at 256 instructions and the whole translation 1002 -> 912; main on the same binary pair is the "before" column. A second CPU would tell us whether that holds or it is a one-machine result - useful either way.

**@⁠pes7** on GitHub · 2026-11-24 18:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/1002#issuecomment-7140766842) Thanks - that is the verification this PR needed, and on AMD rather than the Blackwell box I measured on. Two notes so the record is exact: - The head has moved from `0e33bfe` to `74e2dbf`. The only difference is a second commit that adds the `gfx10::decode` column to the bench (`emit/bench_tests.rs`); no production code changed, so your result stands for the current head too. - The change itself is CPU-bound, so RDNA3 vs Blackwell does not move the numbers - the card only matters for the `valu_tests` half of the suite, which you also ran green. If you have a minute, the numbers themselves are reproducible on your machine with: ``` cargo test --release -p victory-shader --lib bench_tests -- --ignored --nocapture ``` It prints nanoseconds per instruction per stage at 256/1k/4k/16k instructions on synthetic GFX10 programs (no game data), and an FNV over the emitted DXIL so a diff shows up immediately. On my machine (Ryzen, Windows 11) `lower` goes 593 -> 514 at 256 instructions and the whole translation 1002 -> 912; `main` on the same binary pair is the "before" column. A second CPU would tell us whether that holds or it is a one-machine result - useful either way.
Author
Owner

@⁠pes7 on GitHub · 2026-11-24 18:47 UTC · original

Where the rest of the time goes, measured on the same synthetic programs with a counting global allocator (temporary, not in this PR). Per instruction:

stage allocations bytes
gfx10::decode 1.17 149
ir::build (includes its own decode) 8.17 965
structure + resource + io + lower 1.4 - 3.3 1.6 KB

And the split inside ir::build, timed by marks: decode 110, then fields + effects + push = ~285 ns per instruction, with link, liveness, SSA renaming and phi cleanup together under 20 ns. So the phase that looks like "SSA" in the table is almost entirely allocation.

At ~35 ns an allocation, 8 of them is ~280 ns - the whole of that phase. The lists are 1-4 elements each:

  • Instruction::words: Vec<u32>, a heap vector for an instruction that is usually one dword;
  • Fields::Sop.src, Fields::Smem.data, Fields::Mubuf.addr, Fields::Valu.src: Vec<Operand>;
  • Inst::reads / Inst::writes: Vec<(Reg, Value)>.

That is where the remaining ~25-30% of a translation sits, and it is a storage change (SmallVec-style inline arrays, or one arena per program with (start, len) in Inst), not an algorithm. It also changes public types in gfx10 and ir, so it does not belong in these three PRs - I would rather do it as its own change with this measurement as the target.

Whether it is worth it: on the real corpus one translation is 26k programs, so ~280 ns per instruction times the instruction count of the corpus. victory translate --list reports the total for the pack; that is what to multiply against.

Happy to take it if the direction sounds right, or to leave it here.

**@⁠pes7** on GitHub · 2026-11-24 18:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/1002#issuecomment-7141146872) Where the rest of the time goes, measured on the same synthetic programs with a counting global allocator (temporary, not in this PR). **Per instruction:** | stage | allocations | bytes | |---|---:|---:| | `gfx10::decode` | **1.17** | 149 | | `ir::build` (includes its own decode) | **8.17** | 965 | | `structure` + `resource` + `io` + `lower` | 1.4 - 3.3 | 1.6 KB | And the split inside `ir::build`, timed by marks: `decode` 110, then **fields + effects + push = ~285 ns per instruction**, with `link`, `liveness`, SSA renaming and phi cleanup together under 20 ns. So the phase that looks like "SSA" in the table is almost entirely allocation. At ~35 ns an allocation, 8 of them is ~280 ns - the whole of that phase. The lists are 1-4 elements each: - `Instruction::words: Vec<u32>`, a heap vector for an instruction that is usually one dword; - `Fields::Sop.src`, `Fields::Smem.data`, `Fields::Mubuf.addr`, `Fields::Valu.src`: `Vec<Operand>`; - `Inst::reads` / `Inst::writes`: `Vec<(Reg, Value)>`. That is where the remaining ~25-30% of a translation sits, and it is a storage change (`SmallVec`-style inline arrays, or one arena per program with `(start, len)` in `Inst`), not an algorithm. It also changes public types in `gfx10` and `ir`, so it does not belong in these three PRs - I would rather do it as its own change with this measurement as the target. Whether it is worth it: on the real corpus one translation is 26k programs, so ~280 ns per instruction times the instruction count of the corpus. `victory translate --list` reports the total for the pack; that is what to multiply against. Happy to take it if the direction sounds right, or to leave it here.
Author
Owner

@⁠pes7 on GitHub · 2026-11-24 22:03 UTC · original

Rebased onto today's main (70564ae), which rewrote much of emit/lower.rs (+3 300 lines: BVH lowering, the low16 table, a changed half_outputs): five conflicts, resolved by keeping the upstream structure and putting the maps on the Fx hasher.

Two things worth knowing about the new head (b6db985):

  • upstream's own additions in that file brought 22 new HashMap/HashSet sites (the whole-file constants analysis, liveness, touched/konst/can_be). They are on crate::hash::{Map, Set} now too, otherwise the file would have two hashers and the claim would only hold for the tables this PR knew about;
  • the diff against main is +420/-103, larger than the original change because it has to carry those sites too.

The measured numbers in the description are from the pre-rebase base (ffe310e), where lower 593 -> 514 and the whole translation 1 002 -> 912 ns per instruction. structure.rs and lower.rs have both changed a lot since, so treat them as the number for the change, not for today's tree - I can re-run the same bench on 70564ae against a main build if anyone wants the current figure before merging.

cargo test -p victory-shader --locked: 209 passed, 0 failed (DXIL differential tests included, so the output is still byte-identical). Both clippy configurations with -D warnings pass, as does cargo xtask policy.

**@⁠pes7** on GitHub · 2026-11-24 22:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/1002#issuecomment-7145752392) Rebased onto today's `main` (`70564ae`), which rewrote much of `emit/lower.rs` (+3 300 lines: BVH lowering, the `low16` table, a changed `half_outputs`): five conflicts, resolved by keeping the upstream structure and putting the maps on the Fx hasher. Two things worth knowing about the new head (`b6db985`): - upstream's own additions in that file brought **22 new `HashMap`/`HashSet` sites** (the whole-file constants analysis, liveness, `touched`/`konst`/`can_be`). They are on `crate::hash::{Map, Set}` now too, otherwise the file would have two hashers and the claim would only hold for the tables this PR knew about; - the diff against `main` is +420/-103, larger than the original change because it has to carry those sites too. The measured numbers in the description are from the pre-rebase base (`ffe310e`), where `lower` 593 -> 514 and the whole translation 1 002 -> 912 ns per instruction. `structure.rs` and `lower.rs` have both changed a lot since, so treat them as the number for the change, not for today's tree - I can re-run the same bench on `70564ae` against a `main` build if anyone wants the current figure before merging. `cargo test -p victory-shader --locked`: 209 passed, 0 failed (DXIL differential tests included, so the output is still byte-identical). Both clippy configurations with `-D warnings` pass, as does `cargo xtask policy`.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:17 UTC · original · edited 2026-11-25 16:00 UTC

Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-shader/src/emit/lower.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (merge-candidate) was for an older state of main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1002#issuecomment-7149392113) · edited 2026-11-25 16:00 UTC <!-- victory-triage v1 head=21ff7f60e6eafafdf08fff68f69417a02c52ea98 verdict=needs-rebase at=2026-11-25T15:59:10Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-shader/src/emit/lower.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (merge-candidate) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠pes7 on GitHub · 2026-11-25 16:26 UTC · original

Measured on the real corpus, and the result is against this PR: the hasher change does not show up in the title's own shaders.

Setup: the full shaders.rpf of the Xbox build (26 503 containers, 26 084 programs, 40 601 701 IR instructions), victory translate <shaders.rpf> --list. The two binaries ran at the same time, one thread each (--jobs 1) on a 32-core machine, so they shared identical conditions and the difference between them is the change rather than the machine's load:

wall finish line
main 940d32f 659 s 26503 of 26503 containers (100%), 659 s
this PR 21ff7f6 657 s 26503 of 26503 containers (100%), 657 s

-0.3%, inside the noise. The two finished 2 s apart after eleven minutes of work, and the progress lines at 93% were identical to the second.

Why this differs from the bench in this PR: the #[ignore]d bench measures lower on synthetic straight-line and loop programs, where the stage is a large share of the translation and the hash tables are hot. A real program averages 1 557 instructions with loads, stores, control flow and resource analysis around it, so lower's hashing is a much smaller part of the 25 ms a program takes - small enough that -16% of it is invisible.

What the corpus does confirm, and this part is worth having on the record: the translation output is identical to main on all 26 084 programs - every count in the summary (containers, programs, structured, resources by kind, DXIL per stage, each emit:/resources: line) matches, and the only differences between the two --list outputs are the (e.g. ...) examples, which are picked by whichever thread finishes first.

So: a type swap that is neutral in practice. That is not the bar for landing here, so I am closing it rather than leaving it in the queue - the DXIL-identical measurement and the bench stay in the thread for whoever picks the hashing question up again (FIND-1 is the arena change, which is a different and larger lever). Say the word if you want it reopened with this measurement in the description instead.

**@⁠pes7** on GitHub · 2026-11-25 16:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1002#issuecomment-7167995813) Measured on the real corpus, and the result is against this PR: **the hasher change does not show up in the title's own shaders.** Setup: the full `shaders.rpf` of the Xbox build (26 503 containers, **26 084 programs, 40 601 701 IR instructions**), `victory translate <shaders.rpf> --list`. The two binaries ran **at the same time, one thread each** (`--jobs 1`) on a 32-core machine, so they shared identical conditions and the difference between them is the change rather than the machine's load: | | wall | finish line | |---|---:|---| | `main` `940d32f` | **659 s** | 26503 of 26503 containers (100%), 659 s | | this PR `21ff7f6` | **657 s** | 26503 of 26503 containers (100%), 657 s | **-0.3%, inside the noise.** The two finished 2 s apart after eleven minutes of work, and the progress lines at 93% were identical to the second. Why this differs from the bench in this PR: the `#[ignore]`d bench measures `lower` on synthetic straight-line and loop programs, where the stage is a large share of the translation and the hash tables are hot. A real program averages 1 557 instructions with loads, stores, control flow and resource analysis around it, so `lower`'s hashing is a much smaller part of the 25 ms a program takes - small enough that -16% of it is invisible. What the corpus does confirm, and this part is worth having on the record: the translation output is **identical** to `main` on all 26 084 programs - every count in the summary (containers, programs, structured, resources by kind, DXIL per stage, each `emit:`/`resources:` line) matches, and the only differences between the two `--list` outputs are the `(e.g. ...)` examples, which are picked by whichever thread finishes first. So: a type swap that is neutral in practice. That is not the bar for landing here, so I am closing it rather than leaving it in the queue - the DXIL-identical measurement and the bench stay in the thread for whoever picks the hashing question up again (`FIND-1` is the arena change, which is a different and larger lever). Say the word if you want it reopened with this measurement in the description instead.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1002
No description provided.