Shaders: f16 results ignore their output modifier, as RDNA2 does with half denormals kept #2915

Open
github-bot wants to merge 1 commit from github-bot/gh-2915 into main AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 23:52 UTC · original
0xkn0wh3r3:shader/f16-results-take-their-output-modifier → main · +39 −22 · 3 files · 1 commits · open

What

A VOP3 f16 result with an output modifier (×2, ×4 or ×0.5) is now translated with the modifier ignored. The clamp still applies, in f32, and the result is rounded to a half once, as before. On main these programs are refused with "an output modifier on a 16-bit operation".

This covers float_result (the f16 VALU operations and v_cvt_f16_f32), the exactly rounded v_fma_f16 path, and half_modifiers (v_interp_p2_f16), which on main multiplied the interpolated half by the modifier.

Why: the ISA rule

AMD's RDNA2 ISA reference guide (30 November 2020), §6.2.2 "Instruction Outputs", p. 44:

Output modifiers are not compatible with output denormals: if output denormals are enabled, then output modifiers are ignored.

The same section says output modifiers are also ignored when the IEEE mode bit is set. §6.4, Table 24 (p. 47) gives MODE bits [7:6] as the "Double/Half-precision denormal mode", so f16 shares its denormal setting with f64.

The translator's float model (header of emit/semantics_tests.rs) is IEEE mode off, 32-bit denormals flushed, 16- and 64-bit denormals kept. With f16 output denormals kept, the hardware ignores the output modifier on an f16 result, so the result is the same as with OMOD 0. CLAMP is a separate field and still applies.

If a title's program ran with f16 denormals flushed, the modifier would apply. The translator assumes the fixed mode, as it does for the rest of the float model.

Where it came from

Started from DexNom's fork, DexNom/VIctory@570a941, which applied the modifier in float_result. Credited with Co-authored-by: DexNom. Following the triage, the change now follows the ISA guide and ignores the modifier.

Tested

  • valu_tests::f16_results_ignore_their_output_modifier, on the hardware adapter and WARP: v_add_f16 of 1.5 and 0.25 gives 1.75 under each of the three modifiers, and 1.0 with div:2 plus clamp (0.875 if the modifier applied). v_mul_f16 and v_fma_f16 (1.5 × 0.25 + 0) give 0.375 under mul:2. On main each of these programs is refused.
  • emit::tests::interpolated_f16_writes_the_op_sel_half_with_modifiers now checks that v_interp_p2_f16 with mul:2 and clamp has the clamp but no ×2 in the DXIL.
  • No existing hardware-sourced test pins f16 OMOD. The semantics probes that use output modifiers (output_mods()) are all f32 operations.
  • cargo test -p victory-shader --lib (with VICTORY_DXIL set to dxil.dll): 299 passed, 3 ignored. The 3 failures also fail on main on this machine: two stride_tests and gathers_at_a_level_match_the_hardware. heap_direct_texture_reads_mark_their_heap_index was skipped because it crashes.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean. cargo xtask policy: ok (emit/lower.rs is 520,268 bytes).

