shader: lower compute v_cvt_pk_u8_f32 #1585

Merged
Asimmimx merged 1 commit from upstream-pr/1592 into main 2026-11-24 17:43:05 +00:00
Asimmimx commented 2026-11-24 14:39:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T14:39:53Z.


Change

Refs #1546. This lowers v_cvt_pk_u8_f32 (VOP3A opcode 350) in the compute translator (tools/compute_store_aot.py), for a restricted set of source values.

Semantics. The RDNA 1.0 and RDNA 2 ISA guides give:

D.u = (S2.u & ~(0xff << (8 * S1.u[1:0])));
D.u = D.u | ((flt32_to_uint8(S0.f) & 0xff) << (8 * S1.u[1:0]))

The byte select and the merge are fully specified. flt32_to_uint8 is never defined: the guides state no rounding mode, no clamping, and no result for negative or NaN inputs. AMD's machine-readable ISA XML only says "convert … to an unsigned 8-bit integer". docs/experiments.md already notes, for the pixel profile, that no public source states this.

Restriction. The lowering therefore covers only an S0 that is +0.0 or an integer in [1, 255]. For those values, truncation, every rounding mode and any clamp all give the same byte.

  • A constant S0 outside that set is refused.
  • A word read from memory cannot be checked statically, so the caller must keep it inside the set. This is the same rule the binary32 subset applies to finite, normal operands.

HLSL.

((S2 & ~(0xffu << ((S1 & 3u) << 3u))) | ((uint(asfloat(S0)) & 0xffu) << ((S1 & 3u) << 3u)))

The template is a new CVT_PK_U8 dict, placed after FLOAT_INLINE. The new elif sits before the v_lshl_add_u32 v, v, n, v branch. S0 goes through float_word plus the integer-range check; S1 and S2 go through alu_word.

Fixture. The fixture and controls are in a new tests/compute_alu_cvt_pk_u8_check.py. It imports the helpers of tests/compute_store_check.py, which is unchanged.

  • It builds x = float(w & 0xff) and y = float((w >> 16) & 0xff) exactly, as (2^23 + k) − 2^23, with v_or_b32 and v_subrev_f32.
  • It stores cvt_pk(y, 3, cvt_pk(x, w >> 8, cap)) ^ cvt_pk(0, 1, cvt_pk(1.0, 0, cvt_pk(255.0, 2, w))), with cap = params[0].y = 0xa5c3e17b.
  • The select w >> 8 keeps bits above [1:0]. Across 150 lanes all four byte positions occur, and both 0 and 255 reach the conversion from memory.

The expected words come from a separate Python model of the ISA pseudocode. Four lanes are worked by hand: lane 0 0x893ce17a, lane 4 0x994ae17a, lane 7 0x943cc87a, lane 10 0xa03ce1da.

The draw must reject:

  • four wrong references, each at its first differing word: byte order reversed, S2 not cleared, the float bits taken as the value, and select bit 0 dropped;
  • changed sentinels;
  • seven mutated HLSL templates, each with "Compute readback differs".

Controls. These are refused with "Unsupported compute instruction":

  • the -v3, |v3|, -|v3|, clamp and mul:2 forms;
  • the _e64 spelling and v[5:6];
  • v_cvt_pknorm_u16_f32.

These are refused with "Unverified ALU operand":

  • constant S0 values 0.5, 1.5, −1.0, −0.0, 256.0, +inf, NaN, −1, 5, 0x00000001 and 0x1ffffffff;
  • unknown, descriptor, saved-exec and pending sources;
  • a v256 destination.

The existing messages also cover a dropped vmcnt wait, address and guard misuse, and a chain that is too long.

The new CTest is compute_store_aot_alu_cvt_pk_u8_${adapter}, registered after compute_store_aot_mimg_load. A "Guarded float-to-byte insert" subsection is added to docs/experiments.md.

Verification

Commit 6c0e5380 (main) plus this change, dev preset, Windows 11 Pro build 26300.9974, DXC 1.8.2502.11.

