Repository navigation
tests: add supplemental SDWA 32-bit integer compare draws and refusal controls - #1923
Conversation
tedin7
left a comment
There was a problem hiding this comment.
Review of head f81ecee36e093d04be1d7e7a4b0ce857103090e0 (first review). Verdict: not mergeable as it stands, no merge.
Blocking:
- The PR conflicts with main:
git merge-tree --write-tree --name-only origin/main HEADreports a content conflict in tests/pixel_aot_check.py (GitHub: CONFLICTING/DIRTY). Please rebase. - Overlap: open PRs #1670 ("lower the integer SDWA comparisons") and #1790 ("lower the 46 non-cmpx SDWA comparisons") cover the same v_cmp_*_i32/u32_sdwa forms. Please say which of them this PR replaces or builds on, so only one lands.
Read of the diff (no P1/P2 found in the code itself):
- tools/pixel_aot.py: new SDWA_INT_CMP_OPERANDS and a lowering branch that applies sdwa_source to both sources and reuses INT_COMPARE; asint for i32, raw words for u32; refuses an unbalanced sext(), pending/masked state and untracked registers.
- tools/scan_unsupported_shaders.py: SDWA_INT_SOURCE moved above its first use; new supported-instruction pattern for the sixteen forms.
- CMakeLists.txt adds only the registration of pixel_aot_sdwa_int_compare_.
- docs/experiments.md: the new paragraph states the semantics come from LLVM 15 and are not measured on a console. It does not report a hardware or WARP run of the new draw tests.
Commands run locally (Linux):
- git diff --check origin/main...HEAD: rc=0
- python3 tests/docs_links_check.py: rc=0
- python3 tests/bidi_controls_check.py: rc=0
- python3 tests/pixel_aot_check.py: rc=0
- python3 tests/rdna2_tools_check.py TestRdna2Scanner: rc=0, 51 tests OK
Mutation (reverted with git checkout -- ., tree clean):
- scanner pattern for the new forms narrowed from (i32|u32) to (i32): rdna2_tools_check fails (rc=1), v_cmp_gt_u32_sdwa counted unsupported (3, 2, 1) instead of (3, 3, 0).
Not done: the Windows draw tests (pixel_aot_check.py draw-sdwa-int-compare) were not run, since the conflict blocks a merge anyway. No GitHub checks are reported for the branch. No receipt, no merge.
AI-assisted; commands listed were executed locally.
|
Thanks for the distinct signed/unsigned draw and refusal cases. The 16 production forms overlap #1670 and #1790, which are already under review. Please hold this branch while we reconcile the shared implementation. The single-register destination follows the actual SDWA encoding; an aligned SGPR pair accepted by the textual parser does not establish an encodable form. If a new fixture survives the overlap review, it can land as supplemental coverage with your attribution. |
|
Same collision as #1747/#1793, this time on the SDWA integer comparisons: this and #1670 both add a The two are not identical in what they cover:
So the union is worth more than either alone. @R0Y00, which one do you want to land? If it is #1670, the extra cases here are worth porting; if it is this one, the AI-assisted. |
|
Thanks for comparing #1923 and #1670! Note that #1790 ("shader: lower the 46 non-cmpx SDWA comparisons") has since been merged into I'm keeping this branch held per @R0Y00's earlier note — happy to close it or extract any surviving extra refusal/draw cases if useful. |
|
@KomaGuy could you rebase this branch onto current GitHub reports head Files that conflict with current
Commands run locally: Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally. |
… controls Rebase R0Y00#1923 onto current main (after R0Y00#1790 landed all 46 non-cmpx SDWA comparisons in tools/pixel_aot.py and tools/scan_unsupported_shaders.py) and keep the supplemental per-predicate 32-bit integer test coverage: - Four 4-channel draw programs (i32_lo, i32_hi, u32_lo, u32_hi) covering all 16 v_cmp_*_{i32,u32}_sdwa forms with 41 targeted single-channel negative controls (signed vs unsigned, sext vs zero-extend, byte/word selectors, predicate swaps) registered as pixel_aot_sdwa_int_compare_{warp,hardware} and included in check_binary. - Additional static lowering and refusal checks: whole-dword equivalence with e32, single-register destination enforcement (refusing SGPR pairs and out-of-range s106), low16 VGPR source refusal, pending sample and pending scalar source/destination refusal, non-entry mask refusal, float modifiers, clamp, dst_sel, and remaining unlowered SDWA compare neighbours (i64, v_cmpx).
f81ecee to
db10c4a
Compare
|
@tedin7 Rebased onto current Since #1790 already landed the production lowering and scanner entries for all 46 non- Verified locally on Linux ( |
tedin7
left a comment
There was a problem hiding this comment.
Review of head db10c4aca4cb7e5b75f2c8c90d2fa2325826e665. Verdict: 0 P1, 0 P2. This is a clean result.
Changes since my earlier review of f81ecee3:
- The patch is different (patch-id changed), so this is a full re-review. The
tools/changes are gone; the lowering forv_cmp_*_{i32,u32}_sdwais already on main (tools/pixel_aot.py, theINT_COMPAREbranch). The PR now only adds tests. - The branch merges cleanly with main (
git merge-tree --write-tree origin/main HEADrc=0). The earlier conflict is resolved. - The overlap I raised before no longer applies to code: this PR adds no lowering. #1670 remains open on the same forms, so whichever lands second should check its tests against these.
Read of the diff (CMakeLists.txt, docs/experiments.md, tests/pixel_aot_check.py):
draw-sdwa-int-comparecovers all 16 i32/u32 predicates in four groups, with 41 single-channel negative controls that must report a mismatch.- Static refusal checks cover low16 sources, pending loads, masked regions, float modifiers, clamp and SGPR-pair destinations.
- CMake registers
pixel_aot_sdwa_int_compare_<adapter>next topixel_aot_sdwa_cmp_<adapter>, with the same timeout, skip code and coverage record. - The docs paragraph states that the semantics are not measured on a console.
Commands run locally (Linux):
git diff --check origin/main...HEAD: rc=0python3 tests/docs_links_check.py: pass (19 files, 457 links)python3 tests/bidi_controls_check.py: passpython3 -B tests/pixel_aot_check.py: rc=0- Mutation 1: in
tools/pixel_aot.py,asintselection changed from i32 to u32.check_sdwa_int_compare_loweringfailed. Killed. - Mutation 2: operands swapped (
values[::-1]) andasintreplaced withasuint. The same check failed. Killed. - Mutations reverted with
git checkout -- ..
Windows Server 2025 (D3D12 WARP):
- Debug:
ctest --preset dev -R '^(pixel_aot_sdwa_int_compare_warp|pixel_aot_sdwa_cmp_warp)$': 2/2 passed. - Release /O2: the same regex with
--preset release: 2/2 passed. tests/vk_offscreen.py: ok.- GitHub CI:
Build and test on Windows= SUCCESS.
AI-assisted; commands listed were executed locally.
|
Hardware run and Windows 11 MSVC build at head Environment: Windows 11 Pro build 26300.9974, Debug ( Build: Tests:
Not covered by this run: AMD hardware, and the LLVM 15 binary path ( |
MasterDomino
left a comment
There was a problem hiding this comment.
Approved at head db10c4ac. The change is test-only after the rebase: tests/pixel_aot_check.py, one CTest registration and one docs line. This adds an AMD run and a lowering mutant to @tedin7's review and @Makto94's RTX 3070 Ti run.
Environment
- Windows 11 build 26300,
--preset dev(Debug), DXC from SDK 10.0.26100. offscreen_checkbuilt atdb10c4ac.- The only hardware adapter in this machine is an AMD Radeon RX 9070 XT (1002:7550, driver 32.0.32029.2010). The passing draw doesn't print the adapter, but in this session the startup-stream drivers enumerate only this card and WARP.
Commands executed
ctest --preset dev --no-tests=error -R '^pixel_aot_sdwa_(int_compare|cmp)_(warp|hardware)$' -V
python -B tests/pixel_aot_check.py- At
db10c4ac:pixel_aot_sdwa_int_compare_{warp,hardware}and the neighbouringpixel_aot_sdwa_cmp_{warp,hardware}pass, 4/4, with no skips. - Merged with current
main(a96874a6, clean merge): the same 4/4 pass. The no-argument controls exit 0; they includecheck_sdwa_int_compare_lowering.
Negative control on the lowering
The 41 wrong-word channels in the batches are the built-in controls. On top of those, I mutated the lowering itself: in tools/pixel_aot.py, the v_cmp_*_{i32,u32}_sdwa branch changed from values = [f"asint({word})" if kind == "i32" else word ...] to values = [word ...], so i32 compares become unsigned. The emitted i32_lo and i32_hi compares then lose their asint.
- Hardware draw with the mutant: fails with
Expected ['pass', 'pass', 'mismatch', ...], got ['mismatch', 'pass', 'mismatch', ...], so the firsti32_lorow is now wrong. - After reverting: 2/2 pass again.
I didn't run binary mode locally. CI's LLVM 15 job ("Assemble and translate gfx1013 fixtures") passed at this head.
Merge checks: required CI passed at this head ("Build and test on Windows" and both Linux jobs). The /O2 and coverage skips come from explicit workflow conditions. There are no unresolved review threads.
Note for routing: #1670 is still open on the same forms with tools/ changes. Per @tedin7's earlier note, whichever lands second should reconcile its tests with these. That PR changes translation, so it stays with the maintainer.
AI-assisted; commands listed were executed locally.
Rebased onto current
main(214ed093) after #1790 landed all 46 non-cmpxSDWA comparisons intools/pixel_aot.pyandtools/scan_unsupported_shaders.py, keeping the supplemental per-predicate 32-bit integer draw and refusal test coverage:What this adds
tests/pixel_aot_check.py,CMakeLists.txt): four 4-channel groups (i32_lo,i32_hi,u32_lo,u32_hi) covering all 16v_cmp_*_{i32,u32}_sdwaforms across all 7src0_sel/src1_selselectors, zero/sign extension (sext()), and SGPR/VGPR source pairs, with 41 targeted single-channel negative controls (pixel_aot_sdwa_int_compare_{warp,hardware}) and LLVM binary round-trip fixtures incheck_binary.check_sdwa_int_compare_lowering): whole-dword equivalence withe32, single-register destination enforcement (vcc/vcc_lo/s52accepted, SGPR pairss[52:53]/s[51:52]/s[105:106]and out-of-ranges106rejected),low16VGPR source rejection, pending sample and pending scalar source/destination rejection, non-entry mask rejection, float modifiers (-s44,|v18|,abs(v18),sext(-s44)),clamp,dst_sel, and remaining unlowered SDWA compare neighbours (i64,v_cmpx).docs/experiments.md): notes the supplemental fixture alongside shader: lower the 46 non-cmpx SDWA comparisons #1790's entry.Verification (Linux)
git merge-tree --write-tree --name-only origin/main HEAD: clean, no conflicts.python3 tests/pixel_aot_check.py: PASS.python3 tests/docs_links_check.py: PASS (19 files, 457 links).python3 tests/bidi_controls_check.py: PASS (1641 files).python3 tests/rdna2_tools_check.py: PASS (156 tests OK, 19 skipped).git diff --check origin/main...HEAD: clean.Windows draws (
pixel_aot_sdwa_int_compare_{warp,hardware}) and LLVM 15check_binaryrun in CI.