shader: lower v_cvt_f64_i32 and v_cvt_f64_u32 in direct compute path #3369

Manually merged
github merged 1 commit from github-bot/gh-3367 into gh-pr/3367/base 2026-11-28 19:22:23 +00:00 AGit
Owner

@⁠R0D4X on GitHub · 2026-11-28 14:34 UTC · original
R0D4X:feat/native-cvt-f64-int → main · +315 −1 · 5 files · 1 commits · merged 2026-11-28 19:19 UTC

Fixes #3365. Refs #2935.

Summary

  • Lower VOP1/VOP3A v_cvt_f64_i32 (0x04 / 0x184) and v_cvt_f64_u32 (0x16 / 0x196) in the native direct-DXIL compute path (src/gfx1013_direct_compute.inl):
    • Constructs the exact IEEE-754 binary64 word pair v[d:d+1] using pure 32-bit integer arithmetic and dx.op.unaryBits.i32(33) (FirstbitHi), requiring neither DoublePrecisionFloatShaderOps nor Int64ShaderOps.
    • Supports VOP1 and VOP3A encodings with VGPR, SGPR, inline-integer, and 32-bit literal sources (including overlapping D[0] == S0).
    • Refuses pixel_stage, graphics_input, abs, neg, clamp, omod, op_sel, subword, dpp, unused VOP3 src1/src2, dst == v255, and inline-float sources.
  • Register both instructions as 64-bit VGPR pair writes in clear_vector_spills (src/gfx1013_compute_native.cpp).
  • Add tests/native_cvt_f64_int_check.py (ir CPU evaluation + controls + hardware), tests/cmake/native_f64_int_cvt.cmake, and docs/experiments/native-cvt-f64-int.md.

Verification

  • Commit: 7096dc9d
  • Environment: Windows 11 x64 (10.0.26300.9974), MSVC 19.44.35230, Windows SDK / DXC 10.0.26100.0, NVIDIA GeForce RTX 5080 (10de:2c02, driver 32.0.16.2140), D3D12 debug layer off.
  • Commands & results:
    • cmake --build --preset dev --target native_compute_ir_dump compile_dxil native_store_replay & release: succeeded.
    • ctest --preset dev --no-tests=error -R '^native_cvt_f64_int_' -V: 3/3 passed (0 skipped); 32 CPU-evaluated IR words match struct.pack('<d'), 8 refusals verified, 2064 hardware readback words matched.
    • ctest --preset release --no-tests=error -R '^native_cvt_f64_int_' -V: 3/3 passed (0 skipped); all 2064 hardware words matched.
    • tests/docs_links_check.py, tests/bidi_controls_check.py, git diff --check: passed.
**@⁠R0D4X** on GitHub · 2026-11-28 14:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3367) `R0D4X:feat/native-cvt-f64-int` → `main` · +315 −1 · 5 files · 1 commits · merged 2026-11-28 19:19 UTC Fixes #3365. Refs #2935. ### Summary - Lower VOP1/VOP3A `v_cvt_f64_i32` (`0x04` / `0x184`) and `v_cvt_f64_u32` (`0x16` / `0x196`) in the native direct-DXIL compute path (`src/gfx1013_direct_compute.inl`): - Constructs the exact IEEE-754 binary64 word pair `v[d:d+1]` using pure 32-bit integer arithmetic and `dx.op.unaryBits.i32(33)` (`FirstbitHi`), requiring neither `DoublePrecisionFloatShaderOps` nor `Int64ShaderOps`. - Supports VOP1 and VOP3A encodings with VGPR, SGPR, inline-integer, and 32-bit literal sources (including overlapping `D[0] == S0`). - Refuses `pixel_stage`, `graphics_input`, `abs`, `neg`, `clamp`, `omod`, `op_sel`, `subword`, `dpp`, unused VOP3 `src1`/`src2`, `dst == v255`, and inline-float sources. - Register both instructions as 64-bit VGPR pair writes in `clear_vector_spills` (`src/gfx1013_compute_native.cpp`). - Add `tests/native_cvt_f64_int_check.py` (`ir` CPU evaluation + `controls` + `hardware`), `tests/cmake/native_f64_int_cvt.cmake`, and `docs/experiments/native-cvt-f64-int.md`. ### Verification - Commit: `7096dc9d` - Environment: Windows 11 x64 (`10.0.26300.9974`), MSVC `19.44.35230`, Windows SDK / DXC `10.0.26100.0`, NVIDIA GeForce RTX 5080 (`10de:2c02`, driver `32.0.16.2140`), D3D12 debug layer off. - Commands & results: - `cmake --build --preset dev --target native_compute_ir_dump compile_dxil native_store_replay` & `release`: succeeded. - `ctest --preset dev --no-tests=error -R '^native_cvt_f64_int_' -V`: 3/3 passed (0 skipped); 32 CPU-evaluated IR words match `struct.pack('<d')`, 8 refusals verified, 2064 hardware readback words matched. - `ctest --preset release --no-tests=error -R '^native_cvt_f64_int_' -V`: 3/3 passed (0 skipped); all 2064 hardware words matched. - `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `git diff --check`: passed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:43:42 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-28 19:11 UTC · original · approved these changes

GPU review of 7096dc9d.

  • Every i32/u32 is exact in binary64. The normalisation splits the 31 fraction bits into 20 in the high word and 11 in the low word; INT_MIN, UINT_MAX and 0 are right. A v255 destination pair, abs/neg/clamp/omod/op_sel and inline float sources are refused.
  • Run here in Windows Sandbox, network off, vGPU, Windows 11 build 26300 host, release build of main f2972840 with this PR and 17 other open PRs merged locally: native_cvt_f64_int_ir, _controls and _hardware pass. Changing the exponent bias 1023 to 1022 makes _ir and _hardware fail.

Approve.

**@⁠Leyukaka** on GitHub · 2026-11-28 19:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3367#pullrequestreview-6099696650) · **approved these changes** GPU review of `7096dc9d`. - Every i32/u32 is exact in binary64. The normalisation splits the 31 fraction bits into 20 in the high word and 11 in the low word; `INT_MIN`, `UINT_MAX` and 0 are right. A v255 destination pair, abs/neg/clamp/omod/op_sel and inline float sources are refused. - Run here in Windows Sandbox, network off, vGPU, Windows 11 build 26300 host, release build of `main` `f2972840` with this PR and 17 other open PRs merged locally: `native_cvt_f64_int_ir`, `_controls` and `_hardware` pass. Changing the exponent bias `1023` to `1022` makes `_ir` and `_hardware` fail. Approve.
github-bot changed target branch from main to gh-pr/3367/base 2026-11-28 19:22:22 +00:00
github manually merged commit 7096dc9de5 into gh-pr/3367/base 2026-11-28 19:22:23 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.