python -B tests/compute_alu_cvt_pk_u8_check.py controls                                  # pass
python -B tests/compute_alu_cvt_pk_u8_check.py draw <dxc> <offscreen_check.exe> warp     # pass
python -B tests/compute_alu_cvt_pk_u8_check.py draw <dxc> <offscreen_check.exe> hardware # pass
ctest --preset dev --no-tests=error -R '^compute_store_aot_alu_cvt_pk_u8_(warp|hardware)$' -V
Backend Result
WARP 10.0.26100.9818, debug layer enabled 3 runs, 320 words each, mismatches 0, debug errors 0
AMD Radeon RX 6600 (RDNA 2, 1002:73ff), driver 32.0.21045.29003, debug layer enabled 3 runs, 320 words each, mismatches 0, debug errors 0

These also pass with the change:

  • the compute_store_check translator controls and its compile-mimg-atomic-* modes;
  • draw-guard-read and draw-f32 on WARP;
  • tests/docs_links_check.py, tests/bidi_controls_check.py, tests/form_coverage_check.py and git diff --check.

Open points

  • Unknown console behaviour. What the console returns for fractional, negative, too-large or NaN inputs is still unknown, which is why the lowering refuses them. tools/ffx_dispatch_aot.py assumes round-to-nearest with a [0, 255] clamp, but I found no source that confirms it.
  • Zero result. The fixture's f32_sub returns exactly +0.0 for one y lane. That is exact under the round-to-nearest-even the profile already assumes, but it stretches the subset's "finite and normal" wording to cover zero.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6584301605 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1592). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-24T14:39:53Z. --- ## Change Refs #1546. This lowers `v_cvt_pk_u8_f32` (VOP3A opcode 350) in the compute translator (`tools/compute_store_aot.py`), for a restricted set of source values. **Semantics.** The RDNA 1.0 and RDNA 2 ISA guides give: ``` D.u = (S2.u & ~(0xff << (8 * S1.u[1:0]))); D.u = D.u | ((flt32_to_uint8(S0.f) & 0xff) << (8 * S1.u[1:0])) ``` The byte select and the merge are fully specified. `flt32_to_uint8` is never defined: the guides state no rounding mode, no clamping, and no result for negative or NaN inputs. AMD's machine-readable ISA XML only says "convert … to an unsigned 8-bit integer". `docs/experiments.md` already notes, for the pixel profile, that no public source states this. **Restriction.** The lowering therefore covers only an S0 that is +0.0 or an integer in [1, 255]. For those values, truncation, every rounding mode and any clamp all give the same byte. - A constant S0 outside that set is refused. - A word read from memory cannot be checked statically, so the caller must keep it inside the set. This is the same rule the binary32 subset applies to finite, normal operands. **HLSL.** ``` ((S2 & ~(0xffu << ((S1 & 3u) << 3u))) | ((uint(asfloat(S0)) & 0xffu) << ((S1 & 3u) << 3u))) ``` The template is a new `CVT_PK_U8` dict, placed after `FLOAT_INLINE`. The new `elif` sits before the `v_lshl_add_u32 v, v, n, v` branch. S0 goes through `float_word` plus the integer-range check; S1 and S2 go through `alu_word`. **Fixture.** The fixture and controls are in a new `tests/compute_alu_cvt_pk_u8_check.py`. It imports the helpers of `tests/compute_store_check.py`, which is unchanged. - It builds x = float(w & 0xff) and y = float((w >> 16) & 0xff) exactly, as (2^23 + k) − 2^23, with `v_or_b32` and `v_subrev_f32`. - It stores `cvt_pk(y, 3, cvt_pk(x, w >> 8, cap)) ^ cvt_pk(0, 1, cvt_pk(1.0, 0, cvt_pk(255.0, 2, w)))`, with cap = `params[0].y` = 0xa5c3e17b. - The select `w >> 8` keeps bits above [1:0]. Across 150 lanes all four byte positions occur, and both 0 and 255 reach the conversion from memory. The expected words come from a separate Python model of the ISA pseudocode. Four lanes are worked by hand: lane 0 `0x893ce17a`, lane 4 `0x994ae17a`, lane 7 `0x943cc87a`, lane 10 `0xa03ce1da`. The draw must reject: - four wrong references, each at its first differing word: byte order reversed, S2 not cleared, the float bits taken as the value, and select bit 0 dropped; - changed sentinels; - seven mutated HLSL templates, each with "Compute readback differs". **Controls.** These are refused with "Unsupported compute instruction": - the `-v3`, `|v3|`, `-|v3|`, `clamp` and `mul:2` forms; - the `_e64` spelling and `v[5:6]`; - `v_cvt_pknorm_u16_f32`. These are refused with "Unverified ALU operand": - constant S0 values 0.5, 1.5, −1.0, −0.0, 256.0, +inf, NaN, −1, 5, 0x00000001 and 0x1ffffffff; - unknown, descriptor, saved-exec and pending sources; - a `v256` destination. The existing messages also cover a dropped vmcnt wait, address and guard misuse, and a chain that is too long. The new CTest is `compute_store_aot_alu_cvt_pk_u8_${adapter}`, registered after `compute_store_aot_mimg_load`. A "Guarded float-to-byte insert" subsection is added to `docs/experiments.md`. ## Verification Commit `6c0e5380` (`main`) plus this change, `dev` preset, Windows 11 Pro build 26300.9974, DXC 1.8.2502.11. ```powershell python -B tests/compute_alu_cvt_pk_u8_check.py controls # pass python -B tests/compute_alu_cvt_pk_u8_check.py draw <dxc> <offscreen_check.exe> warp # pass python -B tests/compute_alu_cvt_pk_u8_check.py draw <dxc> <offscreen_check.exe> hardware # pass ctest --preset dev --no-tests=error -R '^compute_store_aot_alu_cvt_pk_u8_(warp|hardware)$' -V ``` | Backend | Result | |---|---| | WARP 10.0.26100.9818, debug layer enabled | 3 runs, 320 words each, mismatches 0, debug errors 0 | | AMD Radeon RX 6600 (RDNA 2, `1002:73ff`), driver 32.0.21045.29003, debug layer enabled | 3 runs, 320 words each, mismatches 0, debug errors 0 | These also pass with the change: - the `compute_store_check` translator controls and its `compile-mimg-atomic-*` modes; - `draw-guard-read` and `draw-f32` on WARP; - `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `tests/form_coverage_check.py` and `git diff --check`. ## Open points - **Unknown console behaviour.** What the console returns for fractional, negative, too-large or NaN inputs is still unknown, which is why the lowering refuses them. `tools/ffx_dispatch_aot.py` assumes round-to-nearest with a [0, 255] clamp, but I found no source that confirms it. - **Zero result.** The fixture's `f32_sub` returns exactly +0.0 for one y lane. That is exact under the round-to-nearest-even the profile already assumes, but it stretches the subset's "finite and normal" wording to cover zero. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code).
