compute: admit SDWA profiles for lowered f16, frexp and conversion ops #3470

Merged
Ammmae0x merged 3 commits from upstream-pr/3470 into main 2026-11-30 02:37:18 +00:00
Ammmae0x commented 2026-11-29 16:22:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-29T16:22:17Z.


Refs #3224, #2935

Eliminates the unimplemented direct SDWA operand profile diagnostic (ranked #8 in the #3224 census at 24,469 dispatches) for 21 VOP1/VOP2 opcodes across 34 new SDWA test profiles (46 profiles in total, with the twelve from the earlier SDWA note), for operations whose base operations already have direct-compute lowering.

Admitted profiles

Class Profiles
Binary16 unary v_floor_f16, v_ceil_f16, v_trunc_f16, v_rndne_f16, v_fract_f16, v_frexp_mant_f16, v_frexp_exp_i16_f16
Binary16 conversion v_cvt_f16_u16, v_cvt_f16_i16, v_cvt_u16_f16, v_cvt_i16_f16, v_cvt_norm_i16_f16, v_cvt_norm_u16_f16
Binary16 binary v_max_f16, v_min_f16, v_ldexp_f16
Binary32 v_frexp_mant_f32, v_frexp_exp_i32_f32, v_cvt_flr_i32_f32, v_cvt_rpi_i32_f32, v_cvt_off_f32_i4

Rules

Validation is per operand, mirroring tools/disasm_rdna2.py (_vop1_sdwa_spec, _vop2_sdwa_spec):

  • A float source allows abs/neg and forbids sext; an integer source allows sext and forbids abs/neg. v_ldexp_f16 is the mixed case: src0 float16, src1 int16, dst float16.
  • A 16-bit destination only takes WORD_0/WORD_1 placement with PAD or PRESERVE; DWORD, byte and UNUSED_SEXT destinations are refused.
  • Integer destinations refuse omod (scale) and clamp; float destinations keep the per-op clamp rules the lowering already enforces.
  • A 16-bit source only takes a WORD_0/WORD_1/DWORD pick; byte picks and literal 255 are refused.
  • Every admitted handler applies SDWA source selection (sdwa_half, except v_ldexp_f16 src1 which reads subword(operand32), see below) and place_subword destination placement; no modifier or subword selection is silently ignored.

Still refused in SDWA: v_sin_f16/v_cos_f16 (no direct lowering), v_fmac_f32/v_fmac_f16 and the rest of VOP2_SDWA_UNSUPPORTED_OPS, 64-bit _f64/_b64 forms, and VOP3-only ops (v_fma_f16, v_min3_f16, v_med3_f16, v_cvt_pknorm_*). Graphics translation still refuses all of these SDWA forms.

v_max_f16, v_min_f16, v_floor_f16, v_ceil_f16, v_trunc_f16, v_rndne_f16, v_frexp_mant_f16 and v_frexp_exp_i16_f16 were missing from the binary16 MODE scan in src/gfx1013_direct_compute.inl, so a program using one of them together with an s_round_mode/s_denorm_mode write was refused as an unsupported control instruction instead of having the MODE write consumed under the keep-denorm contract. They are now listed there, matching v_fract_f16, v_ldexp_f16 and the conversion ops. A MODE write that moves the binary16 rounding or denormal bits is still refused.

Tests

  • tests/native_sdwa_profiles_check.py gains a second and third program (12, 28 and 6 slots, each under the 32-slot hardware layout) with an independent Python/ISA reference model, plus 15 refusal controls: disallowed VOP2 SDWA ops, float/int modifier violations, omod/clamp on integer destinations, invalid 16-bit destination selection and unused mode, a byte source pick, literal 255, and v_sin_f16.
  • tests/native_sdwa_f16_scalar_check.py gains admitted SDWA v_max_f16/v_min_f16 cases with SGPR sources and a MODE-write refusal.
  • Two obsolete refusals now carry the more specific diagnostic (tests/native_fract_f16_check.py, tests/native_cvt_norm_f16_check.py: the SDWA form is refused for its DWORD destination select, now that the op itself is admitted); both programs are still refused.
  • tests/native_sdwa_f16_check.py: the two obsolete max/min SDWA refusals are replaced with v_fmac_f32/v_fmac_f16, which stay refused.
  • Docs: new docs/experiments/direct-sdwa-profiles.md, a pointer section in docs/experiments.md, and the stale "SDWA min and max remain refused" line in docs/experiments/native-sdwa-f16.md corrected.

Note: this extends the existing native_sdwa_profiles suite rather than adding a native_compute_sdwa_profiles suite, so the WIN-VERIFY tag below names the real CTest names native_sdwa_profiles_(ir|dxil|hardware).

Review follow-ups (efb53ad0)

@Leyukaka's review of 9541306f (above), addressed in efb53ad0:

  • Docs: docs/experiments/direct-sdwa-profiles.md drops the Linux-verification section and records the verified 9541306f Windows baseline above, with the exact count of 21 opcodes across 34 new profiles.
  • v_frexp_*_f32 SDWA coverage: a WORD_1 source pick (the picked value is a subnormal, since only the high half of the f32 word is read) and a WORD destination with UNUSED_PRESERVE now pin subword() and place_subword() in that handler.
  • v_max_f16/v_min_f16: new cases with a non-canonical NaN payload (0x7C01, and 0x7C01 vs 0xFC01 where both are NaN) and with signed zeros (+0.0 vs -0.0). The model (sign-magnitude key; NaN yields the other operand, both NaN yield canonical 0x7E00; max(+0,-0)=+0, min(+0,-0)=-0) matches the lowering's emitted icmp/select IR exactly, and the signed-zero order matches IEEE maxNum/minNum.
  • v_ldexp_f16 inline float constant as src1: the SDWA path now reads subword(operand32) instead of sdwa_half, so inline 242 (1.0) reads its f32 pattern 0x3F800000 — delta 0 from WORD_0, delta 16256 clamped to 64 from WORD_1 — matching the plain path, which reads the low 16 bits of operand32. Register sources read the same word either way. Two cases pin this (WORD_0 gives 1.0, WORD_1 gives +inf; reading the binary16 pattern 0x3C00 would give +inf in both).
  • The stale "the lowering is the second gate" sentence in src/gfx1013_compute_native.cpp is removed; all listed ops now honour i.subword and place_subword.

Linux re-verification (efb53ad0)

Run on Linux against a throwaway harness build of native_compute_ir_dump/native_pixel_ir_dump (stub d3d12.h and root-signature deserializer only, never committed):

tests/native_sdwa_profiles_check.py ir: 46 profiles admitted; 15 malformed/unsupported controls and all graphics profiles refused
interpreted IR values for all 46 profiles match the independent model (frexp WORD_1 picks and WORD-dst PRESERVE placement, max/min non-canonical NaN and signed zeros, ldexp inline-constant src1)
tests/native_sdwa_f16_scalar_check.py ir: 7 results and 6 refusals
tests/native_f16_alu_check.py ir: 676 results match the model; 43 refusals carry the named diagnostic
tests/native_sdwa_f16_check.py ir: 46 results and 15 refusals
tests/native_fract_f16_check.py ir: 32 cases matched exact model; 10 refusals matched
tests/native_cvt_norm_f16_check.py ir: 30 cases matched exact model; 11 refusals matched
tests/native_frexp_f16_check.py ir: 22 results matched, inline floats read as binary16
form_coverage_check.py: form coverage checks passed
docs_links_check.py: Checked 176 Markdown files and 716 links
bidi_controls_check.py: Checked 2670 tracked source, script and build/CI files: no bidirectional controls
py_compile on the edited Python files: pass
git diff --check: clean

Five spot-mutations on /tmp copies of the sources, each killed:

  • Revert subword() in the v_frexp_*_f32 handler: interpreted values fail (mantissa 0x3F400000 vs 0x3F028000, exponent 4 vs -133).
  • Revert place_subword() in the v_frexp_*_f32 handler: interpreted values fail (mantissa 0x3F412345 vs 0x23451357, exponent 0x4 vs 0xA55A0004).
  • Revert v_ldexp_f16 src1 to sdwa_half: the dump refuses with unsupported SDWA binary16 inline constant selection (the WORD_1 inline pick).
  • Remove the max/min both-NaN canonicalization: interpreted values fail (min keeps the 0x7C01 payload instead of 0x7E00).
  • Drop the decoder's float-source sext refusal: the profiles ir run fails (the v_ldexp_f16 src0-sext refusal case is admitted).

Note: the ir mode checks admission, needles and refusals, not values, so it stays green under the first two reverts; the interpreted-IR value check over the same dumped IR (the Linux stand-in for the hardware run) is what fails on the new cases.

The follow-up edits above await a fresh Windows rerun on the new commit.

Windows Verification

Commit: efb53ad0c3ce3221a1945cd3255f2e4e30b74884
Adapter: NVIDIA GeForce RTX 4050 Laptop GPU (10de:28e1), driver 32.0.15.9186 (XBOX2WINDOWS_ADAPTER=NVIDIA)
Build (dev/release): cmake --build --preset <dev|release> --target compile_dxil native_compute_ir_dump native_pixel_ir_dump native_store_replay offscreen_check
dev primary: ctest --preset dev --no-tests=error -R '^native_sdwa_profiles_(ir|dxil|hardware)$' -V -j 1 -> 3/3 passed (4.34s; ir 1.44s, dxil 1.34s, hardware 1.38s; 46 profiles + 15 controls)
release primary: ctest --preset release --no-tests=error -R '^native_sdwa_profiles_(ir|dxil|hardware)$' --output-on-failure -j 1 -> 3/3 passed (3.34s; ir 0.95s, dxil 1.07s, hardware 1.17s)
SDWA/f16 regressions: ctest --preset <dev|release> --no-tests=error -R '^(native_cvt_norm_f16_.*|native_f16_alu_.*|native_fract_f16_.*|native_frexp_f16_.*|native_sdwa_f16_.*|native_sdwa_vcc_hi_hardware)$' --output-on-failure -j 4 -> dev 20/20 passed (10.60s), release 20/20 passed (9.96s)
Repo checks: form_coverage_check.py, docs_links_check.py (176 files, 716 links), bidi_controls_check.py (2670 files), py_compile, git diff --check -> passed

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5552658578 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3470). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-29T16:22:17Z. --- Refs #3224, #2935 Eliminates the `unimplemented direct SDWA operand profile` diagnostic (ranked #8 in the #3224 census at 24,469 dispatches) for 21 VOP1/VOP2 opcodes across 34 new SDWA test profiles (46 profiles in total, with the twelve from the earlier SDWA note), for operations whose base operations already have direct-compute lowering. ## Admitted profiles | Class | Profiles | |---|---| | Binary16 unary | `v_floor_f16`, `v_ceil_f16`, `v_trunc_f16`, `v_rndne_f16`, `v_fract_f16`, `v_frexp_mant_f16`, `v_frexp_exp_i16_f16` | | Binary16 conversion | `v_cvt_f16_u16`, `v_cvt_f16_i16`, `v_cvt_u16_f16`, `v_cvt_i16_f16`, `v_cvt_norm_i16_f16`, `v_cvt_norm_u16_f16` | | Binary16 binary | `v_max_f16`, `v_min_f16`, `v_ldexp_f16` | | Binary32 | `v_frexp_mant_f32`, `v_frexp_exp_i32_f32`, `v_cvt_flr_i32_f32`, `v_cvt_rpi_i32_f32`, `v_cvt_off_f32_i4` | ## Rules Validation is per operand, mirroring `tools/disasm_rdna2.py` (`_vop1_sdwa_spec`, `_vop2_sdwa_spec`): - A float source allows abs/neg and forbids sext; an integer source allows sext and forbids abs/neg. `v_ldexp_f16` is the mixed case: src0 float16, src1 int16, dst float16. - A 16-bit destination only takes WORD_0/WORD_1 placement with PAD or PRESERVE; DWORD, byte and UNUSED_SEXT destinations are refused. - Integer destinations refuse omod (scale) and clamp; float destinations keep the per-op clamp rules the lowering already enforces. - A 16-bit source only takes a WORD_0/WORD_1/DWORD pick; byte picks and literal 255 are refused. - Every admitted handler applies SDWA source selection (`sdwa_half`, except `v_ldexp_f16` src1 which reads `subword(operand32)`, see below) and `place_subword` destination placement; no modifier or subword selection is silently ignored. Still refused in SDWA: `v_sin_f16`/`v_cos_f16` (no direct lowering), `v_fmac_f32`/`v_fmac_f16` and the rest of `VOP2_SDWA_UNSUPPORTED_OPS`, 64-bit `_f64`/`_b64` forms, and VOP3-only ops (`v_fma_f16`, `v_min3_f16`, `v_med3_f16`, `v_cvt_pknorm_*`). Graphics translation still refuses all of these SDWA forms. `v_max_f16`, `v_min_f16`, `v_floor_f16`, `v_ceil_f16`, `v_trunc_f16`, `v_rndne_f16`, `v_frexp_mant_f16` and `v_frexp_exp_i16_f16` were missing from the binary16 MODE scan in `src/gfx1013_direct_compute.inl`, so a program using one of them together with an `s_round_mode`/`s_denorm_mode` write was refused as an unsupported control instruction instead of having the MODE write consumed under the keep-denorm contract. They are now listed there, matching `v_fract_f16`, `v_ldexp_f16` and the conversion ops. A MODE write that moves the binary16 rounding or denormal bits is still refused. ## Tests - `tests/native_sdwa_profiles_check.py` gains a second and third program (12, 28 and 6 slots, each under the 32-slot hardware layout) with an independent Python/ISA reference model, plus 15 refusal controls: disallowed VOP2 SDWA ops, float/int modifier violations, omod/clamp on integer destinations, invalid 16-bit destination selection and unused mode, a byte source pick, literal 255, and `v_sin_f16`. - `tests/native_sdwa_f16_scalar_check.py` gains admitted SDWA `v_max_f16`/`v_min_f16` cases with SGPR sources and a MODE-write refusal. - Two obsolete refusals now carry the more specific diagnostic (`tests/native_fract_f16_check.py`, `tests/native_cvt_norm_f16_check.py`: the SDWA form is refused for its DWORD destination select, now that the op itself is admitted); both programs are still refused. - `tests/native_sdwa_f16_check.py`: the two obsolete max/min SDWA refusals are replaced with `v_fmac_f32`/`v_fmac_f16`, which stay refused. - Docs: new `docs/experiments/direct-sdwa-profiles.md`, a pointer section in `docs/experiments.md`, and the stale "SDWA min and max remain refused" line in `docs/experiments/native-sdwa-f16.md` corrected. Note: this extends the existing `native_sdwa_profiles` suite rather than adding a `native_compute_sdwa_profiles` suite, so the WIN-VERIFY tag below names the real CTest names `native_sdwa_profiles_(ir|dxil|hardware)`. ## Review follow-ups (efb53ad0) @Leyukaka's review of `9541306f` (above), addressed in `efb53ad0`: - Docs: `docs/experiments/direct-sdwa-profiles.md` drops the Linux-verification section and records the verified `9541306f` Windows baseline above, with the exact count of 21 opcodes across 34 new profiles. - `v_frexp_*_f32` SDWA coverage: a WORD_1 source pick (the picked value is a subnormal, since only the high half of the f32 word is read) and a WORD destination with UNUSED_PRESERVE now pin `subword()` and `place_subword()` in that handler. - `v_max_f16`/`v_min_f16`: new cases with a non-canonical NaN payload (`0x7C01`, and `0x7C01` vs `0xFC01` where both are NaN) and with signed zeros (`+0.0` vs `-0.0`). The model (sign-magnitude key; NaN yields the other operand, both NaN yield canonical `0x7E00`; max(+0,-0)=+0, min(+0,-0)=-0) matches the lowering's emitted icmp/select IR exactly, and the signed-zero order matches IEEE maxNum/minNum. - `v_ldexp_f16` inline float constant as src1: the SDWA path now reads `subword(operand32)` instead of `sdwa_half`, so inline 242 (1.0) reads its f32 pattern `0x3F800000` — delta 0 from WORD_0, delta 16256 clamped to 64 from WORD_1 — matching the plain path, which reads the low 16 bits of `operand32`. Register sources read the same word either way. Two cases pin this (WORD_0 gives 1.0, WORD_1 gives +inf; reading the binary16 pattern `0x3C00` would give +inf in both). - The stale "the lowering is the second gate" sentence in `src/gfx1013_compute_native.cpp` is removed; all listed ops now honour `i.subword` and `place_subword`. ## Linux re-verification (efb53ad0) Run on Linux against a throwaway harness build of `native_compute_ir_dump`/`native_pixel_ir_dump` (stub `d3d12.h` and root-signature deserializer only, never committed): ```text tests/native_sdwa_profiles_check.py ir: 46 profiles admitted; 15 malformed/unsupported controls and all graphics profiles refused interpreted IR values for all 46 profiles match the independent model (frexp WORD_1 picks and WORD-dst PRESERVE placement, max/min non-canonical NaN and signed zeros, ldexp inline-constant src1) tests/native_sdwa_f16_scalar_check.py ir: 7 results and 6 refusals tests/native_f16_alu_check.py ir: 676 results match the model; 43 refusals carry the named diagnostic tests/native_sdwa_f16_check.py ir: 46 results and 15 refusals tests/native_fract_f16_check.py ir: 32 cases matched exact model; 10 refusals matched tests/native_cvt_norm_f16_check.py ir: 30 cases matched exact model; 11 refusals matched tests/native_frexp_f16_check.py ir: 22 results matched, inline floats read as binary16 form_coverage_check.py: form coverage checks passed docs_links_check.py: Checked 176 Markdown files and 716 links bidi_controls_check.py: Checked 2670 tracked source, script and build/CI files: no bidirectional controls py_compile on the edited Python files: pass git diff --check: clean ``` Five spot-mutations on `/tmp` copies of the sources, each killed: - Revert `subword()` in the `v_frexp_*_f32` handler: interpreted values fail (mantissa `0x3F400000` vs `0x3F028000`, exponent `4` vs `-133`). - Revert `place_subword()` in the `v_frexp_*_f32` handler: interpreted values fail (mantissa `0x3F412345` vs `0x23451357`, exponent `0x4` vs `0xA55A0004`). - Revert `v_ldexp_f16` src1 to `sdwa_half`: the dump refuses with `unsupported SDWA binary16 inline constant selection` (the WORD_1 inline pick). - Remove the max/min both-NaN canonicalization: interpreted values fail (min keeps the `0x7C01` payload instead of `0x7E00`). - Drop the decoder's float-source sext refusal: the profiles `ir` run fails (the `v_ldexp_f16` src0-sext refusal case is admitted). Note: the `ir` mode checks admission, needles and refusals, not values, so it stays green under the first two reverts; the interpreted-IR value check over the same dumped IR (the Linux stand-in for the hardware run) is what fails on the new cases. The follow-up edits above await a fresh Windows rerun on the new commit. ## Windows Verification ```text Commit: efb53ad0c3ce3221a1945cd3255f2e4e30b74884 Adapter: NVIDIA GeForce RTX 4050 Laptop GPU (10de:28e1), driver 32.0.15.9186 (XBOX2WINDOWS_ADAPTER=NVIDIA) Build (dev/release): cmake --build --preset <dev|release> --target compile_dxil native_compute_ir_dump native_pixel_ir_dump native_store_replay offscreen_check dev primary: ctest --preset dev --no-tests=error -R '^native_sdwa_profiles_(ir|dxil|hardware)$' -V -j 1 -> 3/3 passed (4.34s; ir 1.44s, dxil 1.34s, hardware 1.38s; 46 profiles + 15 controls) release primary: ctest --preset release --no-tests=error -R '^native_sdwa_profiles_(ir|dxil|hardware)$' --output-on-failure -j 1 -> 3/3 passed (3.34s; ir 0.95s, dxil 1.07s, hardware 1.17s) SDWA/f16 regressions: ctest --preset <dev|release> --no-tests=error -R '^(native_cvt_norm_f16_.*|native_f16_alu_.*|native_fract_f16_.*|native_frexp_f16_.*|native_sdwa_f16_.*|native_sdwa_vcc_hi_hardware)$' --output-on-failure -j 4 -> dev 20/20 passed (10.60s), release 20/20 passed (9.96s) Repo checks: form_coverage_check.py, docs_links_check.py (176 files, 716 links), bidi_controls_check.py (2670 files), py_compile, git diff --check -> passed ``` AI-assisted. <!-- WIN-VERIFY: passed | sha=efb53ad0c3ce3221a1945cd3255f2e4e30b74884 -->
Leyukaka commented 2026-11-29 17:27:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T17:27:02Z.

