Shaders: lower v_cvt_f32_f64 and model v_add_f64 whole-wave sums #9
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!9
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-9"
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?
@MartinIndra02 on GitHub · 2026-11-24 19:39 UTC · original
MartinIndra02:feat/fxceless-cvt-f32-f64→main· +658 −1 · 5 files · 3 commits · openSummary
Lowers
v_cvt_f32_f64and modelsv_add_f64whole-wave sums (pluss_mov_b32scalar copies inside whole-wave sections):v_cvt_f32_f64(crates/victory-shader/src/emit/lower.rs)(lo, hi)(VGPR pair, SGPR pair, inline f64 constants240..=248,0, or high-dword 32-bit literal) withabs/neginput modifiers.exp64 == 873halfway-to-min-subnormal, overflow to±Inf, underflow to±0, andsNaN→qNaNquieting) without requiring hostDOUBLESsupport.64-bit float whole-wave sum (
v_add_f64) &s_mov_b32copy (bitcode.rs,shader.rs,wave.rs,lower.rs)TypeDef::Double(TYPE_CODE_DOUBLE = 4) inbitcode.rsandflags::DOUBLES(ShaderFlagsbit 5,SFI0bit 0) inshader.rs.v_add_f64pairs inwave.rsasSym::Red64F→Shape::ActiveF64(lo, hi, mask, high), and propagatess_mov_b32copies inside whole-wave sections.Shape::ActiveF64viadx.op.makeDouble→dx.op.waveActiveOp.f64→dx.op.splitDouble.f64, withexchange_halves+faddwhen running Wave64-on-Wave32.Verification
v_cvt_f32_f64_matches_ieee754: 27 IEEE-754 edge cases +abs/negmodifiers pass bit-for-bit on both RTX 3080 and WARP.whole_wave_f64_sum_and_cvt_f32_f64: end-to-end Wave32v_add_f64whole-wave reduction +s_mov_b32+v_cvt_f32_f64passes on RTX 3080.cargo test -p victory-shader --lib: all tests pass.cargo clippy --workspace -- -D warnings(default +--features diagnostics): 0 warnings.cargo xtask policy: 167 files ok.emit: v_cvt_f32_f64:5 → 0emit: a whole-wave section step the simulation does not follow:5 → 0(0 remaining across all 26,084 programs)2,663 → 2,666of2,682(+3compute shaders emitted; the other 2 advance pastv_add_f64/v_cvt_f32_f64toa lane mask holding lanes elsewhere read as data).AI-assisted contribution (Antigravity); all code, tests, and hardware verification run and reviewed locally. No game data.
@fxceless on GitHub · 2026-11-24 20:18 UTC · original
Thanks for this. The
v_cvt_f32_f64part looks fine, but on the test machine here (RTX 4070, withdxil.dllpresent so the tests validate) the PR's own test fails:The validator wants the overloaded name (
dx.op.makeDouble.f64); withoutdxil.dllthe test skips validation, which is probably why it passed for you. Could you fix the declaration and re-run with the validator available? Happy to merge after that.@marquezinii on GitHub · 2026-11-24 20:26 UTC · original
Tested on an RTX 5070 (driver 621.40, Windows 11, SDK 10.0.26100
dxil.dll1.9.2602), PR headb17b69f.Same failure as on the 4070. Renaming the three calls to
makeDouble.f64clears the first error, but validation then stops on a second one:The difference is 0x20 vs 0x04:
flags::DOUBLESis1 << 5, which isLowPrecisionPresentin DXIL'sShaderFlags; double precision is bit 2. With both changes:(and the same for the two calls in the wave64-on-wave32 branch),
cargo test -p victory-shader --libpasses here, 200 passed, 2 ignored, includingwhole_wave_f64_sum_and_cvt_f32_f64with the validator loaded and running on the card. TheSFI0bit 0x1 is already right.@MartinIndra02 on GitHub · 2026-11-24 20:47 UTC · original
Fixed both issues in the latest commit — thanks @fxceless and @marquezinii for catching this with \dxil.dll!
Re-verified \whole_wave_f64_sum_and_cvt_f32_f64, \_cvt_f32_f64_matches_ieee754, \clippy -p victory-shader --all-targets -- -D warnings, and \cargo xtask policy\ locally on RTX 3080 (still without \dxil.dll\ installed on this machine).
@adriaespii on GitHub · 2026-11-24 20:54 UTC · original
Independent test run on commit
61e5f79(AMD RDNA4):x86_64-pc-windows-msvc)cargo clippy --workspace --all-targets -- -D warnings: 0 warningscargo test --workspace: 486 passed, 0 failed, 7 ignored (victory-shader: 200 passed, 0 failed, 2 ignored;victory-gpu: 110 passed, 0 failed, 1 ignored)AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.
@KaliemSB on GitHub · 2026-11-24 21:43 UTC · original
Tested on the title's own shaders:
v_cvt_f32_f64programs now translate and validate. The other 2 now stop at the next unsupported feature.Setup
cargo build --release -p victorydxil.dllanddxc.exe1.9.2609.54e17478(forkmain) against4e17478with this PR's head61e5f79merged (1ea962e). Nothing else merged.VICTORY_HOST_WAVE=32 VICTORY_VIEW_LIMIT=999999, the same forms the runtime picks on this cardWhole archive (
victory translate <dump> --list, 26,599 containers, 26,148 programs):v_cvt_f32_f64Per program (each extracted,
--validate, then--pipelines, thendxc -dumpbinfor the wave size):water_shading:CS_TransmissionVolumetrics_Tiled5dc3b25986622949v_cvt_f32_f64WaveSize=64, pipeline refused (E_INVALIDARG)water_shading:CS_TransmissionVolumetrics_Tiled_LocalLights6f225b641c5b0708v_cvt_f32_f64WaveSize=64, pipeline refusedwater_shading:CS_TransmissionVolumetrics_VolumePortalsOnlya10179ab7eda0dc3v_cvt_f32_f64WaveSize=64, pipeline refused926c46bab3b86bd6v_cvt_f32_f64a lane mask holding lanes elsewhere read as data6871d6e4b3ac9a10v_cvt_f32_f64a lane mask holding lanes elsewhere read as dataTests,
cargo test -p victory-shaderon4e17478+ this PR:4e17478alone gives 208 passed, 2 failed.rect::testsPSV-validation failures with the default Windows SDK 10.0.22621dxil.dll(1.6.2112). They pass withdxil.dll1.9.2609.5 or with #61.AI use: Claude Code (Claude Opus 5.5) built the trees, ran the translations and tests, and drafted this; the machine is mine. No game files or extracted shaders attached.
@marquezinii on GitHub · 2026-11-24 21:50 UTC · original
Re-ran
61e5f79on the RTX 5070 (driver 621.40, Windows 11) with the SDK 10.0.26100dxil.dllpresent, so the shader tests validate this time:cargo test --workspace: 486 passed, 0 failed, 7 ignored.whole_wave_f64_sum_and_cvt_f32_f64andv_cvt_f32_f64_matches_ieee754pass. DXIL validation succeeds, and both cases are compared on the card. On WARP the f64 test skips pipeline creation (E_INVALIDARG), which the test expects for the fixed wave size.cargo clippy --workspace --all-targets -- -D warnings, default and--all-features: clean.@arminkhaleghirod on GitHub · 2026-11-24 22:23 UTC · original
Merged onto main
90228a7and ranvictory translate --validateover the full title (26,148 programs) on Windows 11 / RTX 4080.v_cvt_f32_f64: 5 → 0emit: a lane mask holding lanes elsewhere read as data@rmstamate on GitHub · 2026-11-25 10:19 UTC · original
Ran
61e5f79on the RTX 3070TI (driver 621.01, Windows 11) with theSDK 10.0.26100dxil.dllpresent, so the shader tests validate this time:cargo test & clippy passed clean on my side.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.