Not tested

  • Not checked on RDNA2 hardware. The behaviour follows the ISA guide's rule together with the float model above.
  • Not run with the title, so I haven't counted how many of its programs this unblocks.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 23:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2915) `0xkn0wh3r3:shader/f16-results-take-their-output-modifier` → `main` · +39 −22 · 3 files · 1 commits · open ## What A VOP3 f16 result with an output modifier (×2, ×4 or ×0.5) is now translated with the modifier ignored. The clamp still applies, in f32, and the result is rounded to a half once, as before. On main these programs are refused with "an output modifier on a 16-bit operation". This covers `float_result` (the f16 VALU operations and `v_cvt_f16_f32`), the exactly rounded `v_fma_f16` path, and `half_modifiers` (`v_interp_p2_f16`), which on main multiplied the interpolated half by the modifier. ## Why: the ISA rule AMD's RDNA2 ISA reference guide (30 November 2020), §6.2.2 "Instruction Outputs", p. 44: > Output modifiers are not compatible with output denormals: if output denormals are enabled, then output modifiers are ignored. The same section says output modifiers are also ignored when the IEEE mode bit is set. §6.4, Table 24 (p. 47) gives MODE bits [7:6] as the "Double/Half-precision denormal mode", so f16 shares its denormal setting with f64. The translator's float model (header of `emit/semantics_tests.rs`) is IEEE mode off, 32-bit denormals flushed, 16- and 64-bit denormals kept. With f16 output denormals kept, the hardware ignores the output modifier on an f16 result, so the result is the same as with OMOD 0. CLAMP is a separate field and still applies. If a title's program ran with f16 denormals flushed, the modifier would apply. The translator assumes the fixed mode, as it does for the rest of the float model. ## Where it came from Started from DexNom's fork, [DexNom/VIctory@570a941](https://github.com/DexNom/VIctory/commit/570a941e9b4e945121c26eb30dfc10c126845207), which applied the modifier in `float_result`. Credited with `Co-authored-by: DexNom`. Following the triage, the change now follows the ISA guide and ignores the modifier. ## Tested - `valu_tests::f16_results_ignore_their_output_modifier`, on the hardware adapter and WARP: `v_add_f16` of 1.5 and 0.25 gives 1.75 under each of the three modifiers, and 1.0 with `div:2` plus clamp (0.875 if the modifier applied). `v_mul_f16` and `v_fma_f16` (1.5 × 0.25 + 0) give 0.375 under `mul:2`. On main each of these programs is refused. - `emit::tests::interpolated_f16_writes_the_op_sel_half_with_modifiers` now checks that `v_interp_p2_f16` with `mul:2` and clamp has the clamp but no ×2 in the DXIL. - No existing hardware-sourced test pins f16 OMOD. The semantics probes that use output modifiers (`output_mods()`) are all f32 operations. - `cargo test -p victory-shader --lib` (with `VICTORY_DXIL` set to `dxil.dll`): 299 passed, 3 ignored. The 3 failures also fail on main on this machine: two `stride_tests` and `gathers_at_a_level_match_the_hardware`. `heap_direct_texture_reads_mark_their_heap_index` was skipped because it crashes. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. `cargo xtask policy`: ok (`emit/lower.rs` is 520,268 bytes). ## Not tested - Not checked on RDNA2 hardware. The behaviour follows the ISA guide's rule together with the float model above. - Not run with the title, so I haven't counted how many of its programs this unblocks.
A VOP3 f16 operation with an output modifier (times 2, 4 or 0.5) was
refused ("an output modifier on a 16-bit operation"). The result now
takes it, then its clamp, in f32 before it is rounded to a half once:
the order half_modifiers already uses for v_interp_p2_f16's (#1696). The
exactly rounded v_fma_f16 path still refuses one.

Test: f16_results_take_their_output_modifier_then_clamp (v_add_f16 of
1.5 and 0.25 with each modifier, and clamped; v_mul_f16 times 2; on the
hardware adapter and WARP).

From DexNom/VIctory@570a941e9b
(float_result's output modifier).

Co-authored-by: DexNom <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:17:24 +00:00
github-bot changed title from Shaders: an f16 result takes its output modifier to Shaders: f16 results ignore their output modifier, as RDNA2 does with half denormals kept 2026-11-26 07:37:25 +00:00
github-bot force-pushed github-bot/gh-2915 from dcf36ffbeb to de177bd3e3 2026-11-26 07:37:26 +00:00 Compare
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 23:54 UTC · original · reviewed

Verified: omod factors [1,2,4,0.5] applied as an f32 multiply before clamp and the single half-rounding matches half_modifiers' interpolation semantics exactly — and the test arithmetic checks (1.75: x2=3.5, x4=7, x0.5=0.875, clamp 7->1.0; mul 0.375x2=0.75). The old refusal becomes unreachable dead weight no more. LGTM.

**@⁠kotekompotek** on GitHub · 2026-11-25 23:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2915#pullrequestreview-6066656670) · **reviewed** Verified: omod factors [1,2,4,0.5] applied as an f32 multiply before clamp and the single half-rounding matches `half_modifiers`' interpolation semantics exactly — and the test arithmetic checks (1.75: x2=3.5, x4=7, x0.5=0.875, clamp 7->1.0; mul 0.375x2=0.75). The old refusal becomes unreachable dead weight no more. LGTM.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 23:59 UTC · original · reviewed

Verified head dcf36ffb cleanly on origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + Windows SDK 10.0.26100.0 dxil.dll).

