fix(shader): round v_fract_f32, v_fract_f16 and v_fract_f64 in directed FLOAT_MODE rounding modes #26047

Open
DannyOppenheimer wants to merge 5 commits from upstream-pr/26047 into main
DannyOppenheimer commented 2026-11-23 05:33:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DannyOppenheimer on 2026-11-23T05:33:22Z.


What

v_fract_f32, v_fract_f16 and v_fract_f64 compute x - floor(x), which is inexact for a negative input whose fractional part is below 0.5 (the result lies in (0.5, 1)). The hardware rounds that result once in the FLOAT_MODE round field of the instruction's precision (f32 for v_fract_f32, f16/f64 for the others) and then clamps it below 1. The recompiler always rounded to nearest even, so with round toward +infinity, -infinity or zero it was one unit off on those inputs, and it threw "does not model directed rounding" when s_round_mode selected a directed mode at run time.

  • f32 and f64: when the round field is directed, the round-to-nearest result is stepped by one unit in the selected direction when it lies on the wrong side of the exact value. The side is decided by comparing fract(|x|) with 1 - result; both are exact, and as non-negative floats they compare as unsigned integers, so f64 needs no f64 compare. The result is positive, so toward zero is toward -infinity. For f64 the step applies only to finite operands, so ±Inf keeps the default NaN 0xfff8000000000000 in every mode; the f32 and f16 paths already select their invalid result after the step.
  • f16: the f32 intermediate is already exact for f16 inputs, so only the final conversion changes, to the existing directed convertF32ToF16Bits.
  • RoundingMode.cpp classifies VFractF32 as Directed32 and VFractF16/VFractF64 as Directed16, so a mode set by s_round_mode is modelled instead of rejected.
  • The debt fragment records the measured behaviour; the PS5's gfx1013 is not measured.