Review: COMMENTED


Diff reading only at 9541306f; nothing built or run.

Checked:

  • The fixture opcodes match the GFX10 VOP1/VOP2 tables, and the sdwa_profile() operand types match the ops (float or integer, 16-bit or not, per source and destination; v_ldexp_f16 src1 as int16).
  • Ops admitted before decode as before: with sdwa_new false, src_float, dst_16, src_16 and the clamp/scale conditions reduce to the old expressions. The non-SDWA lowering paths keep the old expressions behind i.subword ? ... : old.
  • Graphics is unchanged: sdwa_new requires !graphics, and the fixture runs every new profile through the pixel dumper and expects a refusal.
  • MODE scan: the eight added ops only set half_binary, so a MODE write next to them goes to consume_half_mode instead of the control-instruction refusal.

SHOULD docs/experiments/direct-sdwa-profiles.md:98-99: the note says the DXIL/hardware CTest runs and GPU readback await Windows verification and that no hardware result is claimed. The PR body reports those runs passing on this head (dev and release, 3/3, plus 20/20 f16/SDWA regressions). Please put that result in the note. The "Linux verification" section (:74-96) describes a harness that is not in the repo.

SHOULD tests/native_sdwa_profiles_check.py:90-91: both f32 frexp profiles use src0=DWORD, dst=DWORD, so the new SDWA code in that handler is not exercised. Reverting the subword(...) pick at src/gfx1013_direct_compute.inl:2280-2281 or the place_subword at :2309 leaves every test green. One case with a WORD_1 (or byte) source pick and one with a WORD_0/WORD_1 destination would cover it.

