perf(shader): group signature elements by row for interpolation normalization #3483
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3483
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3483"
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?
@Damokles2 on GitHub · 2026-11-27 07:37 UTC · original
Damokles2:perf-shader-signature-row-grouping→main· +103 −9 · 1 files · 1 commits · openSummary
Optimize
same_mode_per_row()invictory-shaderby grouping signature elements by register row.Performance
The CPU-only A/B benchmark compared the upstream and optimized helpers on the same native Windows-MSVC AMD EPYC runner. Both variants used identical compiler settings, 512 warm-up calls, and 15 alternating batches of 4,096 calls. The matrix covers 144 workloads with varying signature sizes, row distributions, element ordering, and interpolation modes.
The final hosted benchmark showed no meaningful small-signature regression. The weakest 32-element result was within measurement variation. These measurements apply only to the normalization helper.
Memory trade-off
Signatures with up to 16 elements use 256 bytes of inline scratch on x64 and require no heap allocation. For larger signatures, allocation counts match upstream and temporary heap storage increases fourfold. At 128 elements, peak heap scratch increases from 512 bytes to 2,048 bytes.
Correctness and validation
The synthetic comparisons and benchmark required no proprietary game files or GPU execution.
Evidence
Validated feature
aa5f45ec805543b03f80f75fcaf412099a86fa3d, upstream base63bcca43c6a00a758510398fa43096ce7e4f7df0, and fork CI merge5ac7583f6c767936080f5b1901de39f722e4fa55.AI-assisted with OpenAI Codex.
@oni-swr on GitHub · 2026-11-27 08:35 UTC · original
Independent WARP verification of #3483 (head
aa5f45ec)Setup. Windows 11 Pro 10.0.26200, AMD Ryzen 7 5700X3D, rustc 1.98.1. No physical GPU used:
VICTORY_WARP=1andVICTORY_D3D12_WARP=1;VICTORY_DXIL= Windows SDK 10.0.26100.0 x64dxil.dll(1.8.2502.11). Command:cargo test -j 4 -p victory-shader --lib --locked -- --test-threads=1. The PR's merge-base isffe310e, so I compared basemain63bcca43with a clean test merge ofaa5f45econto63bcca43(no conflicts; onlyemit/container.rsdiffers).Tests
63bcca4363bcca43+ #3483The 2 extra passes are the PR's new tests (
interpolation_modes_follow_rows_without_reordering,interpolation_modes_leave_empty_and_singleton_signatures_alone). The same 4 fail on base and head, so they are not caused by this PR:synthetic_tests::{a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_mask_high_address_bits_and_divergent_branches, permutes_read_the_lane_named_and_zero_from_lanes_left_out}. They assert hardware lane behaviour and fail on WARP.Review: no behaviour change found.
!free && interp != 0), the conflict check and the "undecided" set (free) use the same predicates as before.freedoes not depend oninterp, so writing during the group walk cannot change what later elements see.(row, index)list is sorted;elementsis never reordered.group.len() < 2andlen() < 2early-outs are safe. Empty and one-element signatures are no-ops. Duplicate rows,row: None, sparse rows andu32::MAXrows are handled.elements.len() <= 16. The row-bearing entries number at mostlen(), so it cannot overflow. 17 or more elements take theVecpath.readvalues, mixed kind/comp/interp/usage,Noneandu32::MAXrows). All results were identical field for field.Timing (standalone
rustc -O, 15 alternating batches of 4,096 calls, median ns per call, idle machine):Head is faster at every size, in line with the PR's numbers. The step at 17 elements is the heap fallback: still faster, but less so. In absolute terms the function takes under about 20 µs even at 128 elements, so the practical effect is small.
Blocking findings: none.
No game files, dumps, install paths, shader names or hashes were used. AI-assisted: Claude Code (Claude Sonnet 5.5).
@cloph-dsp on GitHub · 2026-11-27 09:05 UTC · original
Independent CPU-only verification of PR #3483 (shader signature row grouping).
CARGO_TARGET_DIR(D:\Victory-Contrib\target-3483-verify),CARGO_BUILD_JOBS=2.aa5f45ec805543b03f80f75fcaf412099a86fa3d, merge base63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-shader --lib -- emit::container::tests::interpolation_modes_follow_rows_without_reordering --exact --test-threads=1 --quiet->1 passed; 0 failed; 306 filtered out.git grep -Ffor the new test name on63bcca4returned no hits (test absent on base).git diff --check 63bcca4 HEADexit 0 (clean).@futurepro62 on GitHub · 2026-11-27 18:46 UTC · original
NVIDIA full-suite run, to go with the reports above by cloph-dsp, oni-swr, since none of them names a GPU run. Tested exact head
aa5f45e(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.interpolation_modes_follow_rows_without_reordering,interpolation_modes_leave_empty_and_singleton_signatures_alone.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
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.