tedin7 commented 2026-11-24 15:02:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:01:29Z.

Review: COMMENTED


Reviewed da4d5d7d (tools/compute_store_aot.py, tests/compute_alu_cvt_pk_u8_check.py, CMakeLists.txt, docs/experiments.md).

Findings

  • No blocking defects found.
  • CVT_PK_U8 matches the RDNA 1.0 / RDNA 2 v_cvt_pk_u8_f32 byte-insert pseudocode D = (S2 & ~(0xff << 8 * S1[1:0])) | ((flt32_to_uint8(S0) & 0xff) << 8 * S1[1:0]) on the agreed domain (+0.0 and integers in [1, 255]), where rounding/clamp differences do not apply.
  • Constant S0 outside {+0.0} ∪ [1, 255] ∩ ℤ (fractional, negative, -0.0, >= 256.0, Inf/NaN, nonzero inline integers, >32-bit literals), unwaited/unknown/descriptor/exec sources, v256+, input/output modifiers, _e64, and register ranges are all rejected, and results remain data-only.
  • Minor note (non-blocking): compute_store_aot_alu_cvt_pk_u8_${adapter} in CMakeLists.txt does not set FORM_COVERAGE_RECORD, unlike sibling compute_store_aot_* tests.

Verification

  • Linux:
    • python3 tests/compute_alu_cvt_pk_u8_check.py controls: passed.
    • llvm-mc-19 -arch=amdgcn -mcpu=gfx1013 -show-encoding on the fixture's v_cvt_pk_u8_f32 forms: passed.
    • python3 tests/docs_links_check.py: passed (16 Markdown files, 344 links).
    • python3 tests/bidi_controls_check.py: passed (1253 tracked files).
  • Windows WARP (OS build 26100, MSVC 14.44.35207, Debug & Release /O2):
    • ctest --preset dev on the 41 offscreen_check / compute_*_warp tests (including compute_store_aot_alu_cvt_pk_u8_warp): 41/41 passed (58.19s).
    • ctest --preset release on the same 41 tests: 41/41 passed.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6041701700 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1592#pullrequestreview-6041701700). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T15:01:29Z. **Review:** COMMENTED --- Reviewed `da4d5d7d` (`tools/compute_store_aot.py`, `tests/compute_alu_cvt_pk_u8_check.py`, `CMakeLists.txt`, `docs/experiments.md`). ### Findings - No blocking defects found. - `CVT_PK_U8` matches the RDNA 1.0 / RDNA 2 `v_cvt_pk_u8_f32` byte-insert pseudocode `D = (S2 & ~(0xff << 8 * S1[1:0])) | ((flt32_to_uint8(S0) & 0xff) << 8 * S1[1:0])` on the agreed domain (`+0.0` and integers in `[1, 255]`), where rounding/clamp differences do not apply. - Constant `S0` outside `{+0.0} ∪ [1, 255] ∩ ℤ` (fractional, negative, `-0.0`, `>= 256.0`, Inf/NaN, nonzero inline integers, >32-bit literals), unwaited/unknown/descriptor/exec sources, `v256+`, input/output modifiers, `_e64`, and register ranges are all rejected, and results remain data-only. - Minor note (non-blocking): `compute_store_aot_alu_cvt_pk_u8_${adapter}` in `CMakeLists.txt` does not set `FORM_COVERAGE_RECORD`, unlike sibling `compute_store_aot_*` tests. ### Verification - Linux: - `python3 tests/compute_alu_cvt_pk_u8_check.py controls`: passed. - `llvm-mc-19 -arch=amdgcn -mcpu=gfx1013 -show-encoding` on the fixture's `v_cvt_pk_u8_f32` forms: passed. - `python3 tests/docs_links_check.py`: passed (16 Markdown files, 344 links). - `python3 tests/bidi_controls_check.py`: passed (1253 tracked files). - Windows WARP (OS build 26100, MSVC 14.44.35207, Debug & Release `/O2`): - `ctest --preset dev` on the 41 `offscreen_check` / `compute_*_warp` tests (including `compute_store_aot_alu_cvt_pk_u8_warp`): 41/41 passed (`58.19s`). - `ctest --preset release` on the same 41 tests: 41/41 passed. AI-assisted; commands listed were executed locally.