NITs:

  • tests/native_sdwa_profiles_check.py:229-245: the min/max model uses the same sign-magnitude key and NaN rule as the lowering, and only the 0x7E00 NaN is tested.
  • v_ldexp_f16 with an inline float constant as src1: the SDWA path reads the binary16 pattern (sdwa_half), the plain path reads the low 16 bits of operand32. The two differ and neither is tested.
  • src/gfx1013_compute_native.cpp:40-41: "the lowering is the second gate" only holds for handlers that test i.subword; all listed ops now handle it.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6103967711 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3470#pullrequestreview-6103967711). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T17:27:02Z. **Review:** COMMENTED --- Diff reading only at 9541306f; nothing built or run. Checked: - The fixture opcodes match the GFX10 VOP1/VOP2 tables, and the `sdwa_profile()` operand types match the ops (float or integer, 16-bit or not, per source and destination; `v_ldexp_f16` src1 as int16). - Ops admitted before decode as before: with `sdwa_new` false, `src_float`, `dst_16`, `src_16` and the clamp/scale conditions reduce to the old expressions. The non-SDWA lowering paths keep the old expressions behind `i.subword ? ... : old`. - Graphics is unchanged: `sdwa_new` requires `!graphics`, and the fixture runs every new profile through the pixel dumper and expects a refusal. - MODE scan: the eight added ops only set `half_binary`, so a MODE write next to them goes to `consume_half_mode` instead of the control-instruction refusal. SHOULD `docs/experiments/direct-sdwa-profiles.md:98-99`: the note says the DXIL/hardware CTest runs and GPU readback await Windows verification and that no hardware result is claimed. The PR body reports those runs passing on this head (dev and release, 3/3, plus 20/20 f16/SDWA regressions). Please put that result in the note. The "Linux verification" section (:74-96) describes a harness that is not in the repo. SHOULD `tests/native_sdwa_profiles_check.py:90-91`: both f32 frexp profiles use `src0=DWORD, dst=DWORD`, so the new SDWA code in that handler is not exercised. Reverting the `subword(...)` pick at `src/gfx1013_direct_compute.inl:2280-2281` or the `place_subword` at `:2309` leaves every test green. One case with a WORD_1 (or byte) source pick and one with a WORD_0/WORD_1 destination would cover it. NITs: - `tests/native_sdwa_profiles_check.py:229-245`: the min/max model uses the same sign-magnitude key and NaN rule as the lowering, and only the 0x7E00 NaN is tested. - `v_ldexp_f16` with an inline float constant as src1: the SDWA path reads the binary16 pattern (`sdwa_half`), the plain path reads the low 16 bits of `operand32`. The two differ and neither is tested. - `src/gfx1013_compute_native.cpp:40-41`: "the lowering is the second gate" only holds for handlers that test `i.subword`; all listed ops now handle it.
