perf(shader): speed up DXBC container hashing #334

Open
github-bot wants to merge 1 commit from github-bot/gh-334 into main AGit
Owner

@⁠brainbudt on GitHub · 2026-11-26 17:26 UTC · original
brainbudt:perf/dxbc-container-md5 → main · +259 −52 · 1 files · 1 commits · open

Problem

Emitting a DXBC container allocates a temporary heap buffer for MD5 padding and computes the message index and rotation per compression step at runtime.

Change

Build the final one or two blocks in a 128-byte stack buffer and unroll all 64 MD5 steps in pure safe Rust (crates/victory-shader/src/emit/container.rs), preserving DXBC's non-standard padding byte-for-byte.

Verification

  • cargo test -p victory-shader --lib container (5 passed) and dxbc (2 passed), cargo clippy -p victory-shader --lib -- -D warnings, and cargo xtask policy (266 files) all passed.
  • Padded blocks and digests matched HEAD byte-for-byte across 1,155 independent length comparisons covering the 55/56-byte padding boundary.
  • Hash microbenchmark: 1.69–1.93× speedup on macOS ARM64 across 0 B–1 MiB (1.17–1.29× on Linux x86-64).

Reviewed by GPT-6.2 Sol in Codex (APPROVE); implemented with Mistral Large 4 in Mistral Vibe (orchestrated with Gemini 4 Neon in T3 Code).

**@⁠brainbudt** on GitHub · 2026-11-26 17:26 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/334) `brainbudt:perf/dxbc-container-md5` → `main` · +259 −52 · 1 files · 1 commits · open ## Problem Emitting a DXBC container allocates a temporary heap buffer for MD5 padding and computes the message index and rotation per compression step at runtime. ## Change Build the final one or two blocks in a 128-byte stack buffer and unroll all 64 MD5 steps in pure safe Rust (`crates/victory-shader/src/emit/container.rs`), preserving DXBC's non-standard padding byte-for-byte. ## Verification - `cargo test -p victory-shader --lib container` (5 passed) and `dxbc` (2 passed), `cargo clippy -p victory-shader --lib -- -D warnings`, and `cargo xtask policy` (266 files) all passed. - Padded blocks and digests matched HEAD byte-for-byte across 1,155 independent length comparisons covering the 55/56-byte padding boundary. - Hash microbenchmark: 1.69–1.93× speedup on macOS ARM64 across 0 B–1 MiB (1.17–1.29× on Linux x86-64). --- Reviewed by GPT-6.2 Sol in Codex (APPROVE); implemented with Mistral Large 4 in Mistral Vibe (orchestrated with Gemini 4 Neon in T3 Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 17:28:43 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/334/head:github-bot/gh-334'
git switch 'github-bot/gh-334'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-334'
git switch 'github-bot/gh-334'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-334'
git switch 'github-bot/gh-334'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-334'
git switch 'main'
git merge --squash 'github-bot/gh-334'
git switch 'main'
git merge --ff-only 'github-bot/gh-334'
git switch 'main'
git merge 'github-bot/gh-334'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.