Jess-Doit commented 2026-11-24 17:01:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T16:46:15Z.

Review: COMMENTED


Hardware check on NVIDIA, which adds a data point to the RX 6600 and WARP runs. Nothing below is a code change.

Tested: da4d5d7d merged onto main c864f138. docs/experiments.md conflicts with main (see the end of this review). For the build I kept this PR's version of that file; no code conflicted.

Environment:

  • Windows 10 22H2, build 19045.6456; Windows SDK 10.0.26100.0 DXC; D3D12 debug layer enabled.
  • Hardware: NVIDIA GeForce GTX 1060 6GB (10de:1c03), driver 32.0.15.6094 (Pascal).
  • WARP: in-box, 1414:008c.

Ran:

  • python -B tests/compute_alu_cvt_pk_u8_check.py controls: passed.
  • ctest --preset {dev,release} --no-tests=error -R '^compute_store_aot_(alu_cvt_pk_u8_(warp|hardware)|warp|hardware)$' -V: 4/4 in Debug and 4/4 in Release. Every dispatch read compared_words=320 mismatches=0 with debug_errors=0 debug_warnings=0, on the 1060 and on WARP.
  • The draw's assertions also passed on the 1060:
    • the four wrong references (order, clear, bits, select);
    • the sentinel change;
    • the seven template mutations.
      So each one changed the readback there, and uint(asfloat(S0)) gives the exact byte for +0.0 and the integers 1–255 on this driver.

