shader: lower v_cvt_f32_f64 by 64-bit integer emulation #597

Open
github-bot wants to merge 1 commit from github-bot/gh-593 into main AGit
Owner

@⁠AnastasisKon on GitHub · 2026-11-28 10:53 UTC · original
AnastasisKon:vibe/cvt-f32-f64-1705ac → main · +260 −0 · 3 files · 1 commits · open

What this changes

Implements v_cvt_f32_f64 in the translator (one of the refused shaders of #535). The IR and Metal have no f64, so the conversion is emulated in 64-bit integer ops over the source register pair (IEEE-754 double bits in, f32 bits out, round-to-nearest-even). Refs #535

How it was tested

  • cargo test -p victory-shader (host): 422 passed — new cvt_f64_tests::cvt_f32_f64_reference_matches_f64_as_f32 (2M random + every-exponent and boundary sweeps vs f64 as f32) and gfx_refusal_tests::cvt_f32_f64_lowers_in_pixel_shader (both wave modes)
  • cargo test -p victory-hle -p victory -p victory-gpu -p xtask — all ok
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — clean (RC=0); also compile-checks the new Windows-only GPU execution test valu_tests::cvt_f32_f64_converts_doubles_on_the_gpu (10 cases incl. inf/overflow/subnormal, runs on hardware + WARP in Windows CI)
  • cargo xtask policy — 404 files ok
  • Game run: not yet (game download still in progress)

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — NaN payload marked unspecified; round mode pinned to nearest-even (MODE default) in a comment
  • New diagnostics are behind a VICTORY_* variable and documented — n/a, no new diagnostics
**@⁠AnastasisKon** on GitHub · 2026-11-28 10:53 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/593) `AnastasisKon:vibe/cvt-f32-f64-1705ac` → `main` · +260 −0 · 3 files · 1 commits · open ## What this changes Implements `v_cvt_f32_f64` in the translator (one of the refused shaders of #535). The IR and Metal have no f64, so the conversion is emulated in 64-bit integer ops over the source register pair (IEEE-754 double bits in, f32 bits out, round-to-nearest-even). Refs #535 ## How it was tested - [x] `cargo test -p victory-shader` (host): 422 passed — new `cvt_f64_tests::cvt_f32_f64_reference_matches_f64_as_f32` (2M random + every-exponent and boundary sweeps vs `f64 as f32`) and `gfx_refusal_tests::cvt_f32_f64_lowers_in_pixel_shader` (both wave modes) - [x] `cargo test -p victory-hle -p victory -p victory-gpu -p xtask` — all ok - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — clean (RC=0); also compile-checks the new Windows-only GPU execution test `valu_tests::cvt_f32_f64_converts_doubles_on_the_gpu` (10 cases incl. inf/overflow/subnormal, runs on hardware + WARP in Windows CI) - [x] `cargo xtask policy` — 404 files ok - [ ] Game run: not yet (game download still in progress) ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md — NaN payload marked unspecified; round mode pinned to nearest-even (MODE default) in a comment - [x] New diagnostics are behind a `VICTORY_*` variable and documented — n/a, no new diagnostics
The IR and Metal have no f64, so the conversion is emulated in i64 ops:
the source register pair holds the IEEE-754 double bits, the result is
the f32 bits with round-to-nearest-even. The emitted sequence mirrors
cvt_f32_f64_reference, pinned against f64 as f32 over millions of
patterns, plus a lowering test (host) and a GPU execution test
(Windows CI). One of the refused shaders of #531.

Refs #531
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 11:00:45 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/597/head:github-bot/gh-593'
git switch 'github-bot/gh-593'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-593'
git switch 'github-bot/gh-593'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-593'
git switch 'github-bot/gh-593'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-593'
git switch 'main'
git merge --squash 'github-bot/gh-593'
git switch 'main'
git merge --ff-only 'github-bot/gh-593'
git switch 'main'
git merge 'github-bot/gh-593'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.