Code & Semantics Review

  • Order & single rounding: float_result (crates/victory-shader/src/emit/lower.rs:6986-6997) applies omod (2.0/4.0/0.5) on the f32 intermediate, then clamp (Saturate), then narrow16 (RNE or RTZ per mode16), matching half_modifiers and write_f without double-rounding or premature f16 overflow.
  • Scope safety: 16-bit integer ops (INT), v_pk_* (packed16), and RNE v_fma_f16 (TwoSum path) continue to explicitly reject v.omod != 0, while v_cvt_f16_f32 and FLOAT1/FLOAT2/FLOAT3 route cleanly through float_result.
  • File size: emit/lower.rs is 520,848 B (+285 B vs 63bcca43, 3,440 B below the 512 KiB policy cap).

Local Verification

  • Targeted victory-shader tests (valu_tests::f16_results_take_their_output_modifier_then_clamp, emit::lower::tests, emit::semantics_tests, emit::tests::interpolated_f16_writes_the_op_sel_half_with_modifiers) on RTX 5090 + WARP + dxil.dll: 69/69 passed (1 pre-existing ignored).
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features) & cargo xtask policy (191 files ok): clean.

Looks clean and ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-25 23:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/2915#pullrequestreview-6066691434) · **reviewed** Verified head `dcf36ffb` cleanly on `origin/main` (`63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + D3D12 WARP + Windows SDK 10.0.26100.0 `dxil.dll`). ### Code & Semantics Review - **Order & single rounding**: `float_result` (`crates/victory-shader/src/emit/lower.rs:6986-6997`) applies `omod` (`2.0`/`4.0`/`0.5`) on the `f32` intermediate, then `clamp` (`Saturate`), then `narrow16` (RNE or RTZ per `mode16`), matching `half_modifiers` and `write_f` without double-rounding or premature `f16` overflow. - **Scope safety**: 16-bit integer ops (`INT`), `v_pk_*` (`packed16`), and RNE `v_fma_f16` (`TwoSum` path) continue to explicitly reject `v.omod != 0`, while `v_cvt_f16_f32` and `FLOAT1`/`FLOAT2`/`FLOAT3` route cleanly through `float_result`. - **File size**: `emit/lower.rs` is `520,848` B (+285 B vs `63bcca43`, `3,440` B below the 512 KiB policy cap). ### Local Verification - Targeted `victory-shader` tests (`valu_tests::f16_results_take_their_output_modifier_then_clamp`, `emit::lower::tests`, `emit::semantics_tests`, `emit::tests::interpolated_f16_writes_the_op_sel_half_with_modifiers`) on RTX 5090 + WARP + `dxil.dll`: **69/69 passed** (1 pre-existing ignored). - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`) & `cargo xtask policy` (`191 files ok`): clean. Looks clean and ready to merge.
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-26 00:05 UTC · original

Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no clippy/rustup.

  • Diff against merge-base 842b0cb: 3 files, +35/-4. Negative control: f16_results_take_their_output_modifier_then_clamp is absent from the base commit.
  • cargo test --locked -p victory-shader --lib -- emit::valu_tests::f16_results_take_their_output_modifier_then_clamp --exact --quiet -> 1 passed (GPU/WARP harness, no game files).
  • Full cargo test --locked -p victory-shader --lib -- emit::valu_tests --quiet -> 36 passed, 0 failed, 270 filtered out.
  • Nit: git diff --check flags one trailing whitespace in README.md line 17 (displayed. ); worth removing before merge.

AI-assisted (Hy4 flash).

**@⁠cloph-dsp** on GitHub · 2026-11-26 00:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/2915#issuecomment-7178388737) Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no clippy/rustup. - Diff against merge-base 842b0cb: 3 files, +35/-4. Negative control: `f16_results_take_their_output_modifier_then_clamp` is absent from the base commit. - `cargo test --locked -p victory-shader --lib -- emit::valu_tests::f16_results_take_their_output_modifier_then_clamp --exact --quiet` -> 1 passed (GPU/WARP harness, no game files). - Full `cargo test --locked -p victory-shader --lib -- emit::valu_tests --quiet` -> 36 passed, 0 failed, 270 filtered out. - Nit: `git diff --check` flags one trailing whitespace in README.md line 17 (`displayed. `); worth removing before merge. AI-assisted (Hy4 flash).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 02:22 UTC · original · edited 2026-11-26 08:26 UTC

Automated triage for the maintainers.

Needs work, but close. Thanks for finding the reference. The ISA rule you quote (RDNA2 §6.2.2: output modifiers are ignored when output denormals are enabled) is the evidence we asked for. de177bd follows it in float_result, the v_fma_f16 path and half_modifiers (emit/lower.rs): the clamp still applies in f32, the modifier is dropped, and there is a single rounding to half. CI check passes.