Ammmae0x commented 2026-11-29 17:56:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-29T17:56:12Z.


Addressed all items from @Leyukaka's review (PRR_kwDOV10-fc8AAAABa9Mn3w) in efb53ad0:

  • Experiment note (docs/experiments/direct-sdwa-profiles.md & docs/experiments.md): Removed the Linux throwaway-harness section and stale pending wording, recorded the verified 9541306f Windows baseline, and aligned the counts (21 opcodes across 34 new / 46 total SDWA profiles).
  • v_frexp_*_f32 SDWA coverage (tests/native_sdwa_profiles_check.py): Added WORD_1 source-pick and WORD_0/WORD_1 UNUSED_PRESERVE destination cases so both subword() and place_subword() in the v_frexp_*_f32 handler are pinned against mutation.
  • NITs: Added v_max_f16/v_min_f16 non-canonical NaN (0x7C01, 0xFC01) and signed-zero (+0.0/-0.0) cases, aligned v_ldexp_f16 src1 SDWA to subword(operand32(...)) for inline constants (with reg1=242 WORD_0/WORD_1 coverage), and removed the stale comment in src/gfx1013_compute_native.cpp.

Windows Verification (efb53ad0)

Commit: efb53ad0c3ce3221a1945cd3255f2e4e30b74884
Adapter: NVIDIA GeForce RTX 4050 Laptop GPU (10de:28e1), driver 32.0.15.9186 (XBOX2WINDOWS_ADAPTER=NVIDIA)
Build (dev/release): cmake --build --preset <dev|release> --target compile_dxil native_compute_ir_dump native_pixel_ir_dump native_store_replay offscreen_check
dev primary: ctest --preset dev --no-tests=error -R '^native_sdwa_profiles_(ir|dxil|hardware)$' -V -j 1 -> 3/3 passed (4.34s; 46 profiles + 15 controls)
release primary: ctest --preset release --no-tests=error -R '^native_sdwa_profiles_(ir|dxil|hardware)$' --output-on-failure -j 1 -> 3/3 passed (3.34s)
SDWA/f16 regressions: ctest --preset <dev|release> --no-tests=error -R '^(native_cvt_norm_f16_.*|native_f16_alu_.*|native_fract_f16_.*|native_frexp_f16_.*|native_sdwa_f16_.*|native_sdwa_vcc_hi_hardware)$' --output-on-failure -j 4 -> dev 20/20 passed (10.60s), release 20/20 passed (9.96s)
Repo checks: form_coverage_check.py, docs_links_check.py (176 files, 716 links), bidi_controls_check.py (2670 files), py_compile, git diff --check -> passed

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7260078991 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3470#issuecomment-7260078991). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-29T17:56:12Z. --- Addressed all items from `@Leyukaka`'s review (`PRR_kwDOV10-fc8AAAABa9Mn3w`) in `efb53ad0`: - **Experiment note (`docs/experiments/direct-sdwa-profiles.md` & `docs/experiments.md`):** Removed the Linux throwaway-harness section and stale pending wording, recorded the verified `9541306f` Windows baseline, and aligned the counts (`21` opcodes across `34` new / `46` total SDWA profiles). - **`v_frexp_*_f32` SDWA coverage (`tests/native_sdwa_profiles_check.py`):** Added `WORD_1` source-pick and `WORD_0`/`WORD_1` `UNUSED_PRESERVE` destination cases so both `subword()` and `place_subword()` in the `v_frexp_*_f32` handler are pinned against mutation. - **NITs:** Added `v_max_f16`/`v_min_f16` non-canonical NaN (`0x7C01`, `0xFC01`) and signed-zero (`+0.0`/`-0.0`) cases, aligned `v_ldexp_f16` `src1` SDWA to `subword(operand32(...))` for inline constants (with `reg1=242` `WORD_0`/`WORD_1` coverage), and removed the stale comment in `src/gfx1013_compute_native.cpp`. ## Windows Verification (`efb53ad0`) ```text Commit: efb53ad0c3ce3221a1945cd3255f2e4e30b74884 Adapter: NVIDIA GeForce RTX 4050 Laptop GPU (10de:28e1), driver 32.0.15.9186 (XBOX2WINDOWS_ADAPTER=NVIDIA) Build (dev/release): cmake --build --preset <dev|release> --target compile_dxil native_compute_ir_dump native_pixel_ir_dump native_store_replay offscreen_check dev primary: ctest --preset dev --no-tests=error -R '^native_sdwa_profiles_(ir|dxil|hardware)$' -V -j 1 -> 3/3 passed (4.34s; 46 profiles + 15 controls) release primary: ctest --preset release --no-tests=error -R '^native_sdwa_profiles_(ir|dxil|hardware)$' --output-on-failure -j 1 -> 3/3 passed (3.34s) SDWA/f16 regressions: ctest --preset <dev|release> --no-tests=error -R '^(native_cvt_norm_f16_.*|native_f16_alu_.*|native_fract_f16_.*|native_frexp_f16_.*|native_sdwa_f16_.*|native_sdwa_vcc_hi_hardware)$' --output-on-failure -j 4 -> dev 20/20 passed (10.60s), release 20/20 passed (9.96s) Repo checks: form_coverage_check.py, docs_links_check.py (176 files, 716 links), bidi_controls_check.py (2670 files), py_compile, git diff --check -> passed ``` AI-assisted.
Leyukaka commented 2026-11-29 18:09:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T18:09:12Z.