Reading of the lowering:

  • The constant-S0 check accepts exactly 0 and the bit patterns 0x3f800000–0x437f0000 whose value is an integer, which is +0.0 and 1.0–255.0.
  • S1 and S2 go through alu_word, and the select is masked to [1:0] before the shift, as the ISA pseudocode does.
  • No defects found.
  • I agree with the earlier note that compute_store_aot_alu_cvt_pk_u8_${adapter} has no FORM_COVERAGE_RECORD, unlike the sibling tests (#1591 sets it).

Merge conflict: docs/experiments.md currently conflicts with main, next to the new "Guarded float-to-byte insert" section. It needs a rebase or merge before this can land.

AI-assisted (Claude Code); the commands listed were run locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6043530792 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1592#pullrequestreview-6043530792). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-24T16:46:15Z. **Review:** COMMENTED --- Hardware check on NVIDIA, which adds a data point to the RX 6600 and WARP runs. Nothing below is a code change. **Tested:** `da4d5d7d` merged onto main `c864f138`. `docs/experiments.md` conflicts with main (see the end of this review). For the build I kept this PR's version of that file; no code conflicted. **Environment:** - Windows 10 22H2, build 19045.6456; Windows SDK 10.0.26100.0 DXC; D3D12 debug layer enabled. - Hardware: NVIDIA GeForce GTX 1060 6GB (`10de:1c03`), driver 32.0.15.6094 (Pascal). - WARP: in-box, `1414:008c`. **Ran:** - `python -B tests/compute_alu_cvt_pk_u8_check.py controls`: passed. - `ctest --preset {dev,release} --no-tests=error -R '^compute_store_aot_(alu_cvt_pk_u8_(warp|hardware)|warp|hardware)$' -V`: 4/4 in Debug and 4/4 in Release. Every dispatch read `compared_words=320 mismatches=0` with `debug_errors=0 debug_warnings=0`, on the 1060 and on WARP. - The draw's assertions also passed on the 1060: - the four wrong references (order, clear, bits, select); - the sentinel change; - the seven template mutations. So each one changed the readback there, and `uint(asfloat(S0))` gives the exact byte for +0.0 and the integers 1–255 on this driver. **Reading of the lowering:** - The constant-S0 check accepts exactly `0` and the bit patterns `0x3f800000`–`0x437f0000` whose value is an integer, which is +0.0 and 1.0–255.0. - S1 and S2 go through `alu_word`, and the select is masked to `[1:0]` before the shift, as the ISA pseudocode does. - No defects found. - I agree with the earlier note that `compute_store_aot_alu_cvt_pk_u8_${adapter}` has no `FORM_COVERAGE_RECORD`, unlike the sibling tests (#1591 sets it). **Merge conflict:** `docs/experiments.md` currently conflicts with main, next to the new "Guarded float-to-byte insert" section. It needs a rebase or merge before this can land. AI-assisted (Claude Code); the commands listed were run locally.
upstream-sync closed this pull request 2026-11-24 18:02:17 +00:00
tedin7 commented 2026-11-24 18:02:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:08:25Z.

Review: COMMENTED


Re-review at head_sha: d03f2264dbad398a0697aacd76fec67f25e9e18d (previously reviewed at da4d5d7d).

Findings

No P1/P2. No defect found.

  • The new head is a rebase onto a newer main. I compared the patch of the old commit with the patch of this one (git range-diff, and a diff of the added and removed lines): the PR's own content is unchanged. Even the changed lines are the same; only the surrounding context differs.
  • git merge-tree of the head against current main (80f413a7 at the time) reports no conflicts (tree bfcb62d4).

Verified

Limits: Linux x86-64 only. I did not rerun the Windows WARP/hardware ctest for this head (no Windows runner in this pass), so the draw mode is covered only by the unchanged patch content and the earlier Windows results on the previous head.

  • python3 -B tests/compute_alu_cvt_pk_u8_check.py controls -> exit 0.
  • llvm-mc-19 -triple=amdgcn-amd-amdhsa -mcpu=gfx1013 -show-encoding assembles v_cvt_pk_u8_f32 v1, v2, v3, v4 and v_cvt_pk_u8_f32 v1, 1.0, 2, v4.
  • python3 -B tests/docs_links_check.py -> 16 files, 351 links OK. git diff --check HEAD^ HEAD clean.
  • Mutation: changed the first byte-lane shift << 3u to << 2u in the CVT_PK_U8 template; controls fails with an AssertionError (exit 1). Restored with git checkout -- .; git status --short clean.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6043877120 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1592#pullrequestreview-6043877120). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:08:25Z. **Review:** COMMENTED --- Re-review at `head_sha`: `d03f2264dbad398a0697aacd76fec67f25e9e18d` (previously reviewed at `da4d5d7d`). ### Findings No P1/P2. No defect found. - The new head is a rebase onto a newer `main`. I compared the patch of the old commit with the patch of this one (`git range-diff`, and a diff of the added and removed lines): the PR's own content is unchanged. Even the changed lines are the same; only the surrounding context differs. - `git merge-tree` of the head against current `main` (`80f413a7` at the time) reports no conflicts (tree `bfcb62d4`). ### Verified Limits: Linux x86-64 only. I did not rerun the Windows WARP/hardware `ctest` for this head (no Windows runner in this pass), so the `draw` mode is covered only by the unchanged patch content and the earlier Windows results on the previous head. - `python3 -B tests/compute_alu_cvt_pk_u8_check.py controls` -> exit 0. - `llvm-mc-19 -triple=amdgcn-amd-amdhsa -mcpu=gfx1013 -show-encoding` assembles `v_cvt_pk_u8_f32 v1, v2, v3, v4` and `v_cvt_pk_u8_f32 v1, 1.0, 2, v4`. - `python3 -B tests/docs_links_check.py` -> 16 files, 351 links OK. `git diff --check HEAD^ HEAD` clean. - **Mutation:** changed the first byte-lane shift `<< 3u` to `<< 2u` in the `CVT_PK_U8` template; `controls` fails with an `AssertionError` (exit 1). Restored with `git checkout -- .`; `git status --short` clean. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 18:02:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:42:47Z.

Review: COMMENTED


Verified at head_sha: d03f2264dbad398a0697aacd76fec67f25e9e18d (0 P1, 0 P2).

Scope & Semantics

  • Touches only tools/compute_store_aot.py, tests/compute_alu_cvt_pk_u8_check.py, CMakeLists.txt (test-only compute_store_aot_alu_cvt_pk_u8_{hardware,warp}), and docs/experiments.md.
  • v_cvt_pk_u8_f32 (((S2 & ~(0xffu << ((S1 & 3u) << 3u))) | ((uint(asfloat(S0)) & 0xffu) << ((S1 & 3u) << 3u)))) matches AMD RDNA 1.0/2 ISA VOP3A opcode 350 on the agreed exact domain (+0.0 or integer in [1, 255]), with static constant S0 checked strictly (0 or 0x3f800000..0x437f0000 with is_integer()), refusing -0.0, fractions, negatives, >= 256.0, infinities, NaNs, subnormals, modifiers, and _e64.

Verified

  • Linux:
    • git diff --check origin/main...HEAD -> clean
    • python3 tests/docs_links_check.py -> passed (16 Markdown files, 351 links)
    • python3 tests/bidi_controls_check.py -> passed (1280 tracked files)
    • python3 tests/compute_alu_cvt_pk_u8_check.py controls -> passed
    • llvm-mc-19 -triple=amdgcn-amd-amdhsa -mcpu=gfx1013 -show-encoding: v_cvt_pk_u8_f32 v1, v2, v3, v4 (01 00 5e d5 02 07 12 04)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): offscreen_check built (3.37s), ctest --preset dev -R 'compute_store_aot_alu_cvt_pk_u8' 2/2 passed (4.53s: compute_store_aot_alu_cvt_pk_u8_warp, compute_store_aot_alu_cvt_pk_u8_hardware)
    • Release /O2 (--preset release): offscreen_check built (1.09s), ctest --preset release -R 'compute_store_aot_alu_cvt_pk_u8' 2/2 passed (4.34s)
  • Mutation checks (local, reverted cleanly):
    • Changed byte-select mask & 3u to & 2u in CVT_PK_U8 in tools/compute_store_aot.py -> compute_alu_cvt_pk_u8_check.py controls failed as expected.
    • Widened constant upper bound 0x437f0000 (255.0) to 0x43800000 (256.0) in tools/compute_store_aot.py -> compute_alu_cvt_pk_u8_check.py controls failed as expected (256.0 no longer rejected).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044389985 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1592#pullrequestreview-6044389985). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:42:47Z. **Review:** COMMENTED --- Verified at `head_sha`: `d03f2264dbad398a0697aacd76fec67f25e9e18d` (0 P1, 0 P2). ### Scope & Semantics - Touches only `tools/compute_store_aot.py`, `tests/compute_alu_cvt_pk_u8_check.py`, `CMakeLists.txt` (test-only `compute_store_aot_alu_cvt_pk_u8_{hardware,warp}`), and `docs/experiments.md`. - `v_cvt_pk_u8_f32` (`((S2 & ~(0xffu << ((S1 & 3u) << 3u))) | ((uint(asfloat(S0)) & 0xffu) << ((S1 & 3u) << 3u)))`) matches AMD RDNA 1.0/2 ISA VOP3A opcode 350 on the agreed exact domain (`+0.0` or integer in `[1, 255]`), with static constant S0 checked strictly (`0` or `0x3f800000..0x437f0000` with `is_integer()`), refusing `-0.0`, fractions, negatives, `>= 256.0`, infinities, NaNs, subnormals, modifiers, and `_e64`. ### Verified - **Linux**: - `git diff --check origin/main...HEAD` -> clean - `python3 tests/docs_links_check.py` -> passed (16 Markdown files, 351 links) - `python3 tests/bidi_controls_check.py` -> passed (1280 tracked files) - `python3 tests/compute_alu_cvt_pk_u8_check.py controls` -> passed - `llvm-mc-19 -triple=amdgcn-amd-amdhsa -mcpu=gfx1013 -show-encoding`: `v_cvt_pk_u8_f32 v1, v2, v3, v4` (`01 00 5e d5 02 07 12 04`) - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: `offscreen_check` built (`3.37s`), `ctest --preset dev -R 'compute_store_aot_alu_cvt_pk_u8'` **2/2 passed** (`4.53s`: `compute_store_aot_alu_cvt_pk_u8_warp`, `compute_store_aot_alu_cvt_pk_u8_hardware`) - **Release `/O2` (`--preset release`)**: `offscreen_check` built (`1.09s`), `ctest --preset release -R 'compute_store_aot_alu_cvt_pk_u8'` **2/2 passed** (`4.34s`) - **Mutation checks** (local, reverted cleanly): - Changed byte-select mask `& 3u` to `& 2u` in `CVT_PK_U8` in `tools/compute_store_aot.py` -> `compute_alu_cvt_pk_u8_check.py controls` failed as expected. - Widened constant upper bound `0x437f0000` (255.0) to `0x43800000` (256.0) in `tools/compute_store_aot.py` -> `compute_alu_cvt_pk_u8_check.py controls` failed as expected (`256.0` no longer rejected). AI-assisted; commands listed were executed locally.
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
R0Y00/Xbox2Windows!1585
No description provided.