Found by a differential sweep of 332 VOP1/VOP2/VOP3/VOPC/VOP3P opcodes through tools/hw-oracle on an RX 5700 XT (gfx1010, RDNA1, the PS5's gfx10.1 generation) against the same bodies through agc_oracle_runner; at default float modes everything else that differed is already covered by open PRs or deferred debt entries. #19710 leaves v_fract_f32 unmodelled, and no open PR changes fract rounding.

Tested

Windows 11, Radeon RX 5700 XT (gfx1010), AMD driver 32.0.21045.5002.

  • Hardware model: over 4824 f32, 3222 f16 and 15924 f64 inputs (random values plus every exponent with edge mantissas, both signs), in all four round modes, with denormals kept and flushed, at IEEE 0 and 1, the hardware matches "round x - floor(x) once in the mode, clamp below 1" exactly (0 mismatches over about 384,000 results).
  • The recompiler through agc_oracle_runner with this change matches that model with 0 mismatches in all 48 configurations, and matches the hardware on 3000 rows with the mode set by s_round_mode (f32, f16 and f64 in one body). main differs from the hardware on 4 to 41 of 2628 rows per instruction and mode.
  • New agc_driver_fract_directed_rounding: 36 inputs per precision (including -Inf, +Inf and two quiet NaNs) with the hardware's results for round modes 1 to 3, run with FLOAT_MODE 0xc0 and 0xf0 at IEEE 0 and 1, once declared in FLOAT_MODE and once set by s_round_mode (24 of 24 runs pass). On main it fails: v_fract_f32 FLOAT_MODE 0xc5, IEEE=0 of 0xb5de8693 is 0x3f7fffe4, expected 0x3f7fffe5. Without the finite guard (first commit, 39d4a28c17) it fails: v_fract_f64 FLOAT_MODE 0xca, IEEE=0 of 0xfff0000000000000 is 0xfff7ffffffffffff, expected 0xfff8000000000000.
  • ctest --test-dir build -R "agc_driver_.*(directed_rounding|legacy|div_fmas|division|f64_fma|f64_ldexp|ldexp_f32|vop3_cube|nan_quieting|f64_arithmetic|f32_output_modifier|cubema|f32_denormal_flush|fract|f16_denormal_flush|f64_rounding|dx10_clamp|f32_result_clamp|unused_nan|dpp_no_form|vcvt_pk_u8)|vector_constant_factor_tininess|agc_shader_mode_register" -V with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, Khronos validation layer 1.4.369, main at a2d8d409db and this branch at ab2742cac5 (main a2d8d409db merged; the same change as 5584985d4d below), each from its own build directory with all execution tests enabled and its test targets relinked from that commit: main 39 of 39 passed, this branch 40 of 40 passed (the new agc_driver_fract_directed_rounding added). On both, agc_driver_float16_unused_nan_payloads reports itself skipped (the RX 5700 XT has no native f16 conversions with RTE rounding and kept f16 denormals). Insert instance layer "VK_LAYER_KHRONOS_validation" appears 37 and 38 times, once per GPU test (agc_shader_mode_register and vector_constant_factor_tininess create no Vulkan instance); was not found but was requested appears 0 and 0 times, and VUID- 0 and 0 times.
  • tools/check_conventions.py --base origin/main and tools/debt_fold.py --check pass.
  • Merging main a2d8d409db (b4ea14a5cc): #26096 had moved VLdexpF64 out of the same Unmodelled list, so the conflict resolves to neither line. main's 766c72537c removed applyF16ResultModifiers and now applies the f16 output modifier and clamp to the final bits, so ab2742cac5 converts the directed v_fract_f16 result with convertF32ToF16Bits alone; the modifier and clamp are then applied once, after rounding, as on the round-to-nearest path. tools/check_conventions.py passes on ab2742cac5.
  • The branch was then rebased onto main 9900bfa949 as 39d4a28c17, cf6cadcf41 and 5584985d4d, with the same diff in all six changed files as ab2742cac5 against a2d8d409db, and main 5ab4337794 was merged in 81e03e9d38 with no conflicts. tools/check_conventions.py passes on 81e03e9d38; the GPU tests above were not rerun after the rebase.

tools/pr_overlap.py --branch reports one-line conflicts in the RoundingUseOf opcode lists of RoundingMode.cpp with #19505, #19710 and #22446, which move other opcodes out of the same Unmodelled lists; none of them changes fract. #20187 could not be compared automatically; its hunks are in floatBinary and two header members, away from this change.

Hardware model check (tools/hw-oracle)
def fract_model(bits, fmt, mode, flush_in):
    x = decode(bits, fmt)                      # exact rational, None for NaN/inf
    if flush_in and is_denormal(bits, fmt): x = 0
    return min(round_positive(x - floor(x), fmt, mode), largest_below_one(fmt))
f32 mode 1 den 3 ieee 1 rows 4824 model mismatches 0
f16 mode 2 den 0 ieee 0 rows 3222 model mismatches 0
f64 mode 3 den 3 ieee 1 rows 15924 model mismatches 0
... (48 of 48 configurations, hardware and recompiler)

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 5700 XT (gfx1010), AMD Windows driver 32.0.21045.5002, Windows 11 Home 10.0.26200
  • AI-assisted: yes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fractional shader operations now respect supported rounding modes across 16-, 32-, and 64-bit precision. Negative and inexact values are rounded appropriately, and results near 1 remain within the valid fractional range. This improves consistency for shaders that use directed rounding and helps prevent fractional results from exceeding their expected range.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5447697433 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26047). Originally posted by [DannyOppenheimer](https://github.com/DannyOppenheimer) on 2026-11-23T05:33:22Z. --- ### What `v_fract_f32`, `v_fract_f16` and `v_fract_f64` compute `x - floor(x)`, which is inexact for a negative input whose fractional part is below 0.5 (the result lies in (0.5, 1)). The hardware rounds that result once in the `FLOAT_MODE` round field of the instruction's precision (f32 for `v_fract_f32`, f16/f64 for the others) and then clamps it below 1. The recompiler always rounded to nearest even, so with round toward +infinity, -infinity or zero it was one unit off on those inputs, and it threw "does not model directed rounding" when `s_round_mode` selected a directed mode at run time. - f32 and f64: when the round field is directed, the round-to-nearest result is stepped by one unit in the selected direction when it lies on the wrong side of the exact value. The side is decided by comparing `fract(|x|)` with `1 - result`; both are exact, and as non-negative floats they compare as unsigned integers, so f64 needs no f64 compare. The result is positive, so toward zero is toward -infinity. For f64 the step applies only to finite operands, so ±Inf keeps the default NaN `0xfff8000000000000` in every mode; the f32 and f16 paths already select their invalid result after the step. - f16: the f32 intermediate is already exact for f16 inputs, so only the final conversion changes, to the existing directed `convertF32ToF16Bits`. - `RoundingMode.cpp` classifies `VFractF32` as `Directed32` and `VFractF16`/`VFractF64` as `Directed16`, so a mode set by `s_round_mode` is modelled instead of rejected. - The debt fragment records the measured behaviour; the PS5's gfx1013 is not measured. Found by a differential sweep of 332 VOP1/VOP2/VOP3/VOPC/VOP3P opcodes through `tools/hw-oracle` on an RX 5700 XT (gfx1010, RDNA1, the PS5's gfx10.1 generation) against the same bodies through `agc_oracle_runner`; at default float modes everything else that differed is already covered by open PRs or deferred debt entries. #19710 leaves `v_fract_f32` unmodelled, and no open PR changes fract rounding. ### Tested Windows 11, Radeon RX 5700 XT (gfx1010), AMD driver 32.0.21045.5002. - Hardware model: over 4824 f32, 3222 f16 and 15924 f64 inputs (random values plus every exponent with edge mantissas, both signs), in all four round modes, with denormals kept and flushed, at IEEE 0 and 1, the hardware matches "round `x - floor(x)` once in the mode, clamp below 1" exactly (0 mismatches over about 384,000 results). - The recompiler through `agc_oracle_runner` with this change matches that model with 0 mismatches in all 48 configurations, and matches the hardware on 3000 rows with the mode set by `s_round_mode` (f32, f16 and f64 in one body). `main` differs from the hardware on 4 to 41 of 2628 rows per instruction and mode. - New `agc_driver_fract_directed_rounding`: 36 inputs per precision (including -Inf, +Inf and two quiet NaNs) with the hardware's results for round modes 1 to 3, run with FLOAT_MODE 0xc0 and 0xf0 at IEEE 0 and 1, once declared in `FLOAT_MODE` and once set by `s_round_mode` (24 of 24 runs pass). On `main` it fails: `v_fract_f32 FLOAT_MODE 0xc5, IEEE=0 of 0xb5de8693 is 0x3f7fffe4, expected 0x3f7fffe5`. Without the finite guard (first commit, `39d4a28c17`) it fails: `v_fract_f64 FLOAT_MODE 0xca, IEEE=0 of 0xfff0000000000000 is 0xfff7ffffffffffff, expected 0xfff8000000000000`. - `ctest --test-dir build -R "agc_driver_.*(directed_rounding|legacy|div_fmas|division|f64_fma|f64_ldexp|ldexp_f32|vop3_cube|nan_quieting|f64_arithmetic|f32_output_modifier|cubema|f32_denormal_flush|fract|f16_denormal_flush|f64_rounding|dx10_clamp|f32_result_clamp|unused_nan|dpp_no_form|vcvt_pk_u8)|vector_constant_factor_tininess|agc_shader_mode_register" -V` with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer`, Khronos validation layer 1.4.369, `main` at `a2d8d409db` and this branch at `ab2742cac5` (`main` `a2d8d409db` merged; the same change as `5584985d4d` below), each from its own build directory with all execution tests enabled and its test targets relinked from that commit: `main` 39 of 39 passed, this branch 40 of 40 passed (the new `agc_driver_fract_directed_rounding` added). On both, `agc_driver_float16_unused_nan_payloads` reports itself skipped (the RX 5700 XT has no native f16 conversions with RTE rounding and kept f16 denormals). `Insert instance layer "VK_LAYER_KHRONOS_validation"` appears 37 and 38 times, once per GPU test (`agc_shader_mode_register` and `vector_constant_factor_tininess` create no Vulkan instance); `was not found but was requested` appears 0 and 0 times, and `VUID-` 0 and 0 times. - `tools/check_conventions.py --base origin/main` and `tools/debt_fold.py --check` pass. - Merging `main` `a2d8d409db` (`b4ea14a5cc`): #26096 had moved `VLdexpF64` out of the same `Unmodelled` list, so the conflict resolves to neither line. `main`'s `766c72537c` removed `applyF16ResultModifiers` and now applies the f16 output modifier and clamp to the final bits, so `ab2742cac5` converts the directed `v_fract_f16` result with `convertF32ToF16Bits` alone; the modifier and clamp are then applied once, after rounding, as on the round-to-nearest path. `tools/check_conventions.py` passes on `ab2742cac5`. - The branch was then rebased onto `main` `9900bfa949` as `39d4a28c17`, `cf6cadcf41` and `5584985d4d`, with the same diff in all six changed files as `ab2742cac5` against `a2d8d409db`, and `main` `5ab4337794` was merged in `81e03e9d38` with no conflicts. `tools/check_conventions.py` passes on `81e03e9d38`; the GPU tests above were not rerun after the rebase. `tools/pr_overlap.py --branch` reports one-line conflicts in the `RoundingUseOf` opcode lists of `RoundingMode.cpp` with #19505, #19710 and #22446, which move other opcodes out of the same `Unmodelled` lists; none of them changes fract. #20187 could not be compared automatically; its hunks are in `floatBinary` and two header members, away from this change. <details><summary>Hardware model check (tools/hw-oracle)</summary> ```python def fract_model(bits, fmt, mode, flush_in): x = decode(bits, fmt) # exact rational, None for NaN/inf if flush_in and is_denormal(bits, fmt): x = 0 return min(round_positive(x - floor(x), fmt, mode), largest_below_one(fmt)) ``` ``` f32 mode 1 den 3 ieee 1 rows 4824 model mismatches 0 f16 mode 2 den 0 ieee 0 rows 3222 model mismatches 0 f64 mode 3 den 3 ieee 1 rows 15924 model mismatches 0 ... (48 of 48 configurations, hardware and recompiler) ``` </details> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 5700 XT (gfx1010), AMD Windows driver 32.0.21045.5002, Windows 11 Home 10.0.26200 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Fractional shader operations now respect supported rounding modes across 16-, 32-, and 64-bit precision. Negative and inexact values are rounded appropriately, and results near 1 remain within the valid fractional range. This improves consistency for shaders that use directed rounding and helps prevent fractional results from exceeding their expected range. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-11-23 05:55:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T05:55:21Z.

Review: COMMENTED


Reviewed — comments

The directed rounding implementation is present, but the new execution test has no registered CTest entry, so the reported test coverage is not reproducible through the repository’s test registration.

What I ran

Reviewed head 09832d98abb1b2ede57425c21f1345a7712a4a61 using the prepared diff and repo_read.py reader. No build or tests were run.

Results

Check Result Note
Changed code review passed All five changed files read
Test registration failed No matching CTest registration found
Build and runtime tests not run No execution environment available

Findings

Blocking

None.

Non-blocking

  • FractDirectedRounding.cpp is picked up as an execution-test source, but the repository’s CTest registrations are defined in tests/cmake fragments. No agc_driver_fract_directed_rounding_tests.cmake fragment or matching registration exists, so ordinary CTest runs will not invoke this test. Add the matching registration fragment. Changed line: core/libs/prx/libSceAgcDriver/tests/execution/FractDirectedRounding.cpp:233.

Not verified

  • Build and runtime behavior were not run in this review.
  • The author-reported hardware and GPU test results were not independently verified.
  • No files were excluded from files.json; the five changed files listed there were read.

To get this to a good state

Nothing is required. Optional: register the new execution test with CTest so it runs in the project’s test workflow.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017128682 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26047#pullrequestreview-6017128682). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T05:55:21Z. **Review:** COMMENTED --- # Reviewed — comments The directed rounding implementation is present, but the new execution test has no registered CTest entry, so the reported test coverage is not reproducible through the repository’s test registration. ## What I ran Reviewed head `09832d98abb1b2ede57425c21f1345a7712a4a61` using the prepared diff and `repo_read.py` reader. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | All five changed files read | | Test registration | failed | No matching CTest registration found | | Build and runtime tests | not run | No execution environment available | ## Findings ### Blocking None. ### Non-blocking - `FractDirectedRounding.cpp` is picked up as an execution-test source, but the repository’s CTest registrations are defined in `tests/cmake` fragments. No `agc_driver_fract_directed_rounding_tests.cmake` fragment or matching registration exists, so ordinary CTest runs will not invoke this test. Add the matching registration fragment. Changed line: `core/libs/prx/libSceAgcDriver/tests/execution/FractDirectedRounding.cpp:233`. ## Not verified - Build and runtime behavior were not run in this review. - The author-reported hardware and GPU test results were not independently verified. - No files were excluded from `files.json`; the five changed files listed there were read. ## To get this to a good state Nothing is required. Optional: register the new execution test with CTest so it runs in the project’s test workflow.
mihiii1337 commented 2026-11-23 06:35:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T06:35:24Z.

Review: CHANGES_REQUESTED


The f64 directed-rounding correction also runs on infinity and can turn the quiet invalid-operation result into a signaling NaN.

For V_FRACT_F64(-Inf) (0xfff0000000000000), the existing EmitFPFract64 result is canonical quiet NaN 0xfff8000000000000. In roundFractF64, FPFract64(abs(-Inf)) produces the same negative canonical qNaN, while 1 + -result propagates positive qNaN 0x7ff8000000000000. For RTN/RTZ, the unsigned less(rest, part) comparison is therefore true; the input is negative and part is nonzero, so the correction decrements the qNaN to 0xfff7ffffffffffff, which is signaling. The outer nan selection only recognizes an originally NaN operand, not infinity, so it does not restore the quiet result.

Please restrict the correction to its finite domain (or otherwise preserve the existing special result) and add -Inf to the f64 declared/runtime rounding fixture. +Inf and NaN payloads are also useful special controls. The f32/f16 paths already select their invalid-infinity result after their correction, so this blocker is specific to the f64 ordering.

The current fixture's 32 rows contain no infinities or NaNs. This is a static review of exact head 09832d98abb1b2ede57425c21f1345a7712a4a61; I did not run a GPU binary.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017432623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26047#pullrequestreview-6017432623). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T06:35:24Z. **Review:** CHANGES_REQUESTED --- The f64 directed-rounding correction also runs on infinity and can turn the quiet invalid-operation result into a signaling NaN. For `V_FRACT_F64(-Inf)` (`0xfff0000000000000`), the existing `EmitFPFract64` result is canonical quiet NaN `0xfff8000000000000`. In `roundFractF64`, `FPFract64(abs(-Inf))` produces the same negative canonical qNaN, while `1 + -result` propagates positive qNaN `0x7ff8000000000000`. For RTN/RTZ, the unsigned `less(rest, part)` comparison is therefore true; the input is negative and `part` is nonzero, so the correction decrements the qNaN to `0xfff7ffffffffffff`, which is signaling. The outer `nan` selection only recognizes an originally NaN operand, not infinity, so it does not restore the quiet result. Please restrict the correction to its finite domain (or otherwise preserve the existing special result) and add `-Inf` to the f64 declared/runtime rounding fixture. `+Inf` and NaN payloads are also useful special controls. The f32/f16 paths already select their invalid-infinity result after their correction, so this blocker is specific to the f64 ordering. The current fixture's 32 rows contain no infinities or NaNs. This is a static review of exact head `09832d98abb1b2ede57425c21f1345a7712a4a61`; I did not run a GPU binary. AI-assisted: yes.
mihiii1337 commented 2026-11-23 07:41:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-23T07:41:53Z.

Review: APPROVED


Re-reviewed the requested head 7f67fa3692c0da2de411db4b928d290d5952fdb3. The finite guard fully resolves my previous -Inf blocker: Inf/NaN values can no longer enter the directed-rounding bit step, while finite values keep the existing selection.

Independent CPU A/B used the exact parent/head float64Unary, roundFractF64, quietNan64, flushF64Bits and float-mode logic with the head's 36-lane fixture:

  • parent: 8/432 mismatches, all the previously reported -Inf RTN/RTZ result 0xfff7ffffffffffff;
  • head: 0/432, including all 48 new special-value cells.

An additional 256-case matrix across all four round/denorm fields and both IEEE modes used signed Inf, qNaN and sNaN payloads. Parent had 16 mismatches on the same -Inf path; head had 0. IEEE-off kept the established sNaN input bits, while IEEE-on quieted them with sign/payload preserved. The new runtime and declared-code fixture variants both pin the special rows to exact words.

The author also reports native RX 5700 XT/gfx1010 measurements for the four modes and a concrete old-head negative control; I did not run a local SPIR-V or GPU dispatch. Diff/convention/CI status was checked separately by the existing reviews.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6017987749 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26047#pullrequestreview-6017987749). Originally posted by [mihiii1337](https://github.com/mihiii1337) on 2026-11-23T07:41:53Z. **Review:** APPROVED --- Re-reviewed the requested head `7f67fa3692c0da2de411db4b928d290d5952fdb3`. The finite guard fully resolves my previous `-Inf` blocker: Inf/NaN values can no longer enter the directed-rounding bit step, while finite values keep the existing selection. Independent CPU A/B used the exact parent/head `float64Unary`, `roundFractF64`, `quietNan64`, `flushF64Bits` and float-mode logic with the head's 36-lane fixture: - parent: 8/432 mismatches, all the previously reported `-Inf` RTN/RTZ result `0xfff7ffffffffffff`; - head: 0/432, including all 48 new special-value cells. An additional 256-case matrix across all four round/denorm fields and both IEEE modes used signed Inf, qNaN and sNaN payloads. Parent had 16 mismatches on the same `-Inf` path; head had 0. IEEE-off kept the established sNaN input bits, while IEEE-on quieted them with sign/payload preserved. The new runtime and declared-code fixture variants both pin the special rows to exact words. The author also reports native RX 5700 XT/gfx1010 measurements for the four modes and a concrete old-head negative control; I did not run a local SPIR-V or GPU dispatch. Diff/convention/CI status was checked separately by the existing reviews. AI-assisted: yes.
MarcZX10 commented 2026-11-23 07:46:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T07:46:37Z.

Review: APPROVED


Reviewed — looks good

The reviewed changes implement directed rounding for the three fract instructions, and the inspected code and supplied test results support the change.

What I ran

Reviewed head 7f67fa3692c0da2de411db4b928d290d5952fdb3. I read the prepared description, commit list, manifest, diff, and changed source files, plus the f16 conversion helper used by the change. I did not run commands or tests; test results below are author reported.

Results

Check Result Note
Targeted code review passed Changed implementation and test read
Author reported checks not run Hardware, CTest, and convention checks not run here

Findings

Blocking

None.

Non-blocking

None.

Not verified

The new Vulkan test and other reported checks were not run by this reviewer. I did not inspect every changed file's full text; the new execution test was read only through line 100, and the rest of that test and the full RoundingMode.cpp were not read. The author reports RDNA1 measurements; PS5 gfx1013 behavior was not measured.

Files read: core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp, core/shader/recompiler/Translation/src/FloatInstructions.cpp, core/shader/recompiler/Translation/src/Float64Instructions.cpp, core/shader/recompiler/Translation/src/RoundingMode.cpp, core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp, core/libs/prx/libSceAgcDriver/tests/execution/FractDirectedRounding.cpp (lines 1–100), and docs/dev/debt/changes/fract-directed-rounding.md. Also read review/description.md, review/commits.md, review/manifest.json, and review/diff.patch. review/files.json was not available as a review-folder document.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6018038385 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26047#pullrequestreview-6018038385). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T07:46:37Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed changes implement directed rounding for the three fract instructions, and the inspected code and supplied test results support the change. ## What I ran Reviewed head `7f67fa3692c0da2de411db4b928d290d5952fdb3`. I read the prepared description, commit list, manifest, diff, and changed source files, plus the f16 conversion helper used by the change. I did not run commands or tests; test results below are author reported. ## Results | Check | Result | Note | |---|---|---| | Targeted code review | passed | Changed implementation and test read | | Author reported checks | not run | Hardware, CTest, and convention checks not run here | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The new Vulkan test and other reported checks were not run by this reviewer. I did not inspect every changed file's full text; the new execution test was read only through line 100, and the rest of that test and the full `RoundingMode.cpp` were not read. The author reports RDNA1 measurements; PS5 gfx1013 behavior was not measured. Files read: `core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp`, `core/shader/recompiler/Translation/src/FloatInstructions.cpp`, `core/shader/recompiler/Translation/src/Float64Instructions.cpp`, `core/shader/recompiler/Translation/src/RoundingMode.cpp`, `core/shader/recompiler/Translation/src/TranslationContext/SubwordPacking.cpp`, `core/libs/prx/libSceAgcDriver/tests/execution/FractDirectedRounding.cpp` (lines 1–100), and `docs/dev/debt/changes/fract-directed-rounding.md`. Also read `review/description.md`, `review/commits.md`, `review/manifest.json`, and `review/diff.patch`. `review/files.json` was not available as a review-folder document. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-28 12:35:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T12:35:44Z.

Review: APPROVED


Reviewed — looks good

The reviewed change implements directed rounding for the three fract operations, and the supplied test report covers declared and runtime modes on the stated RDNA1 hardware; I did not run the reported checks.

What I ran

Reviewed head ab2742cac58552db32188432f34ce89d00cab96f. Read the prepared description, commits, manifest and diff, plus the full changed execution test and relevant float translation functions and declarations through repo_read.py. No commands or tests were run by me. The PR description reports Windows 11 and an RX 5700 XT; gfx1013 console behavior was not measured.

Results

Check Result Note
Source review passed Core rounding paths and new test read
Reported checks not run Test and convention results are author-reported
Console behavior not run PS5 gfx1013 not measured

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not run the reported hardware oracle, execution tests, conventions check, debt check, or inspect CI output. The changed files read were core/libs/prx/libSceAgcDriver/tests/execution/FractDirectedRounding.cpp, core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp, core/shader/recompiler/Translation/src/Float64Instructions.cpp, core/shader/recompiler/Translation/src/FloatInstructions.cpp, core/shader/recompiler/Translation/src/RoundingMode.cpp, and docs/dev/debt/changes/fract-directed-rounding.md. The last two changed files were present in the diff but not read at full text; the review manifest was only partially read, so the complete reviewed/excluded file inventory is not verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6097798797 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26047#pullrequestreview-6097798797). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-28T12:35:44Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed change implements directed rounding for the three fract operations, and the supplied test report covers declared and runtime modes on the stated RDNA1 hardware; I did not run the reported checks. ## What I ran Reviewed head `ab2742cac58552db32188432f34ce89d00cab96f`. Read the prepared description, commits, manifest and diff, plus the full changed execution test and relevant float translation functions and declarations through `repo_read.py`. No commands or tests were run by me. The PR description reports Windows 11 and an RX 5700 XT; gfx1013 console behavior was not measured. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Core rounding paths and new test read | | Reported checks | not run | Test and convention results are author-reported | | Console behavior | not run | PS5 gfx1013 not measured | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified I did not run the reported hardware oracle, execution tests, conventions check, debt check, or inspect CI output. The changed files read were `core/libs/prx/libSceAgcDriver/tests/execution/FractDirectedRounding.cpp`, `core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp`, `core/shader/recompiler/Translation/src/Float64Instructions.cpp`, `core/shader/recompiler/Translation/src/FloatInstructions.cpp`, `core/shader/recompiler/Translation/src/RoundingMode.cpp`, and `docs/dev/debt/changes/fract-directed-rounding.md`. The last two changed files were present in the diff but not read at full text; the review manifest was only partially read, so the complete reviewed/excluded file inventory is not verified. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 21:30:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:30:23Z.

Review: COMMENTED


I followed the ULP step for the f32 and f64 paths and the f16 conversion from its exact f32 intermediate. The fixture checks infinities and NaN bits alongside the rounding cases. Its DenormPreserve refusal on unsupported hosts can leave denormal-preservation rows unexecuted while CTest passes. Please include the printed executed-case count when reporting validation so that the coverage of the preserved-denormal modes is clear. The paired shader tests and the three-precision fixture are queued on lavapipe.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6178935119 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/26047#pullrequestreview-6178935119). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T21:30:23Z. **Review:** COMMENTED --- I followed the ULP step for the f32 and f64 paths and the f16 conversion from its exact f32 intermediate. The fixture checks infinities and NaN bits alongside the rounding cases. Its `DenormPreserve` refusal on unsupported hosts can leave denormal-preservation rows unexecuted while CTest passes. Please include the printed executed-case count when reporting validation so that the coverage of the preserved-denormal modes is clear. The paired shader tests and the three-precision fixture are queued on lavapipe. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/26047:upstream-pr/26047'
git switch 'upstream-pr/26047'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/26047'
git switch 'upstream-pr/26047'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/26047'
git switch 'upstream-pr/26047'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/26047'
git switch 'main'
git merge --squash 'upstream-pr/26047'
git switch 'main'
git merge --ff-only 'upstream-pr/26047'
git switch 'main'
git merge 'upstream-pr/26047'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!26047
No description provided.