Repository navigation
Shaders: f16 wave sums behind early-outs translate on 32-lane hosts (compute_graph_ops:CS_TransposeVecMatMul*) - #13
Closed
Skyfrye wants to merge 1 commit into
Conversation
…can go (f16 wave sums on 32-lane hosts)
`half_sum` lowers a 16-bit-float WaveActiveSum as the console's tree, and on
two 32-lane host waves needs a block every lane of the group reaches. In
compute_graph_ops:CS_TransposeVecMatMul{,Aligned}Operation the sums sit behind
early-outs (v_cmpx + s_cbranch_execz), and `without_early_outs` could not drop
them: its guard `walks_with_empty_exec` wants EXEC to stay empty in the walked
region, and the sum's own section opens with `s_or_saveexec ..., -1`.
`whole_wave_arithmetic` recognises a whole-wave section that only computes
(opens with s_or_saveexec -1 or s_nand_saveexec 0, VALU instructions only, no
other EXEC write, ends restoring exactly the saved mask) and the guard accepts
it: lanes that left walk it as the console's inactive lanes do, their terms
+0 by the saved mask, nothing stored.
shortcut: only sections with v_add_f16 qualify.
Both shaders now translate ("a wave sum of 16-bit floats where not every lane
runs" before); every other program's DXIL is byte for byte what it was.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Author
|
Closing: AnyXboxX Marvisak#199 moved the engine into the main repository ( AI use: Claude Code (Claude Fable 5.2). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
compute_graph_ops:CS_TransposeVecMatMulAlignedOperation(b22a16a178976e1b) andCS_TransposeVecMatMulOperation(a26a38d61f256901) do not translate on a host with 32-lane waves: "a wave sum of 16-bit floats where not every lane runs is not supported". In our runs (RTX 5080) the first is requested in game and dropped 14 to 42 times a frame; it runs next to the blendshape and ped skinning dispatches.Why:
half_sumlowers a 16-bit-floatWaveActiveSumas the console's tree; on two 32-lane host waves the last addition needs a block every lane of the group reaches. In these shaders the sums sit behind early-outs (v_cmpx+s_cbranch_execzto the end).ir::without_early_outscould not drop them, because its guardwalks_with_empty_execwants EXEC to stay empty in the walked region and the sum's own whole-wave section opens withs_or_saveexec_b64 ..., -1.Change
victory-shader/src/ir.rsonly (plus tests):whole_wave_arithmeticrecognises a whole-wave section that only computes — opens withs_or_saveexec -1ors_nand_saveexec 0, only VALU instructions, no other EXEC write, ends with thes_movthat restores exactly the saved mask — andwalks_with_empty_execaccepts it. Lanes that left walk the section as the console's inactive lanes do: their terms are +0 by the saved mask, the saved (empty) EXEC is put back, nothing is stored. The early-outs can then go and the existing bit-exacthalf_sumapplies unchanged.// shortcut:only sections that containv_add_f16qualify.Tests (
emit/wave64_tests.rs)a_sum_of_halves_behind_early_outs_adds_zero_for_the_lanes_that_left: two console waves in a group of 128, two early-outs, then the sum; asserts the refusal as is, thatwithout_early_outsremoves both branches, validates the DXIL and runs 14 cases (all lanes, partial halves, a whole wave gone, lane 0 gone, nobody) against a reference tree built on an f64 round-to-nearest-evenadd_f16. Bit-exact on the RTX 5080.an_early_out_before_a_whole_wave_section_that_stores_stays.the_reference_addition_of_halves_rounds_to_nearest_even.cargo test --profile diag -p victory-shader: 208 passed, 0 failed, 2 ignored.In the title
translate --list(VICTORY_HOST_MAX_WAVE=32): both shaders are emitted; compute 2,667 → 2,669 of 2,682; every other program's DXIL is byte for byte what it was (25,628 dumps compared).b22a16a178976e1bas not translating.Not tested
AI use: Claude Code (Claude Fable 5.2) found the cause, wrote the change and the tests, ran them and the game on my machine with my own copy, and wrote this description.
🤖 Generated with Claude Code