One gap left. The rule depends on the program's f16 denormal mode, and the translator assumes that mode instead of reading it. The mode a program starts in comes from the FLOAT_MODE field of its RSRC1 register (native.rs already reads COMPUTE_PGM_RSRC1 for the VGPR count). s_denorm_mode is accepted and ignored in ir.rs. A compiler would also normally only emit an f16 output modifier when f16 denormals are flushed, because otherwise the modifier does nothing. So the programs that actually carry one may well be the ones where the hardware applies it. Please read the f16/f64 denormal bits from FLOAT_MODE:

  • denormals kept: ignore the modifier, as now;
  • denormals flushed: apply it (the earlier head's code);
  • mode not known, or changed by s_denorm_mode / s_setreg of MODE[7:6]: refuse, as main does.

A count of how many of the title's f16-omod programs fall into each case would settle it.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 02:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2915#issuecomment-7180745317) · edited 2026-11-26 08:26 UTC <!-- victory-triage v1 head=de177bd3e3305b596820d476ea9ba25f4385a782 verdict=needs-work at=2026-11-26T08:18:00Z --> Automated triage for the maintainers. **Needs work, but close.** Thanks for finding the reference. The ISA rule you quote (RDNA2 §6.2.2: output modifiers are ignored when output denormals are enabled) is the evidence we asked for. `de177bd` follows it in `float_result`, the `v_fma_f16` path and `half_modifiers` (`emit/lower.rs`): the clamp still applies in f32, the modifier is dropped, and there is a single rounding to half. CI `check` passes. One gap left. The rule depends on the program's f16 denormal mode, and the translator assumes that mode instead of reading it. The mode a program starts in comes from the FLOAT_MODE field of its RSRC1 register (`native.rs` already reads `COMPUTE_PGM_RSRC1` for the VGPR count). `s_denorm_mode` is accepted and ignored in `ir.rs`. A compiler would also normally only emit an f16 output modifier when f16 denormals are flushed, because otherwise the modifier does nothing. So the programs that actually carry one may well be the ones where the hardware applies it. Please read the f16/f64 denormal bits from FLOAT_MODE: - denormals kept: ignore the modifier, as now; - denormals flushed: apply it (the earlier head's code); - mode not known, or changed by `s_denorm_mode` / `s_setreg` of MODE[7:6]: refuse, as `main` does. A count of how many of the title's f16-omod programs fall into each case would settle it. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-26 07:34 UTC · original

Thanks. The public RDNA2 ISA guide settles this, and it points the other way from what the PR did.

Evidence. AMD RDNA2 ISA Reference Guide (30 Nov 2020), §6.2.2 "Instruction Outputs", p. 44: "if output denormals are enabled, then output modifiers are ignored." The same paragraph says they are also ignored with IEEE mode set. §6.4 Table 24 (p. 47) puts half precision in the same denormal field as double (MODE[7:6]).

Reasoning. The translator's float model (emit/semantics_tests.rs header) is IEEE mode off, 32-bit denormals flushed, 16- and 64-bit denormals kept. So f16 output denormals are enabled, and the hardware ignores OMOD on an f16 result: the result is as if OMOD were 0. CLAMP is a separate field and still applies. If a title's program ran with f16 denormals flushed, OMOD would apply. The translator assumes the fixed mode, as it does for the rest of the float model.

What changed (de177bd3). f16 VALU results (float_result, including the exactly rounded v_fma_f16 path) now translate with OMOD ignored: no multiply, clamp in f32, one rounding to half. On main these programs are refused; the earlier PR head applied the modifier. The test is now f16_results_ignore_their_output_modifier. Its div:2 + clamp case tells the two readings apart (1.0 if OMOD is ignored, 0.875 if it applies). It passes on the hardware adapter and WARP.

half_modifiers (v_interp_p2_f16). On main it applied OMOD to the f16 interpolation result. No hardware-sourced test pins that: the semantics probes that use output modifiers are all f32 operations, and interpolated_f16_writes_the_op_sel_half_with_modifiers is a DXIL-structure check from an audit. So I changed it the same way (clamp only), and that test now asserts there is no ×2 in the DXIL.

I haven't counted how many of the title's programs this unblocks. I can't run the title.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-26 07:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/2915#issuecomment-7185602028) Thanks. The public RDNA2 ISA guide settles this, and it points the other way from what the PR did. **Evidence.** AMD RDNA2 ISA Reference Guide (30 Nov 2020), §6.2.2 "Instruction Outputs", p. 44: "if output denormals are enabled, then output modifiers are ignored." The same paragraph says they are also ignored with IEEE mode set. §6.4 Table 24 (p. 47) puts half precision in the same denormal field as double (MODE[7:6]). **Reasoning.** The translator's float model (`emit/semantics_tests.rs` header) is IEEE mode off, 32-bit denormals flushed, 16- and 64-bit denormals kept. So f16 output denormals are enabled, and the hardware ignores OMOD on an f16 result: the result is as if OMOD were 0. CLAMP is a separate field and still applies. If a title's program ran with f16 denormals flushed, OMOD would apply. The translator assumes the fixed mode, as it does for the rest of the float model. **What changed (de177bd3).** f16 VALU results (`float_result`, including the exactly rounded `v_fma_f16` path) now translate with OMOD ignored: no multiply, clamp in f32, one rounding to half. On main these programs are refused; the earlier PR head applied the modifier. The test is now `f16_results_ignore_their_output_modifier`. Its `div:2` + clamp case tells the two readings apart (1.0 if OMOD is ignored, 0.875 if it applies). It passes on the hardware adapter and WARP. **`half_modifiers` (`v_interp_p2_f16`).** On main it applied OMOD to the f16 interpolation result. No hardware-sourced test pins that: the semantics probes that use output modifiers are all f32 operations, and `interpolated_f16_writes_the_op_sel_half_with_modifiers` is a DXIL-structure check from an audit. So I changed it the same way (clamp only), and that test now asserts there is no ×2 in the DXIL. I haven't counted how many of the title's programs this unblocks. I can't run the title.
Author
Owner

@⁠Lyrnc on GitHub · 2026-11-26 18:52 UTC · original

The RDNA2 hardware check this PR's "Not tested" asks for, on gfx1036: with f16 denormals kept, f16 results ignore the output modifier, and clamp still applies. The PR matches the hardware on every row below, on an AMD and an NVIDIA host.

Setup.

  • Hardware: the Radeon iGPU of a Ryzen 7 9800X3D, gfx1036, AMD driver 32.0.21042.62, Windows 11. A HIP kernel (assembled by the driver's amd_comgr) runs the raw VOP3 words, one row per lane.
  • Forms (16): v_add_f16, v_mul_f16 and v_fma_f16 with mul:2, mul:4 and div:2; v_add_f16 div:2 clamp; v_mul_f16 mul:2 clamp; v_cvt_f16_f32 with mul:2 and div:2; and the three plain operations.
  • Inputs: 132 rows: f16 edges (±0, denormals, 0x0400, ±1, 1.5, 0.25, 0x7bff, ±inf, NaNs) against 1.0, -0 or themselves; some f32 values for the conversion; random halves.
  • Modes: IEEE off, f32 denormals flushed, f16 denormals kept, which is the translator's model. As controls: f16 denormals flushed; IEEE on; and IEEE on with f16 denormals flushed.
  • Translator: the same words through build_valu_cs, on that Radeon and on an RTX 5080 (driver 610.88), one adapter at a time with a local switch.

PC RDNA2 silicon, not the console's GPU. No game data.

gfx1036, low halves:

mode mul:2 / mul:4 / div:2 on add, mul, fma clamp v_cvt_f16_f32 mul:2 of 1.5
f16 denormals kept (the model) ignored: 132/132 rows equal the plain result, all 9 forms applies: div:2 clamp of 1.0 + 1.0 is 0x3c00 0x3e00 (1.5)
IEEE on, f16 denormals kept ignored, 132/132
IEEE on, f16 denormals flushed ignored, 132/132 0x3e00
f16 denormals flushed applied: 1.0 + 1.0 gives 0x4400 with mul:2, 0x3c00 with div:2 0x4200 (3.0)

So the rule in §6.2.2 holds for f16 results, v_cvt_f16_f32 included: the output modifier applies only with IEEE off and f16 denormals flushed. The high half of D is written as 0 in every case.

Translator, rows that differ (of 132), the same on the Radeon and the 5080:

tree the 13 forms with an output modifier plain forms
main 63bcca4 refused ("an output modifier on a 16-bit operation") 0
this PR (de177bd) 0 0

NaN payloads aside, which differ the same way in the plain forms: the hardware keeps a signalling NaN (0x7c01 + 1.0 = 0x7c01), while the Radeon host quiets it (0x7e01) and the 5080 writes 0x7fff. I ran the PR on a local merge with #1327 and #3124, which touch other code.

For the mode reading the triage asks for, the hardware gives three cases. With f16 denormals kept, the modifier is ignored (this PR). With them flushed and IEEE off, it applies (the earlier head's code). With IEEE on, it is ignored whatever the denormal mode, so the IEEE bit of RSRC1 matters as well as FLOAT_MODE[7:6].

AI use: Claude Code (Claude Opus 5.5) wrote the probe and ran it on the GPUs above; the numbers come from those runs.

**@⁠Lyrnc** on GitHub · 2026-11-26 18:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2915#issuecomment-7200951744) The RDNA2 hardware check this PR's "Not tested" asks for, on gfx1036: with f16 denormals kept, f16 results **ignore** the output modifier, and `clamp` still applies. The PR matches the hardware on every row below, on an AMD and an NVIDIA host. **Setup.** - **Hardware:** the Radeon iGPU of a Ryzen 7 9800X3D, **gfx1036**, AMD driver 32.0.21042.62, Windows 11. A HIP kernel (assembled by the driver's amd_comgr) runs the raw VOP3 words, one row per lane. - **Forms (16):** `v_add_f16`, `v_mul_f16` and `v_fma_f16` with `mul:2`, `mul:4` and `div:2`; `v_add_f16 div:2 clamp`; `v_mul_f16 mul:2 clamp`; `v_cvt_f16_f32` with `mul:2` and `div:2`; and the three plain operations. - **Inputs:** 132 rows: f16 edges (`±0`, denormals, `0x0400`, `±1`, `1.5`, `0.25`, `0x7bff`, `±inf`, NaNs) against `1.0`, `-0` or themselves; some f32 values for the conversion; random halves. - **Modes:** IEEE off, f32 denormals flushed, f16 denormals kept, which is the translator's model. As controls: f16 denormals flushed; IEEE on; and IEEE on with f16 denormals flushed. - **Translator:** the same words through `build_valu_cs`, on that Radeon and on an RTX 5080 (driver 610.88), one adapter at a time with a local switch. PC RDNA2 silicon, not the console's GPU. No game data. **gfx1036, low halves:** | mode | `mul:2` / `mul:4` / `div:2` on add, mul, fma | `clamp` | `v_cvt_f16_f32` `mul:2` of 1.5 | |---|---|---|---| | f16 denormals kept (the model) | **ignored**: 132/132 rows equal the plain result, all 9 forms | applies: `div:2 clamp` of `1.0 + 1.0` is `0x3c00` | `0x3e00` (1.5) | | IEEE on, f16 denormals kept | ignored, 132/132 | | | | IEEE on, f16 denormals flushed | ignored, 132/132 | | `0x3e00` | | f16 denormals flushed | applied: `1.0 + 1.0` gives `0x4400` with `mul:2`, `0x3c00` with `div:2` | | `0x4200` (3.0) | So the rule in §6.2.2 holds for f16 results, `v_cvt_f16_f32` included: the output modifier applies only with IEEE off **and** f16 denormals flushed. The high half of D is written as 0 in every case. **Translator, rows that differ (of 132), the same on the Radeon and the 5080:** | tree | the 13 forms with an output modifier | plain forms | |---|---|---| | `main` `63bcca4` | refused ("an output modifier on a 16-bit operation") | 0 | | this PR (`de177bd`) | **0** | 0 | NaN payloads aside, which differ the same way in the plain forms: the hardware keeps a signalling NaN (`0x7c01 + 1.0 = 0x7c01`), while the Radeon host quiets it (`0x7e01`) and the 5080 writes `0x7fff`. I ran the PR on a local merge with #1327 and #3124, which touch other code. For the mode reading the triage asks for, the hardware gives three cases. With f16 denormals kept, the modifier is ignored (this PR). With them flushed and IEEE off, it applies (the earlier head's code). With IEEE on, it is ignored whatever the denormal mode, so the IEEE bit of RSRC1 matters as well as FLOAT_MODE[7:6]. AI use: Claude Code (Claude Opus 5.5) wrote the probe and ran it on the GPUs above; the numbers come from those runs.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2915/head:github-bot/gh-2915'
git switch 'github-bot/gh-2915'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2915'
git switch 'github-bot/gh-2915'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2915'
git switch 'github-bot/gh-2915'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2915'
git switch 'main'
git merge --squash 'github-bot/gh-2915'
git switch 'main'
git merge --ff-only 'github-bot/gh-2915'
git switch 'main'
git merge 'github-bot/gh-2915'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2915
No description provided.