test: cover direct compute 32-bit integer min3 max3 and med3 #3187

Manually merged
github merged 1 commit from github-bot/gh-3185 into gh-pr/3185/base 2026-11-27 22:10:28 +00:00 AGit
Owner

@⁠xiaoqi72665 on GitHub · 2026-11-27 20:41 UTC · original
xiaoqi72665:native/int32-minmax3 → main · +139 −0 · 2 files · 1 commits · merged 2026-11-27 22:06 UTC

Fixes #3186. Refs #2935, #1546.

Change

Add a focused direct-native regression for v_min3/max3/med3 in u32 and i32. The native compare/select lowering already exists (4036577); no production compiler change is needed. The prior Python/AOT implementations and tests are #1992, #1574, #1577 and #308.

  • Six individually compiled canonical forms; six clamp-refusal controls.
  • 11 source-built cases: all permutations of INT_MIN, INT_MAX and 0xffffffff, repeated values, equality, sparse guest EXEC, and an S0/destination alias. Two physical 32-thread groups. Compare the full 2,064-DWORD readback against a sorting-based independent CPU oracle, including all untouched guards and masked destination preservation.
  • Oracle checks distinguish wrong signedness (independently for every opcode), dropped S2, wrong rank and ignored EXEC.
  • Register native_int32_minmax3_controls and native_int32_minmax3_hardware following the existing native_sad pattern.

Verification

