feat(shader): allow directed rounding modes for packed f16 minmax #14793

Merged
AlexWhitehouse merged 2 commits from upstream-pr/14793 into main 2026-11-07 11:48:42 +00:00
AlexWhitehouse commented 2026-11-01 17:58:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlexWhitehouse on 2026-11-01T17:58:34Z.


What

TranslationContext::packedFloat16 (core/shader/recompiler/Translation/src/FloatInstructions.cpp) threw packed f16 at pc … in FLOAT_MODE … (f16 rounding not to nearest even) is not implemented for every packed f16 instruction whenever the f16 round field of FLOAT_MODE is not nearest even. This PR exempts v_pk_min_f16 and v_pk_max_f16 from that throw.

  • These two select one operand's bits per lane, through the existing minMaxF16Bits path, so no rounding step happens. AMD's RDNA 2 ISA guide, §12.10 (printed p. 164, VOP3P opcodes 17 and 18), defines them as componentwise FP16 minimum and maximum.
  • Their NaN, signed-zero, denormal-flush, op_sel, negation and clamp handling is unchanged.
  • v_pk_add/mul/fma/fmac_f16, which do round, still throw.
  • Reachability: the FLOAT_MODE 0xcc that the v_fma_mixlo_f16 debt entry records for ps5-opengl has the f16 round field set to toward zero, so every packed f16 instruction in such a shader threw before.

Debt. docs/dev/debt/shader.md, two edits:

  • The packed-f16 entry now says min/max are exempt from the directed-rounding throw and are not measured in those modes.
  • The v_fma_mixlo_f16 entry's note about packed f16 rounding names the exception.

Both entries were already over 1,000 characters on main, so check_conventions warns on them; the PR changes only those clauses and keeps their measurement records.