Review: APPROVED


Re-reviewed 9541306f..efb53ad0. Both earlier points are fixed:

  • docs/experiments/direct-sdwa-profiles.md:82-97 now records the Windows results on 9541306f and says the new cases still need a rerun.
  • tests/native_sdwa_profiles_check.py:104-113 adds frexp f32 cases with a WORD_1 source and WORD_1/WORD_0 preserve destinations; by reading, reverting subword() at src/gfx1013_direct_compute.inl:2283 or place_subword() at :2311 changes the expected value (not run as a mutation).
  • ldexp at inl:2469 now picks the subword of operand32, so an inline constant reads its f32 pattern on both paths; tests:133-136 cover WORD_0 and WORD_1.

Hardware rerun on efb53ad0 (NVIDIA GeForce RTX 5080 10de:2c02, driver 32.0.16.2101; D3D12 debug layer not installed; configured with -DX2W_WITH_OPUS=OFF):
ctest --preset dev --no-tests=error -R '^(native_sdwa_|native_cvt_norm_f16|native_cvt_pknorm_f16|native_fract_f16)' -> 20/20 passed, 0 skipped, 71 s. native_sdwa_profiles_hardware: "46 results and all guards matched". native_frexp_f16_* and native_f16_alu_* are outside this filter and were not rerun.