Clean builds on main 5fc9f6ff (includes #3157 and #3081), with only this test fixture/registration added. Both Debug and Release:

  • Registered focused CTest: controls PASS; stock native_store_replay hardware test capability SKIP (77, system SM6.5). Exit 0; not two executed passes.
  • Actual GPU execution with the same native compiler and fixture via an ignored local replay copy using the previously verified app-local Agility/WARP device setup (#3162): RX 7900 XT 11/11, WARP 1.0.22 11/11 per configuration. All 44 cases, 90,816 DWORD comparisons exact. The local device setup is not part of this patch.
  • Earlier verification on 671d2f46 also passed 44/44 cases; not added to final revision totals.

Environment: Windows 10 22H2 build 19045, RX7900XT driver 32.0.32029.2010, WARP 1.0.22.0, Agility 1.620.2 DLL-only, Windows SDK 10.0.26100.0, MSVC 19.44. Debug layer unavailable. Full physical waves deliberately avoid the independently reproduced WARP partial-wave ballot anomaly (#3162); sparse guest EXEC remains covered. No claim that the known WARP failure is fixed.

Standard commands:

cmake --build --preset dev --target compile_dxil native_store_replay
ctest --preset dev --no-tests=error -j 1 -R '^native_int32_minmax3_' -V
cmake --build --preset release --target compile_dxil native_store_replay
ctest --preset release --no-tests=error -j 1 -R '^native_int32_minmax3_' -V

On this Win10 machine, the actual readback additionally used the locally built replay copy with explicit device-factory/Agility exports, not a capability bypass.

Public source-generated fixtures only. AI-assisted; tested locally by Buhe (@⁠xiaoqi72665).

**@⁠xiaoqi72665** on GitHub · 2026-11-27 20:41 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3185) `xiaoqi72665:native/int32-minmax3` → `main` · +139 −0 · 2 files · 1 commits · merged 2026-11-27 22:06 UTC Fixes #3186. Refs #2935, #1546. ## Change Add a focused direct-native regression for v_min3/max3/med3 in u32 and i32. The native compare/select lowering already exists (4036577); no production compiler change is needed. The prior Python/AOT implementations and tests are #1992, #1574, #1577 and #308. - Six individually compiled canonical forms; six clamp-refusal controls. - 11 source-built cases: all permutations of INT_MIN, INT_MAX and 0xffffffff, repeated values, equality, sparse guest EXEC, and an S0/destination alias. Two physical 32-thread groups. Compare the full 2,064-DWORD readback against a sorting-based independent CPU oracle, including all untouched guards and masked destination preservation. - Oracle checks distinguish wrong signedness (independently for every opcode), dropped S2, wrong rank and ignored EXEC. - Register native_int32_minmax3_controls and native_int32_minmax3_hardware following the existing native_sad pattern. ## Verification Clean builds on main 5fc9f6ff (includes #3157 and #3081), with only this test fixture/registration added. Both Debug and Release: - Registered focused CTest: controls PASS; stock native_store_replay hardware test capability SKIP (77, system SM6.5). Exit 0; not two executed passes. - Actual GPU execution with the same native compiler and fixture via an ignored local replay copy using the previously verified app-local Agility/WARP device setup (#3162): RX 7900 XT 11/11, WARP 1.0.22 11/11 per configuration. All 44 cases, 90,816 DWORD comparisons exact. The local device setup is not part of this patch. - Earlier verification on 671d2f46 also passed 44/44 cases; not added to final revision totals. Environment: Windows 10 22H2 build 19045, RX7900XT driver 32.0.32029.2010, WARP 1.0.22.0, Agility 1.620.2 DLL-only, Windows SDK 10.0.26100.0, MSVC 19.44. Debug layer unavailable. Full physical waves deliberately avoid the independently reproduced WARP partial-wave ballot anomaly (#3162); sparse guest EXEC remains covered. No claim that the known WARP failure is fixed. Standard commands: ```powershell cmake --build --preset dev --target compile_dxil native_store_replay ctest --preset dev --no-tests=error -j 1 -R '^native_int32_minmax3_' -V cmake --build --preset release --target compile_dxil native_store_replay ctest --preset release --no-tests=error -j 1 -R '^native_int32_minmax3_' -V ``` On this Win10 machine, the actual readback additionally used the locally built replay copy with explicit device-factory/Agility exports, not a capability bypass. Public source-generated fixtures only. AI-assisted; tested locally by Buhe (@⁠xiaoqi72665).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 20:46:56 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-11-27 21:16 UTC · original

LGTM on the min3/max3/med3 test coverage.\n\nNote: Like #3189, this PR removes v_cvt_f16_* conversions from the direct compute path. Please clarify if these are being moved to a different code path or deprecated.

**@⁠KelboLive** on GitHub · 2026-11-27 21:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3185#issuecomment-7228299410) LGTM on the min3/max3/med3 test coverage.\n\n**Note:** Like #3189, this PR **removes** `v_cvt_f16_*` conversions from the direct compute path. Please clarify if these are being moved to a different code path or deprecated.
github-bot force-pushed github-bot/gh-3185 from 535b76165e to 81693c167a 2026-11-27 21:30:32 +00:00 Compare
Author
Owner

@⁠xiaoqi72665 on GitHub · 2026-11-27 21:25 UTC · original

Thanks for checking! #3161 merged at 20:43:02 UTC, 107 seconds after this PR was opened. The old branch lacked that newer commit; our three-dot diff never removed the conversions. Rebased onto 5b145ca as 81693c1; range-diff is identical and the Files changed are still only two added test files (+139/-0). All of src/ and the #3161 test files match upstream byte-for-byte.

Fresh Debug/Release: conversion IR (82 cases, 38 refusals), DXIL controls, and min/max/median controls passed in both builds. Stock GPU tests skip 77 on this Win10 machine. With the local Agility replay, min/max/median passed 44/44 cases on RX 7900 XT and WARP. The conversion GPU fixture reaches its final guard check but hits an existing F.SENTINEL AttributeError; a local diagnostic copy using an exact full-buffer sentinel comparison passed all 82 conversions across two groups on both adapters in both builds. No conversion code or tests were changed in this PR.

AI-assisted; locally verified by Buhe.

**@⁠xiaoqi72665** on GitHub · 2026-11-27 21:25 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3185#issuecomment-7228431656) Thanks for checking! #3161 merged at 20:43:02 UTC, 107 seconds after this PR was opened. The old branch lacked that newer commit; our three-dot diff never removed the conversions. Rebased onto `5b145ca` as `81693c1`; range-diff is identical and the [Files changed](https://git.gtahub.st/github/R0Y00--Xbox2Windows/pulls/3187/files) are still only two added test files (+139/-0). All of `src/` and the #3161 test files match upstream byte-for-byte. Fresh Debug/Release: conversion IR (82 cases, 38 refusals), DXIL controls, and min/max/median controls passed in both builds. Stock GPU tests skip 77 on this Win10 machine. With the local Agility replay, min/max/median passed 44/44 cases on RX 7900 XT and WARP. The conversion GPU fixture reaches its final guard check but hits an existing `F.SENTINEL` AttributeError; a local diagnostic copy using an exact full-buffer sentinel comparison passed all 82 conversions across two groups on both adapters in both builds. No conversion code or tests were changed in this PR. AI-assisted; locally verified by Buhe.
github-bot changed target branch from main to gh-pr/3185/base 2026-11-27 22:10:27 +00:00
github manually merged commit 81693c167a into gh-pr/3185/base 2026-11-27 22:10:28 +00:00
Author
Owner

@⁠pigalot on GitHub · 2026-11-27 22:05 UTC · original · approved these changes

I reviewed 81693c16 merged over main 5612e924. The merge is clean (tree 9fdc4f0b) and git diff --cached --check is clean. The PR only adds a test and its registration.

What I traced.

  • Coverage: on main, no tests/native_*.py exercises VOP3 opcodes 0x152..0x159, so this is the first direct-native fixture for the six integer min3/max3/med3 forms.
  • Encodings: the fixture's encodings match the GFX10 VOP3 opcodes for v_{min,max,med}3_{i,u}32.
  • Oracle: the reference sorts the three operands with a signed or unsigned key and picks rank 0, 1 or 2. That is an independent model of the lowering's bound(...) select chain at gfx1013_direct_compute.inl.
  • EXEC: under sparse EXEC, inactive lanes keep SEED, and the aliased signed-median destination keeps S0.

What I ran. I built compile_dxil native_store_replay in dev and release, then ran

python .agentic\scripts\with_gpu_lock.py ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^(native_int32_minmax3_(controls|hardware)|native_direct_container)$'
  • Results: 3/3 pass in Debug and Release /O2, with no skips. native_int32_minmax3_hardware executed all 11 cases on the GPU, and each matched all 2,064 words.
  • Not a skip here: the PR body reports a 77 skip for the registered hardware test on its machine. On this one it ran.

Negative controls. The production lowering is unchanged, so I mutated it in src/gfx1013_direct_compute.inl. For each, I rebuilt in dev and ran both tests:

Mutant Result
signed_order = false (i32 compared unsigned) killed (first triple: 0x7fffffff vs 0x80000000 at word 11)
min3/max3 drop the S2 bound killed (word 9: 0x80000000 vs 0xffffffff)
med3 inner max(a, b) replaced with min(a, b) killed (word 10)

Restored and rebuilt afterwards; git diff --quiet is clean.

Verdict: approve on 81693c16.

Environment: NVIDIA GeForce RTX 5090 driver 610.88, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Windows SDK 10.0.28000.0 DXC, Python 3.12.10, wave32, debug layer off.
CI: Build and test on Windows passes on 81693c16.

This reply was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-27 22:05 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3185#pullrequestreview-6093796068) · **approved these changes** I reviewed `81693c16` merged over `main` `5612e924`. The merge is clean (tree `9fdc4f0b`) and `git diff --cached --check` is clean. The PR only adds a test and its registration. **What I traced.** - **Coverage:** on `main`, no `tests/native_*.py` exercises VOP3 opcodes `0x152`..`0x159`, so this is the first direct-native fixture for the six integer min3/max3/med3 forms. - **Encodings:** the fixture's encodings match the GFX10 VOP3 opcodes for `v_{min,max,med}3_{i,u}32`. - **Oracle:** the reference sorts the three operands with a signed or unsigned key and picks rank 0, 1 or 2. That is an independent model of the lowering's `bound(...)` select chain at `gfx1013_direct_compute.inl`. - **EXEC:** under sparse EXEC, inactive lanes keep `SEED`, and the aliased signed-median destination keeps S0. **What I ran.** I built `compile_dxil native_store_replay` in `dev` and `release`, then ran ```powershell python .agentic\scripts\with_gpu_lock.py ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^(native_int32_minmax3_(controls|hardware)|native_direct_container)$' ``` - **Results:** 3/3 pass in Debug and Release `/O2`, with no skips. `native_int32_minmax3_hardware` executed all 11 cases on the GPU, and each matched all 2,064 words. - **Not a skip here:** the PR body reports a 77 skip for the registered hardware test on its machine. On this one it ran. **Negative controls.** The production lowering is unchanged, so I mutated it in `src/gfx1013_direct_compute.inl`. For each, I rebuilt in `dev` and ran both tests: | Mutant | Result | |---|---| | `signed_order = false` (i32 compared unsigned) | killed (first triple: `0x7fffffff` vs `0x80000000` at word 11) | | min3/max3 drop the S2 bound | killed (word 9: `0x80000000` vs `0xffffffff`) | | med3 inner `max(a, b)` replaced with `min(a, b)` | killed (word 10) | Restored and rebuilt afterwards; `git diff --quiet` is clean. **Verdict:** approve on `81693c16`. Environment: NVIDIA GeForce RTX 5090 driver 610.88, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Windows SDK 10.0.28000.0 DXC, Python 3.12.10, wave32, debug layer off. CI: `Build and test on Windows` passes on `81693c16`. This reply was AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.