Shaders: lower f64 operations, conversions, and wave sums #54
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/54"
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?
Imported from Zettrox/ztrx. Originally posted by IAmTheSween on 2026-11-25T06:27:04Z.
Adds native
f64(IEEE-754 binary64) bitcode encoding, VALU instruction lowering, and 64-bit wave-sum reduction tracking.What is in it
crates/victory-shader/src/emit/bitcode.rs: addsTypeDef::Double,Const::Double(u64),Cast::{FpTrunc, FpExt}, andModule::{double, f64}(no change to bitcode emitted for shaders that do not usedouble).crates/victory-shader/src/emit/shader.rs: adds shader flagsflags::DOUBLE(1 << 2,SFI00x1/D3D_SHADER_REQUIRES_DOUBLES) andflags::DOUBLE_EXT(1 << 6,SFI00x20/D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS, set on int <-> f64 conversions). Verified againstdxc.exe -dumpbin(10.0.26100.0).crates/victory-shader/src/emit/lower.rs: addsinline_f64(128..=208integers and240..=248IEEE-754 doubles), high-dword placement for 32-bitOperand::Literal,make_double(dx.op.makeDouble.f64),split_double(dx.op.splitDouble.f64),f64_src(abs/neg),write_f64(omod/clamp),wide_sum(dx.op.waveActiveOp.f64+ cross-half exchange), and lowerings forv_add_f64,v_mul_f64,v_cvt_f32_f64,v_cvt_f64_f32,v_cvt_i32_f64,v_cvt_u32_f64,v_cvt_f64_i32,v_cvt_f64_u32.crates/victory-shader/src/emit/wave.rs: addsSym::Wide,Shape::WideAdd,combine_wide,v_add_f64pair simulation, and scalars_mov_b32/s_mov_b64unipropagation so whole-wavev_add_f64+ cross-lane reductions fold intoWideAdd.crates/victory-shader/src/emit/valu_tests.rs: adds GPU execution +dxil.dllvalidator testsf64_arith_and_conversions_validate_and_match_ieeeandf64_wave_reduction_executes_on_gpu.Why / Relation to #38 and #52
Compute shaders in the
water_shading:CS_TransmissionVolumetrics*family cited in #38 (5dc3b25986622949,6f225b641c5b0708,926c46bab3b86bd6) accumulatef64values across the wave withv_add_f64and cross-lane moves before converting down withv_cvt_f32_f64. While #52 coversv_cvt_f32_f64on its own, fullf64ops pluswave::Shape::WideAddrecognition are required for those compute shaders to get past theemitstage.Checked against the five
water_shadingcompute shaders (VICTORY_HOST_WAVE=32):5dc3b25986622949,6f225b641c5b0708,a10179ab7eda0dc3) now translate to DXIL and passdxil.dllvalidation (10.0.26100.0). On RTX 5070 hardware, their pipeline creation still hits the pre-existingWaveSize(64)fallback on LDS-flag regions addressed separately in #36.6871d6e4b3ac9a10,926c46bab3b86bd6) get past allf64instructions and stop later at an unrelated wave-64 lane-mask error (a lane mask holding lanes elsewhere read as data).Tested
dxil.dll10.0.26100.0(WARP and GPU both exercised).cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings).cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings).cargo test -p victory-shader --locked: 212 passed, 0 failed, 2 ignored (includes both newf64GPU tests).cargo test --workspace --locked -- --test-threads=1: all workspace test suites passed with 0 failures (victory1,victory_core11,victory_formats24 / 4 ignored,victory_game2,victory_gpu110 / 1 ignored,victory_hle95 +no_dll_planting1,victory_loader24 +load_probe2 +title_dlls1,victory_pe7,victory_pipeline4,victory_shader212 / 2 ignored,xtask4 (repository_passes_policy)). Single-threaded execution was used for the full workspace run due to pre-existing WARP device contention whenvictory_gpuGPU tests run concurrently (valu_tests.rs:198).AI use
Written with Antigravity.
Imported from Zettrox/ztrx. Originally posted by futurepro62 on 2026-11-25T15:15:01Z.
Full-suite run on Windows, since this PR has no test report yet. Tested exact head
0bd72da(on its base90b529f).Tested
rust-toolchain.toml), DXC + dxil.dll 1.9.2602.17, debug.cargo test --workspace --locked: 498 passed, 0 failed, 7 ignored (main90b529fon this machine: 492 passed, 0 failed, 7 ignored).cargo clippy --workspace --all-targets --locked -- -D warnings(the CI lint step): passed.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings(the CI lint step): passed.f64_arith_and_conversions_validate_and_match_ieee,f64_wave_reduction_executes_on_gpu.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.