Nit, non-blocking: direct-sdwa-profiles.md:94 names a GitHub handle; a commit reference would age better, and that paragraph can now cite the rerun above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6104125177 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3470#pullrequestreview-6104125177). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T18:09:12Z. **Review:** APPROVED --- Re-reviewed `9541306f..efb53ad0`. Both earlier points are fixed: - `docs/experiments/direct-sdwa-profiles.md:82-97` now records the Windows results on `9541306f` and says the new cases still need a rerun. - `tests/native_sdwa_profiles_check.py:104-113` adds frexp f32 cases with a `WORD_1` source and `WORD_1`/`WORD_0` preserve destinations; by reading, reverting `subword()` at `src/gfx1013_direct_compute.inl:2283` or `place_subword()` at `:2311` changes the expected value (not run as a mutation). - ldexp at `inl:2469` now picks the subword of `operand32`, so an inline constant reads its f32 pattern on both paths; `tests:133-136` cover `WORD_0` and `WORD_1`. Hardware rerun on `efb53ad0` (NVIDIA GeForce RTX 5080 `10de:2c02`, driver `32.0.16.2101`; D3D12 debug layer not installed; configured with `-DX2W_WITH_OPUS=OFF`): `ctest --preset dev --no-tests=error -R '^(native_sdwa_|native_cvt_norm_f16|native_cvt_pknorm_f16|native_fract_f16)'` -> 20/20 passed, 0 skipped, 71 s. `native_sdwa_profiles_hardware`: "46 results and all guards matched". `native_frexp_f16_*` and `native_f16_alu_*` are outside this filter and were not rerun. Nit, non-blocking: `direct-sdwa-profiles.md:94` names a GitHub handle; a commit reference would age better, and that paragraph can now cite the rerun above.
KelboLive commented 2026-11-30 03:54:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-30T03:54:37Z.


This change is green on its branch but leaves main red at 44a3ad5aa: four native SDWA tests fail because the programs they mark as unimplemented direct SDWA operand profile are profiles this PR now admits, so they are refused one gate later on the destination. Reported with the measurements in #3547.

One finding there may be worth your judgement specifically: v_sin_f16 and v_cos_f16 translate successfully in this build when the destination is well formed (rc=0), although the note added here says they are still refused. 063d4e1a5 added that lowering before this PR, so the sentence looks out of date rather than the code being wrong.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7268298570 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3470#issuecomment-7268298570). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-30T03:54:37Z. --- This change is green on its branch but leaves `main` red at `44a3ad5aa`: four native SDWA tests fail because the programs they mark as `unimplemented direct SDWA operand profile` are profiles this PR now admits, so they are refused one gate later on the destination. Reported with the measurements in #3547. One finding there may be worth your judgement specifically: `v_sin_f16` and `v_cos_f16` translate successfully in this build when the destination is well formed (`rc=0`), although the note added here says they are still refused. `063d4e1a5` added that lowering before this PR, so the sentence looks out of date rather than the code being wrong.
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!3470
No description provided.