cpp-migration: direct-path v_add/sub/subrev/mul_f16 zero D[31:16], where gfx10 keeps it #3019

Open
opened 2026-11-27 05:37:07 +00:00 by archielcqp-a11y · 1 comment
archielcqp-a11y commented 2026-11-27 05:37:07 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by archielcqp-a11y on 2026-11-27T05:37:07Z.


Commit or build

cpp-migration 999e17cd

Reproduction

Target branch `cpp-migration`. Part of #2935. Refs #669, #2964.

`tests/native_f16_alu_check.py` (from #2964) puts `0xabcd` in the high half of every destination, then runs `v_add_f16`, `v_sub_f16`, `v_subrev_f16` and `v_mul_f16` in their VOP2 and VOP3 forms. Its model, IR interpreter and readback require the stored high half to be zero:


ctest --preset dev --no-tests=error -R '^native_f16_alu_' -V


The lowering in `src/gfx1013_direct_compute.inl` writes `and rounded, 65535` for the non-SDWA forms.

Expected behavior

D[15:0] = the binary16 result, and D[31:16] keeps its value (0xabcd here).

  • LLVM: GCNSubtarget::zeroesHigh16BitsOfDest lists exactly these four ops, V_ADD/SUB/SUBREV/MUL_F16 in _e32 and _e64, under "On gfx10, all 16-bit instructions preserve the high bits", and returns false from GFX10 on.
  • The same path: its v_cvt_f16_f32 already keeps the high half.
  • #669: recorded the same rule for the non-packed 16-bit integer ops, from an inline-assembly measurement on RDNA 2 silicon.

Observed behavior

D[31:16] is written as zero. The fixture accepts this, because its model and comparator require a zero high half, and one of its mutants rejects a kept high half.

#2964 says the zeroing matches RDNA 2 but gives no source. As far as I know, nobody has measured these four f16 ops on silicon; the RDNA 2 evidence above is LLVM's rule and the integer measurement.

@SimSalabimse, if you had a measurement behind the zeroing, please say so and I'll drop this.

Environment

Windows 10 build 19045, MSVC 19.44, SDK and DXC 10.0.26100.0, NVIDIA GeForce RTX 3080 (driver 32.0.15.9174), debug layer on. The readback needs shader model 6.6. I ran it with a local copy of native_store_replay linked with the app-local Agility SDK exports, because the inbox Windows 10 runtime reports a skip (77).

AI-assisted.

Checklist

  • I reproduced this on a source-built input.
  • I did not include game files, dumps, distribution links or credentials.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6640686088 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3019). Originally posted by [archielcqp-a11y](https://github.com/archielcqp-a11y) on 2026-11-27T05:37:07Z. --- ### Commit or build cpp-migration 999e17cd ### Reproduction ```shell Target branch `cpp-migration`. Part of #2935. Refs #669, #2964. `tests/native_f16_alu_check.py` (from #2964) puts `0xabcd` in the high half of every destination, then runs `v_add_f16`, `v_sub_f16`, `v_subrev_f16` and `v_mul_f16` in their VOP2 and VOP3 forms. Its model, IR interpreter and readback require the stored high half to be zero: ctest --preset dev --no-tests=error -R '^native_f16_alu_' -V The lowering in `src/gfx1013_direct_compute.inl` writes `and rounded, 65535` for the non-SDWA forms. ``` ### Expected behavior D[15:0] = the binary16 result, and D[31:16] keeps its value (`0xabcd` here). - **LLVM:** `GCNSubtarget::zeroesHigh16BitsOfDest` lists exactly these four ops, `V_ADD/SUB/SUBREV/MUL_F16` in `_e32` and `_e64`, under "On gfx10, all 16-bit instructions preserve the high bits", and returns false from GFX10 on. - **The same path:** its `v_cvt_f16_f32` already keeps the high half. - **#669:** recorded the same rule for the non-packed 16-bit integer ops, from an inline-assembly measurement on RDNA 2 silicon. ### Observed behavior D[31:16] is written as zero. The fixture accepts this, because its model and comparator require a zero high half, and one of its mutants rejects a kept high half. #2964 says the zeroing matches RDNA 2 but gives no source. As far as I know, nobody has measured these four f16 ops on silicon; the RDNA 2 evidence above is LLVM's rule and the integer measurement. @SimSalabimse, if you had a measurement behind the zeroing, please say so and I'll drop this. ### Environment Windows 10 build 19045, MSVC 19.44, SDK and DXC 10.0.26100.0, NVIDIA GeForce RTX 3080 (driver 32.0.15.9174), debug layer on. The readback needs shader model 6.6. I ran it with a local copy of `native_store_replay` linked with the app-local Agility SDK exports, because the inbox Windows 10 runtime reports a skip (77). AI-assisted. ### Checklist - [x] I reproduced this on a source-built input. - [x] I did not include game files, dumps, distribution links or credentials.
Leyukaka commented 2026-11-28 20:14:38 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T20:14:38Z.


#3020 (Fixes #3019 on cpp-migration) keeps D[31:16] for these four ops. It merged into cpp-migration, so this issue did not close on its own; its commit f6cdee10 is now on main 8ecd30fe (through #3039). Can it be closed?

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7245141780 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3019#issuecomment-7245141780). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-28T20:14:38Z. --- #3020 (`Fixes #3019 on cpp-migration`) keeps D[31:16] for these four ops. It merged into `cpp-migration`, so this issue did not close on its own; its commit `f6cdee10` is now on `main` `8ecd30fe` (through #3039). Can it be closed?
Sign in to join this conversation.
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
R0Y00/Xbox2Windows#3019
No description provided.