shader: lower v_cvt_i32_f64 and v_cvt_u32_f64 in direct compute path #3373

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

@⁠R0D4X on GitHub · 2026-11-28 14:53 UTC · original
R0D4X:feat/native-cvt-int-f64 → main · +327 −0 · 4 files · 1 commits · merged 2026-11-28 19:27 UTC

Fixes #3372. Refs #2935.

Summary

  • Lower VOP1/VOP3A v_cvt_i32_f64 (0x03 / 0x183) and v_cvt_u32_f64 (0x15 / 0x195) in the native direct-DXIL compute path (src/gfx1013_direct_compute.inl):
    • Converts a 64-bit binary64 source pair (v[a:a+1] or even s[a:a+1]) to a saturated 32-bit signed or unsigned integer (truncation toward zero, NaN -> 0, signed saturation to [INT32_MIN, INT32_MAX], unsigned saturation to [0, UINT32_MAX]) using pure 32-bit integer arithmetic, requiring neither DoublePrecisionFloatShaderOps nor Int64ShaderOps.
    • Supports VOP1 and VOP3A encodings with VOP3A abs/neg on the binary64 source sign; refuses pixel_stage, graphics_input, clamp, omod, op_sel, subword, dpp, unused VOP3 sources/modifiers, and non-pair S0.
  • Add tests/native_cvt_int_f64_check.py (ir CPU evaluation + controls + hardware), tests/cmake/native_int_f64_cvt.cmake, and docs/experiments/native-cvt-int-f64.md.

Verification

  • Commit: 7d8ada1e
  • 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_int_f64_' -V: 3/3 passed (0 skipped); 32 CPU-evaluated IR words + 8 refusals + 2064 hardware readback words matched.
    • ctest --preset release --no-tests=error -R '^native_cvt_int_f64_' -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:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3371) `R0D4X:feat/native-cvt-int-f64` → `main` · +327 −0 · 4 files · 1 commits · merged 2026-11-28 19:27 UTC Fixes #3372. Refs #2935. ### Summary - Lower VOP1/VOP3A `v_cvt_i32_f64` (`0x03` / `0x183`) and `v_cvt_u32_f64` (`0x15` / `0x195`) in the native direct-DXIL compute path (`src/gfx1013_direct_compute.inl`): - Converts a 64-bit binary64 source pair (`v[a:a+1]` or even `s[a:a+1]`) to a saturated 32-bit signed or unsigned integer (truncation toward zero, `NaN -> 0`, signed saturation to `[INT32_MIN, INT32_MAX]`, unsigned saturation to `[0, UINT32_MAX]`) using pure 32-bit integer arithmetic, requiring neither `DoublePrecisionFloatShaderOps` nor `Int64ShaderOps`. - Supports VOP1 and VOP3A encodings with VOP3A `abs`/`neg` on the binary64 source sign; refuses `pixel_stage`, `graphics_input`, `clamp`, `omod`, `op_sel`, `subword`, `dpp`, unused VOP3 sources/modifiers, and non-pair `S0`. - Add `tests/native_cvt_int_f64_check.py` (`ir` CPU evaluation + `controls` + `hardware`), `tests/cmake/native_int_f64_cvt.cmake`, and `docs/experiments/native-cvt-int-f64.md`. ### Verification - Commit: `7d8ada1e` - 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_int_f64_' -V`: 3/3 passed (0 skipped); 32 CPU-evaluated IR words + 8 refusals + 2064 hardware readback words matched. - `ctest --preset release --no-tests=error -R '^native_cvt_int_f64_' -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:56:34 +00:00
github-bot changed target branch from main to gh-pr/3371/base 2026-11-28 19:28:27 +00:00
github manually merged commit 7d8ada1e41 into gh-pr/3371/base 2026-11-28 19:28:37 +00:00
Author
Owner

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

GPU review of 7d8ada1e.

  • Truncation toward zero, NaN → 0, saturation and the 1054 / 1055 exponent bounds are correct. The _ir test runs the emitted code on the CPU, so it checks values.
  • 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_int_f64_ir, _controls and _hardware pass. Changing the signed bound 1054 to 1055 makes _ir and _hardware fail.

Not covered: no ±Inf case and no input ≥ 2^32, so removing the u32 saturation would pass; the lo != 0 NaN term (lo = 1, hi = 0x7FF00000) is also untested.

Approve.

**@⁠Leyukaka** on GitHub · 2026-11-28 19:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3371#pullrequestreview-6099751789) · **approved these changes** GPU review of `7d8ada1e`. - Truncation toward zero, NaN → 0, saturation and the 1054 / 1055 exponent bounds are correct. The `_ir` test runs the emitted code on the CPU, so it checks values. - 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_int_f64_ir`, `_controls` and `_hardware` pass. Changing the signed bound `1054` to `1055` makes `_ir` and `_hardware` fail. Not covered: no ±Inf case and no input ≥ 2^32, so removing the u32 saturation would pass; the `lo != 0` NaN term (`lo = 1`, `hi = 0x7FF00000`) is also untested. Approve.
This discussion has been locked. Commenting is limited to contributors.
No description provided.