Allow round-to-zero mantissa truncation in check_rcas_views #125

Closed
github-bot wants to merge 1 commit from gh-pr/125/head into gh-pr/125/base
Owner

@⁠Holastor on GitHub · 2026-11-21 16:39 UTC · original
Holastor:fix/rcas-truncation-tolerance → main · +23 −8 · 1 files · 1 commits · closed without merging

Summary

Direct3D permits round-to-zero (truncation) when quantizing floating-point values into
DXGI_FORMAT_R9G9B9E5_SHAREDEXP textures. On AMD RDNA 2 hardware, native UAV stores to format 67 truncate
fractional mantissa steps on ties rather than rounding up and carrying into the next exponent field.

Specifically, at texel 1 (inputs[1]), AMD hardware stores 0x001ffe01 (mantissas 1, 511, 7 with exponent 0)
rather than carrying into exponent 1 (0x08120000).

This change introduces RoundMode::Truncate alongside RoundMode::NearestEven and RoundMode::NearestHalfUp in
tests/ffx_rcas_views.cpp, allowing hardware stores adhering to Direct3D truncation rules to pass verification.

Test Matrix

  • Hardware: AMD Radeon RX 6600M (Vendor 0x1002, Device 0x73ff, Driver 32.0.21045.11001)
  • Suite: CTest full suite (70 passed, 1 skipped: bvh_wave64_warp, 0 failed)
  • Direct verification: offscreen_check.exe hardware --ffx-provider-loop passes with native_trunc=317,
    mismatches=0, debug_errors=0.
**@⁠Holastor** on GitHub · 2026-11-21 16:39 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/125) `Holastor:fix/rcas-truncation-tolerance` → `main` · +23 −8 · 1 files · 1 commits · closed without merging ## Summary Direct3D permits round-to-zero (truncation) when quantizing floating-point values into `DXGI_FORMAT_R9G9B9E5_SHAREDEXP` textures. On AMD RDNA 2 hardware, native UAV stores to format 67 truncate fractional mantissa steps on ties rather than rounding up and carrying into the next exponent field. Specifically, at texel 1 (`inputs[1]`), AMD hardware stores `0x001ffe01` (mantissas 1, 511, 7 with exponent 0) rather than carrying into exponent 1 (`0x08120000`). This change introduces `RoundMode::Truncate` alongside `RoundMode::NearestEven` and `RoundMode::NearestHalfUp` in `tests/ffx_rcas_views.cpp`, allowing hardware stores adhering to Direct3D truncation rules to pass verification. ## Test Matrix - **Hardware**: AMD Radeon RX 6600M (Vendor `0x1002`, Device `0x73ff`, Driver `32.0.21045.11001`) - **Suite**: CTest full suite (70 passed, 1 skipped: `bvh_wave64_warp`, 0 failed) - **Direct verification**: `offscreen_check.exe hardware --ffx-provider-loop` passes with `native_trunc=317`, `mismatches=0`, `debug_errors=0`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:28:45 +00:00
github-bot closed this pull request 2026-11-26 21:28:45 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 17:16 UTC · original

Thanks for the RX 6600M measurements. #130 covers the same native RGB9E5 rounding path. Please compare the two references on your original input and report whether #130 reproduces the result before we consolidate them.

**@⁠R0Y00** on GitHub · 2026-11-21 17:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/125#issuecomment-7066349962) Thanks for the RX 6600M measurements. #130 covers the same native RGB9E5 rounding path. Please compare the two references on your original input and report whether #130 reproduces the result before we consolidate them.
Author
Owner

@⁠Holastor on GitHub · 2026-11-21 17:43 UTC · original

@⁠R0Y00 I verified the reference from #130 against the same inputs on the discrete AMD Radeon RX 6600M (vendor 1002,
device 73ff, driver 32.0.21045.11001).

The results are identical:

  • Exactly 317 of the 1,024 texels require round-toward-zero mantissa conversion (native_toward_zero=317,
    native_half_up=0, mismatches=0).
  • The mixed-mode check in #130 passes (native_half_up && native_toward_zero is not triggered).
  • 0 debug errors and 0 debug warnings.

Both reference formulas evaluate to std::floor(scaled) on the non-negative clamped inputs. The implementation
in #130 with the extra mixed-mode check and documentation in docs/experiments.md is clean and comprehensive.
Happy to consolidate in favor of #130!

**@⁠Holastor** on GitHub · 2026-11-21 17:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/125#issuecomment-7066692153) @⁠R0Y00 I verified the reference from #130 against the same inputs on the discrete AMD Radeon RX 6600M (vendor `1002`, device `73ff`, driver `32.0.21045.11001`). The results are identical: - Exactly **317 of the 1,024 texels** require round-toward-zero mantissa conversion (`native_toward_zero=317`, `native_half_up=0`, `mismatches=0`). - The mixed-mode check in #130 passes (`native_half_up && native_toward_zero` is not triggered). - 0 debug errors and 0 debug warnings. Both reference formulas evaluate to `std::floor(scaled)` on the non-negative clamped inputs. The implementation in #130 with the extra mixed-mode check and documentation in `docs/experiments.md` is clean and comprehensive. Happy to consolidate in favor of #130!
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 18:08 UTC · original

Closing as a duplicate of merged #130. Thank you for rerunning the original inputs on the RX 6600M. Your report confirms 317 of 1,024 texels used round-toward-zero, with zero mismatches and a clean debug layer.

**@⁠R0Y00** on GitHub · 2026-11-21 18:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/125#issuecomment-7067026617) Closing as a duplicate of merged #130. Thank you for rerunning the original inputs on the RX 6600M. Your report confirms 317 of 1,024 texels used round-toward-zero, with zero mismatches and a clean debug layer.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.