Shaders: v_cvt_f32_f64 in 32-bit integer arithmetic #163
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!163
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-163"
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?
@adonizm on GitHub · 2026-11-24 22:05 UTC · original
adonizm:shaders/v-cvt-f32-f64→main· +121 −0 · 2 files · 1 commits · openPrograms that convert a double to a float (
v_cvt_f32_f64) did not translate ("v_cvt_f32_f64 is not supported"), so their draws and dispatches were dropped. The emitter has no 64-bit float type, so the conversion is done on the double's two dwords with 32-bit integer operations:src64reads those as 32-bit integers.The change is one new case in
valu_op(crates/victory-shader/src/emit/lower.rs) and one test.Tested on an RTX 5070 Ti (driver 621.24), Ryzen 7 7800X3D, Windows 11, Series X profile
cvt_f32_f64_rounds_to_nearest_even: 16 doubles (exact ties both ways, overflow to infinity, f32::MAX plus half an ulp, NaN, -0, the flush) compared bit for bit with Rust's ownf64 as f32, on the hardware adapter and WARP. Passes on both.2119b0e):cargo test --workspace: 497 passed, 0 failed, 7 ignored.cargo clippy --workspace --all-targets: clean.victory translateover the retail shader pack with this change: 0 programs fail on this instruction (an earlier sweep with upstream VIctoryffe310elisted 5).4e17478plus this change,VICTORY_RELAY=2): the prologue ran with no device loss and no crash, nov_cvt_f32_f64warnings (an earlier run on90228a7logged 2 such shaders in the same stretch), 2.5 fps average / 5 fps peak in the world, the same as before.Not tested
AI use: written with Claude Code (Claude Opus 5.5): the lowering, the test and this description. DeepSeek (deepseek-flash) was used only to summarize the existing test file's helpers; its notes were checked against the code. Tested on my machine with the commands above.
@Parakeet-Wheat on GitHub · 2026-11-24 23:36 UTC · original
Ran the whole pack on this PR alone, to see where the 5
v_cvt_f32_f64programs end up.610.88), Ryzen 5 5600X, Rust 1.98.1 (x86_64-pc-windows-msvc),dxil.dll1.8.2502, title 1.0.2.1; PR head80cabd3(on2119b0e).victory translate <exe> shaders.rpf --list --validate, program by program against2119b0e: 0 gained, 0 lost (25,382 validated on both). The 5 compute programs refused with "v_cvt_f32_f64" on2119b0enow get past it, and all 5 stop at "a whole-wave section step the simulation does not follow". So on its own this PR makes none of them translate. They also need thev_add_f64whole-wave sum that #9 models.cargo test -p victory-shader --locked: 211 passed, 0 failed, 2 ignored (210 on2119b0e; the newcvt_f32_f64_rounds_to_nearest_evenpasses).Offline translation and validation only; no shader contents or extracted data included. AI-assisted (Claude Code); run on my machine.
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.