Tested

  • agc_driver_float16_min_max_bits (tests/execution/Float16MinMaxBits.cpp) gains packed-only runs in every f16 round mode (0 to 3), crossed with:

    • IEEE 0 and 1;
    • DX10_CLAMP 0 and 1;
    • f16 denormal modes 0 to 3.

    The packed runs use the test's existing PackedCode, selector and negation checks, and CPU bit model. Rows now include signed zeros, infinities, quiet and signalling NaNs, denormals and minimum normals in every mode. The change passes 696,320 bit-exact comparisons.

  • Mutation check: swapping the min and max selection fails (actual 0x00010000, expected 0x00018000); restoring it passes.

  • Required focused comparison: ctest -R "^agc_driver_float16_min_max_bits$" -V on main (f2d874c1fd) and this PR, with the same test source and ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:

    • NVIDIA RTX 3060, Windows 11: main fails with packed f16 at pc 20 in FLOAT_MODE 52 (f16 rounding not to nearest even) is not implemented; this PR passes. VK_LOADER_DEBUG=layer showed the validation layer loaded and inserted. Neither log has a missing-layer warning or a VUID- error. This run used 4534907f0b, which differs from this PR only in the debt text.
    • lavapipe, Ubuntu 26.04: main fails at the same throw and this PR passes. The layer was inserted, and neither log has a missing-layer warning or a VUID- error.
    • Rerun at 67a16bfa40, after dropping the packed add throw check as requested in review, on both GPUs with the same variables: main fails at the same throw and this PR passes with 696,320 comparisons. The layer was inserted, and none of the four logs has a missing-layer warning or a VUID- error.
    • Rerun after rebasing onto main d2ce337078, which changed the add/mul/fma path of packedFloat16 (#11368), with the same variables on both GPUs: main fails at the same throw and this PR (35335272ae) passes with 696,320 comparisons. The layer was inserted, and none of the four logs has a missing-layer warning or a VUID- error.
    • Rerun after rebasing onto main 6f1d2c70ae, which added a native fma path to packedFloat16 (#14892), with the same variables on both GPUs: main fails at the same throw and this PR (8281e5821b) passes with 696,320 comparisons. The layer was inserted, and none of the four logs has a missing-layer warning or a VUID- error.
  • Wider runs of -R "agc_driver_.*(f16|float16|half|mode|sdwa|packed)|agc_shader_mode" with the same variables:

    • RTX 3060: 31/31;
    • lavapipe: 79/79.

    Neither run has a VUID- error.

  • python3 tools/check_conventions.py --base origin/main: no errors; two debt-length warnings on the two entries above, which were already over the limit.

  • python3 tools/pr_overlap.py: no confirmed overlap. The tool could not compare 23 open PRs that conflict with main, all through docs/dev/debt/shader.md. None of their diffs touches the packed-f16 or v_fma_mixlo_f16 entries, packedFloat16, v_pk_min/max_f16 or Float16MinMaxBits.cpp. #5021 also edits FloatInstructions.cpp, but only one line in vLdexpF16.

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
  • 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: NVIDIA GeForce RTX 3060, driver 610.88, Windows 11 Pro 10.0.26300; lavapipe (llvmpipe, Mesa 26.0.8, LLVM 21.1.8), Ubuntu 26.04 x86-64
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5110027031 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14793). Originally posted by [AlexWhitehouse](https://github.com/AlexWhitehouse) on 2026-11-01T17:58:34Z. --- ### What `TranslationContext::packedFloat16` (`core/shader/recompiler/Translation/src/FloatInstructions.cpp`) threw `packed f16 at pc … in FLOAT_MODE … (f16 rounding not to nearest even) is not implemented` for every packed f16 instruction whenever the f16 round field of `FLOAT_MODE` is not nearest even. This PR exempts `v_pk_min_f16` and `v_pk_max_f16` from that throw. - These two select one operand's bits per lane, through the existing `minMaxF16Bits` path, so no rounding step happens. AMD's RDNA 2 ISA guide, §12.10 (printed p. 164, VOP3P opcodes 17 and 18), defines them as componentwise FP16 minimum and maximum. - Their NaN, signed-zero, denormal-flush, `op_sel`, negation and clamp handling is unchanged. - `v_pk_add/mul/fma/fmac_f16`, which do round, still throw. - **Reachability:** the `FLOAT_MODE` 0xcc that the `v_fma_mixlo_f16` debt entry records for ps5-opengl has the f16 round field set to toward zero, so every packed f16 instruction in such a shader threw before. **Debt.** `docs/dev/debt/shader.md`, two edits: - The packed-f16 entry now says min/max are exempt from the directed-rounding throw and are not measured in those modes. - The `v_fma_mixlo_f16` entry's note about packed f16 rounding names the exception. Both entries were already over 1,000 characters on `main`, so `check_conventions` warns on them; the PR changes only those clauses and keeps their measurement records. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - **`agc_driver_float16_min_max_bits`** (`tests/execution/Float16MinMaxBits.cpp`) gains packed-only runs in every f16 round mode (0 to 3), crossed with: - IEEE 0 and 1; - DX10_CLAMP 0 and 1; - f16 denormal modes 0 to 3. The packed runs use the test's existing `PackedCode`, selector and negation checks, and CPU bit model. Rows now include signed zeros, infinities, quiet and signalling NaNs, denormals and minimum normals in every mode. The change passes 696,320 bit-exact comparisons. - **Mutation check:** swapping the min and max selection fails (actual `0x00010000`, expected `0x00018000`); restoring it passes. - **Required focused comparison:** `ctest -R "^agc_driver_float16_min_max_bits$" -V` on `main` (f2d874c1fd) and this PR, with the same test source and `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`: - **NVIDIA RTX 3060, Windows 11:** main fails with `packed f16 at pc 20 in FLOAT_MODE 52 (f16 rounding not to nearest even) is not implemented`; this PR passes. `VK_LOADER_DEBUG=layer` showed the validation layer loaded and inserted. Neither log has a missing-layer warning or a `VUID-` error. This run used 4534907f0b, which differs from this PR only in the debt text. - **lavapipe, Ubuntu 26.04:** main fails at the same throw and this PR passes. The layer was inserted, and neither log has a missing-layer warning or a `VUID-` error. - **Rerun at 67a16bfa40**, after dropping the packed add throw check as requested in review, on both GPUs with the same variables: main fails at the same throw and this PR passes with 696,320 comparisons. The layer was inserted, and none of the four logs has a missing-layer warning or a `VUID-` error. - **Rerun after rebasing onto `main` d2ce337078**, which changed the add/mul/fma path of `packedFloat16` (#11368), with the same variables on both GPUs: `main` fails at the same throw and this PR (35335272ae) passes with 696,320 comparisons. The layer was inserted, and none of the four logs has a missing-layer warning or a `VUID-` error. - **Rerun after rebasing onto `main` 6f1d2c70ae**, which added a native fma path to `packedFloat16` (#14892), with the same variables on both GPUs: `main` fails at the same throw and this PR (8281e5821b) passes with 696,320 comparisons. The layer was inserted, and none of the four logs has a missing-layer warning or a `VUID-` error. - **Wider runs** of `-R "agc_driver_.*(f16|float16|half|mode|sdwa|packed)|agc_shader_mode"` with the same variables: - RTX 3060: 31/31; - lavapipe: 79/79. Neither run has a `VUID-` error. - `python3 tools/check_conventions.py --base origin/main`: no errors; two `debt-length` warnings on the two entries above, which were already over the limit. - **`python3 tools/pr_overlap.py`:** no confirmed overlap. The tool could not compare 23 open PRs that conflict with `main`, all through `docs/dev/debt/shader.md`. None of their diffs touches the packed-f16 or `v_fma_mixlo_f16` entries, `packedFloat16`, `v_pk_min/max_f16` or `Float16MinMaxBits.cpp`. #5021 also edits `FloatInstructions.cpp`, but only one line in `vLdexpF16`. ### 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) - [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: NVIDIA GeForce RTX 3060, driver 610.88, Windows 11 Pro 10.0.26300; lavapipe (llvmpipe, Mesa 26.0.8, LLVM 21.1.8), Ubuntu 26.04 x86-64 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-01 18:03:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T18:03:38Z.

Review: COMMENTED


Reviewed — no blocking findings

The directed-rounding exemption is limited to packed min/max opcodes, while other packed arithmetic remains guarded; the added cases exercise the min/max path across the configured mode combinations.

What I ran

Reviewed head 97c53a1d091b3ac085e1adf011485edddc8f6935 against base f2d874c1fdccf781c0fa5d86619bb5dd8894b958; the merge preview is clean. Environment: Linux x86-64, GCC 12.2.0, Python 3.11.2. I reviewed the source diff, test-mode construction, test registration and debt edits. No build or GPU test was run locally.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14793
git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...97c53a1d091b3ac085e1adf011485edddc8f6935

Results

Check Result Note
Diff and conventions passed Two existing debt-length warnings; no convention errors.
Source and test review passed Only packed min/max bypass the rounding guard; add remains guarded.
CTest registration passed The existing execution-test glob registers Float16MinMaxBits.cpp.
Hosted CI not run Six checks are queued on this head.
GPU execution and mutation check not run The PR reports them passing; I did not reproduce them.
Raw precheck output
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14793-97c53a1d091b/report.md
/tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14793-97c53a1d091b/report.json
Conclusion: checks failed

The report's diff check passed. Its convention check passed with these warnings:

docs/dev/debt/shader.md:140: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 1160 characters
docs/dev/debt/shader.md:145: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 1652 characters
2 findings, 0 errors; GitHub shows at most 10 error annotations, the job summary lists all

The overall precheck could not launch its workspace-only pr_abi_audit.py and pr_test_quality.py helpers from the isolated exact-head checkout. Those helper launch errors are not code or test failures. The live stack check passed.

Negative control

Not run by me. The PR reports that swapping the min/max selection made the test fail with an output mismatch; I did not repeat that mutation.

Findings

Blocking

None found in the reviewed changes.

Non-blocking

None.

Sources

Not verified

The reported RTX 3060 and lavapipe runs, the 696,320 comparisons, the mutation result, and validation-layer output were read from the PR description but not independently reproduced. No console behavior was tested. Hosted checks remain queued.

To get this to a good state

No source change is requested. Once the hosted checks complete, I can recheck this head and approve if they pass.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729478149 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14793#pullrequestreview-5729478149). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T18:03:38Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The directed-rounding exemption is limited to packed min/max opcodes, while other packed arithmetic remains guarded; the added cases exercise the min/max path across the configured mode combinations. ## What I ran Reviewed head `97c53a1d091b3ac085e1adf011485edddc8f6935` against base `f2d874c1fdccf781c0fa5d86619bb5dd8894b958`; the merge preview is clean. Environment: Linux x86-64, GCC 12.2.0, Python 3.11.2. I reviewed the source diff, test-mode construction, test registration and debt edits. No build or GPU test was run locally. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14793 git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...97c53a1d091b3ac085e1adf011485edddc8f6935 ``` ## Results | Check | Result | Note | |---|---|---| | Diff and conventions | passed | Two existing debt-length warnings; no convention errors. | | Source and test review | passed | Only packed min/max bypass the rounding guard; add remains guarded. | | CTest registration | passed | The existing execution-test glob registers `Float16MinMaxBits.cpp`. | | Hosted CI | not run | Six checks are queued on this head. | | GPU execution and mutation check | not run | The PR reports them passing; I did not reproduce them. | <details><summary>Raw precheck output</summary> ```text /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14793-97c53a1d091b/report.md /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-14793-97c53a1d091b/report.json Conclusion: checks failed ``` The report's diff check passed. Its convention check passed with these warnings: ```text docs/dev/debt/shader.md:140: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 1160 characters docs/dev/debt/shader.md:145: warning: [debt-length] Technical debt entry over 1000 characters: state the gap first (what differs from the console, what is unverified, what throws) and keep only the behaviour it needs: 1652 characters 2 findings, 0 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` The overall precheck could not launch its workspace-only `pr_abi_audit.py` and `pr_test_quality.py` helpers from the isolated exact-head checkout. Those helper launch errors are not code or test failures. The live stack check passed. </details> ## Negative control Not run by me. The PR reports that swapping the min/max selection made the test fail with an output mismatch; I did not repeat that mutation. ## Findings ### Blocking None found in the reviewed changes. ### Non-blocking None. ## Sources - [Rounding guard and bit-based min/max lane path at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/97c53a1d091b3ac085e1adf011485edddc8f6935/core/shader/recompiler/Translation/src/FloatInstructions.cpp#L13) - [Only the packed min/max opcodes select the exempt IR operations](https://github.com/boykopovar/AnyPS5/blob/97c53a1d091b3ac085e1adf011485edddc8f6935/core/shader/recompiler/Translation/src/VectorInstructions.cpp#L953) - [Directed-rounding mode matrix and packed-add rejection test](https://github.com/boykopovar/AnyPS5/blob/97c53a1d091b3ac085e1adf011485edddc8f6935/core/libs/prx/libSceAgcDriver/tests/execution/Float16MinMaxBits.cpp#L259) - [Execution-test source discovery and target setup](https://github.com/boykopovar/AnyPS5/blob/f2d874c1fdccf781c0fa5d86619bb5dd8894b958/core/libs/prx/libSceAgcDriver/CMakeLists.txt#L547) ## Not verified The reported RTX 3060 and lavapipe runs, the 696,320 comparisons, the mutation result, and validation-layer output were read from the PR description but not independently reproduced. No console behavior was tested. Hosted checks remain queued. ## To get this to a good state No source change is requested. Once the hosted checks complete, I can recheck this head and approve if they pass.
MarcZX10 commented 2026-11-01 19:30:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T19:30:05Z.

Review: COMMENTED


Reviewed — no blocking findings

The exemption is sound: v_pk_min_f16 and v_pk_max_f16 select operand bits and never round, so the rounding-mode throw does not apply to them. Approval waits for the macOS relinker jobs, which were queued at review time.

What I ran

  • Head 67a16bfa4003957fe0648197946f492e9f3c66d2; base f2d874c1fd (merge base is the same commit). 3 files, +26/-7: FloatInstructions.cpp (1/1), Float16MinMaxBits.cpp (23/4), docs/dev/debt/shader.md (2/2). I read the whole diff.
  • Checked the call sites: FPMin32 and FPMax32 reach packedFloat16 only from the packed min and max opcodes, with quietSnan set (VectorInstructions.cpp lines 956-958). That branch takes packU16Lanes(minMaxLane(...)) (FloatInstructions.cpp lines 61 and 68), which selects 16-bit lanes through minMaxF16Bits with no rounding step. The add, multiply and fma opcodes still take the throw.
  • Read the test diff: packed-only runs in every f16 round mode, crossed with IEEE, DX10 clamp and f16 denormal modes, and special-value rows. I did not rerun it.
  • Precheck report at this exact head (head and base unchanged at completion). Its ABI and test-quality rows failed because their helpers are not in the head tree. This PR changes no export.

Results

Check Result Note
Diff check passed
Conventions and PR template passed
Mergeability and dependencies passed depends on none
Packed min and max rounding exemption passed min and max take the bit-selection path with no rounding
Test registration passed existing registered test
Build and runtime tests not run no build; GPU runs are author-reported
Negative controls not run the PR reports a mutation check (author-reported)
Hosted CI not run all completed jobs passed except one cancelled conventions run; macOS relinker queued
Commands and unedited precheck output

Commands:

  • Precheck: python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14793 --output-dir <scratch>/precheck/14793 (report.md in that directory).
  • Head fetched by URL (objects only): git fetch https://github.com/boykopovar/AnyPS5.git pull/14793/head.
  • Call sites: git grep -n 'packedFloat16(' 67a16bfa4003957fe0648197946f492e9f3c66d2.
  • Hosted checks: gh api repos/boykopovar/AnyPS5/commits/67a16bfa4003957fe0648197946f492e9f3c66d2/check-runs.

Precheck table (unedited):

Check Status Command / reason
build_and_compile not_applicable The precheck deliberately does not configure, build, or compile AnyPS5.
diff_check passed git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...67a16bfa4003957fe0648197946f492e9f3c66d2
conventions_and_pr_template passed /marc/Conlyse-VIEJO/.venv/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 67a16bfa4003957fe0648197946f492e9f3c66d2 --title feat(shader): allow directed rounding modes for packed f16 minmax --body /dev/shm/reviewer-run/precheck/14793/pr-body.md
changed_export_abi_audit failed /marc/Conlyse-VIEJO/.venv/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 67a16bfa4003957fe0648197946f492e9f3c66d2 --json
python_syntax not_applicable No changed Python implementation files.
related_python_unit_tests not_applicable No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.
python_test_registration not_applicable No changed test_*.py files.
live_dependency_and_mergeability_check passed /marc/Conlyse-VIEJO/.venv/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14793 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14793/stack
build_dependent_cpp_tests not_applicable Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.
test_quality_heuristics failed /marc/Conlyse-VIEJO/.venv/bin/python3 /dev/shm/reviewer-run/precheck/14793/head-67a16bfa4003-785579a1/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14793/head-67a16bfa4003-785579a1 --json core/libs/prx/libSceAgcDriver/tests/execution/Float16MinMaxBits.cpp core/shader/recompiler/Translation/src/FloatInstructions.cpp docs/dev/debt/shader.md
negative_controls not_applicable No changed Python test module in tools/ can be run as a no-build base-source control.

Negative control

Not run here. The PR reports a mutation check (swapping min and max fails the test; restoring passes); I did not rerun it.

Findings

Blocking

None.

Non-blocking

  • The packed f16 entry and the v_fma_mixlo_f16 entry in docs/dev/debt/shader.md were already over 1,000 characters, so check_conventions warns on them. The PR keeps that length and says so.

Sources

Not verified

  • The RDNA 2 ISA citation (§12.10, opcodes 17 and 18) was not re-read; the non-rounding behaviour was checked against the code.
  • The GPU runs (NVIDIA RTX 3060 on Windows, lavapipe on Ubuntu) and the mutation check are author-reported.
  • Denormal flushing for min and max is unchanged by this PR and was not re-derived.
  • The macOS relinker jobs had not finished at review time.

To get this to a good state

  • Nothing blocking. Approval waits for the macOS jobs on this head.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729855780 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14793#pullrequestreview-5729855780). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T19:30:05Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The exemption is sound: `v_pk_min_f16` and `v_pk_max_f16` select operand bits and never round, so the rounding-mode throw does not apply to them. Approval waits for the macOS relinker jobs, which were queued at review time. ## What I ran - Head `67a16bfa4003957fe0648197946f492e9f3c66d2`; base `f2d874c1fd` (merge base is the same commit). 3 files, +26/-7: `FloatInstructions.cpp` (1/1), `Float16MinMaxBits.cpp` (23/4), `docs/dev/debt/shader.md` (2/2). I read the whole diff. - Checked the call sites: `FPMin32` and `FPMax32` reach `packedFloat16` only from the packed min and max opcodes, with `quietSnan` set (`VectorInstructions.cpp` lines 956-958). That branch takes `packU16Lanes(minMaxLane(...))` (`FloatInstructions.cpp` lines 61 and 68), which selects 16-bit lanes through `minMaxF16Bits` with no rounding step. The add, multiply and fma opcodes still take the throw. - Read the test diff: packed-only runs in every f16 round mode, crossed with IEEE, DX10 clamp and f16 denormal modes, and special-value rows. I did not rerun it. - Precheck report at this exact head (head and base unchanged at completion). Its ABI and test-quality rows failed because their helpers are not in the head tree. This PR changes no export. ## Results | Check | Result | Note | | --- | --- | --- | | Diff check | passed | | | Conventions and PR template | passed | | | Mergeability and dependencies | passed | depends on none | | Packed min and max rounding exemption | passed | min and max take the bit-selection path with no rounding | | Test registration | passed | existing registered test | | Build and runtime tests | not run | no build; GPU runs are author-reported | | Negative controls | not run | the PR reports a mutation check (author-reported) | | Hosted CI | not run | all completed jobs passed except one cancelled conventions run; macOS relinker queued | <details><summary>Commands and unedited precheck output</summary> Commands: - Precheck: `python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14793 --output-dir <scratch>/precheck/14793` (report.md in that directory). - Head fetched by URL (objects only): `git fetch https://github.com/boykopovar/AnyPS5.git pull/14793/head`. - Call sites: `git grep -n 'packedFloat16(' 67a16bfa4003957fe0648197946f492e9f3c66d2`. - Hosted checks: `gh api repos/boykopovar/AnyPS5/commits/67a16bfa4003957fe0648197946f492e9f3c66d2/check-runs`. Precheck table (unedited): | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...67a16bfa4003957fe0648197946f492e9f3c66d2` | | conventions_and_pr_template | passed | `/marc/Conlyse-VIEJO/.venv/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 67a16bfa4003957fe0648197946f492e9f3c66d2 --title feat(shader): allow directed rounding modes for packed f16 minmax --body /dev/shm/reviewer-run/precheck/14793/pr-body.md` | | changed_export_abi_audit | failed | `/marc/Conlyse-VIEJO/.venv/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 67a16bfa4003957fe0648197946f492e9f3c66d2 --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/marc/Conlyse-VIEJO/.venv/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14793 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14793/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/marc/Conlyse-VIEJO/.venv/bin/python3 /dev/shm/reviewer-run/precheck/14793/head-67a16bfa4003-785579a1/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14793/head-67a16bfa4003-785579a1 --json core/libs/prx/libSceAgcDriver/tests/execution/Float16MinMaxBits.cpp core/shader/recompiler/Translation/src/FloatInstructions.cpp docs/dev/debt/shader.md` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | </details> ## Negative control Not run here. The PR reports a mutation check (swapping min and max fails the test; restoring passes); I did not rerun it. ## Findings **Blocking** None. **Non-blocking** - The packed f16 entry and the `v_fma_mixlo_f16` entry in `docs/dev/debt/shader.md` were already over 1,000 characters, so `check_conventions` warns on them. The PR keeps that length and says so. ## Sources - Exemption: https://github.com/boykopovar/AnyPS5/blob/67a16bfa4003957fe0648197946f492e9f3c66d2/core/shader/recompiler/Translation/src/FloatInstructions.cpp#L13-L16 - Min and max lane path: https://github.com/boykopovar/AnyPS5/blob/67a16bfa4003957fe0648197946f492e9f3c66d2/core/shader/recompiler/Translation/src/FloatInstructions.cpp#L61-L68 - Opcode call sites: https://github.com/boykopovar/AnyPS5/blob/67a16bfa4003957fe0648197946f492e9f3c66d2/core/shader/recompiler/Translation/src/VectorInstructions.cpp#L952-L962 - Tests: https://github.com/boykopovar/AnyPS5/blob/67a16bfa4003957fe0648197946f492e9f3c66d2/core/libs/prx/libSceAgcDriver/tests/execution/Float16MinMaxBits.cpp ## Not verified - The RDNA 2 ISA citation (§12.10, opcodes 17 and 18) was not re-read; the non-rounding behaviour was checked against the code. - The GPU runs (NVIDIA RTX 3060 on Windows, lavapipe on Ubuntu) and the mutation check are author-reported. - Denormal flushing for min and max is unchanged by this PR and was not re-derived. - The macOS relinker jobs had not finished at review time. ## To get this to a good state - Nothing blocking. Approval waits for the macOS jobs on this head.
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!14793
No description provided.