shader: lower the integer SDWA comparisons #1663
Closed
rm-NoobInCoding wants to merge 3 commits from
upstream-pr/1670 into main
pull from: upstream-pr/1670
merge into: R0Y00:main
R0Y00:main
R0Y00:codex/indirect-large-backed-views
R0Y00:codex/word3-preflight-check
R0Y00:codex/vertex-table-two-records
R0Y00:codex/live-index-alias
R0Y00:codex/copied-vertex-buffer-srv
R0Y00:codex/windows-stage-test-output
R0Y00:codex/preserve-live-srv-retirement
R0Y00:codex/share-render-target-tracking
R0Y00:codex/sgd5-negative-offset-fixture
R0Y00:coverage-dashboard
R0Y00:codex/mesh-loose-root
R0Y00:codex/mesh86-cache-padding
R0Y00:codex/xmem-scatter-preflight
R0Y00:codex/mesh-depth-ps
R0Y00:codex/indirect-dispatch-refresh
R0Y00:codex/compute-container-index
R0Y00:codex/startup-compute-formatted-load
R0Y00:codex/compute-indirect-producer
R0Y00:codex/compute-atomic-soffset
R0Y00:codex/mesh-dual-handoff
R0Y00:codex/startup-run-sh-watcher-control
R0Y00:codex/queue31-page-alias
R0Y00:codex/indexed-indirect-compute-root
R0Y00:codex/typed-buffer-view-metadata
R0Y00:codex/translated-indexed-address-alias
R0Y00:codex/fixed-mesh-create-result
R0Y00:codex/xmem-section-lease
R0Y00:codex/startup-slot86-mesh-cache
R0Y00:codex/restore-mesh-barrier-iteration
R0Y00:codex/translated-indirect-upload-index
R0Y00:codex/xapu-completion-opt-in
R0Y00:codex/translated-indexed-rect
R0Y00:codex/translated-indexed-indirect
R0Y00:codex/startup-mesh-lds-integration
R0Y00:codex/startup-console-ms24
R0Y00:codex/startup-slot57-mesh-request
R0Y00:codex/indirect-copy-provenance
R0Y00:codex/present-color-producer-trace
R0Y00:codex/compute-dispatch-binding-trace
R0Y00:codex/translated-indirect-table-buffers
R0Y00:codex/indirect-copy-provenance-base
R0Y00:codex/mix-half-literal-source
R0Y00:codex/translated-indirect-draw
R0Y00:codex/xmem-scatter-diagnostics
R0Y00:codex/slot148-recording-upload
R0Y00:codex/slot70-loading-art-verified
R0Y00:codex/command-list-upload-arena
R0Y00:codex/recover-failed-command-list
R0Y00:codex/startup-heap-timing-notes
R0Y00:codex/align-audio-input-timeline
R0Y00:codex/synthetic-depth-export-control
R0Y00:codex/startup-texture1d-on-windows
R0Y00:codex/1629-packed-position-fixture
R0Y00:codex/cpu-srv-refresh
R0Y00:codex/stream-root-srv-draw
R0Y00:codex/audio-mixer-timer
R0Y00:codex/startup-reload-published-shader
R0Y00:codex/priority-integrate-1284
R0Y00:codex/guest-sixteen-page-record
R0Y00:codex/aot-placed-dxr-batch
R0Y00:codex/guest-directory-selection
R0Y00:codex/gamesave-enumerate-read
R0Y00:codex/readme-archive-to-pixels
R0Y00:codex/pe-placed-view-draw
R0Y00:codex/archive-directory-gpu
R0Y00:codex/slot133-dxr-build
R0Y00:codex/materialize-placed-vertex-view
R0Y00:codex/dstorage-directory-offsets
R0Y00:codex/xg-nine-bc-copy
R0Y00:codex/xg-slot10-bc64-arrays
R0Y00:codex/dxr-guest-address-readback
R0Y00:codex/gpu-va-high-bits
R0Y00:codex/clarify-diagnostic-startup-scope
R0Y00:codex/xg-six-levels
R0Y00:codex/typed-derived-blend
R0Y00:codex/english-legal-text-progress
R0Y00:codex/address-bc-4ks
R0Y00:codex/dstorage-bounded-file-read
R0Y00:codex/wide-srv-offsets-menu
R0Y00:codex/startup-memory-srv
R0Y00:codex/bound-view-tail
R0Y00:codex/language-selector-readback
R0Y00:codex/setup-menu-progress
R0Y00:codex/cpu-plane-refresh
R0Y00:codex/startup-ubyte-vertex
R0Y00:codex/presenter-window-selection
R0Y00:codex/startup-uniform-buffer-lane
R0Y00:codex/intro-loop-timing
R0Y00:codex/static-clzero-loops
R0Y00:codex/document-rtx-intro
R0Y00:codex/startup-insertq
R0Y00:codex/nv12-startup-texture
R0Y00:codex/stream-stage-draw
R0Y00:codex/startup-null-uav-format
R0Y00:codex/startup-draw-capture
R0Y00:codex/shorten-windows-checks
R0Y00:codex/dstorage-rfc1950
R0Y00:codex/startup-dump-fence
R0Y00:codex/pr1135-review-base
R0Y00:codex/startup-stream-requests
R0Y00:codex/startup-chroma-view
R0Y00:codex/readme-graphics-pipeline-streams
R0Y00:codex/static-crt-free-tls
R0Y00:codex/arc-140t-rtx-5080-laptop-gpu-reports
R0Y00:codex/main-startup-progress-entry
R0Y00:codex/signed-dxil-catalogue
R0Y00:codex/reloc-free-preferred-base
R0Y00:codex/quad-dpp-bit-mask
R0Y00:codex/raw-srv-bounds
R0Y00:codex/rx9070-31044-hardware-report
R0Y00:codex/gpu-page-source-provenance
R0Y00:codex/runtime-placeholder-interior
R0Y00:codex/gpu-copy-queue-tile-order
R0Y00:codex/pe-pin-external-providers
R0Y00:codex/xmem-placeholder-reservations
R0Y00:codex/xmem-shared-physical-pages
R0Y00:codex/pe-package-startup
R0Y00:codex/xmem-tools-memory-query
R0Y00:codex/cpu-stack-output-import
R0Y00:codex/pe-load-security-cookie
R0Y00:codex/record-three-bvh-retests
R0Y00:codex/cpu-rbp-frame-anchor
R0Y00:codex/xmem-default-startup
R0Y00:codex/record-rtx-3050-ti-9597
R0Y00:codex/docs-readme-start-here
R0Y00:codex/check-compute-mad24-truncation
R0Y00:codex/docs-discord-community
R0Y00:codex/bound-rcx-branch-mutants
R0Y00:codex/rtx5060ti-bvh-62114
R0Y00:codex/837-neutral-readme-disclaimer
R0Y00:codex/record-rtx-3070-ti
R0Y00:codex/title-neutral-public-wording
R0Y00:codex/exe-shadow-frame-submissions
R0Y00:codex/exe-shadow-runtime-chain
R0Y00:codex/readme-polish
R0Y00:codex/gpu-coverage-nov23
R0Y00:codex/spirv-minlod
R0Y00:codex/shadow-shim-device
R0Y00:codex/exe-two-shadow-frames
R0Y00:codex/shim-dispatch-cleanup
R0Y00:codex/fix-spirv-cache-probe
R0Y00:codex/sampler-use
R0Y00:codex/ballot-bit-extract
R0Y00:codex/packed-fma-release
R0Y00:codex/cpu-packed-fma-o2
R0Y00:codex/publish-coverage-dashboard
R0Y00:codex/mesh-cbv-binding-order
R0Y00:codex/spirv-window-fixture
R0Y00:codex/ps-e32-float-uint
R0Y00:codex/ps-cbuffer-reads
R0Y00:codex/fixed-profile-rescan
R0Y00:codex/shim-compute-integration
R0Y00:codex/readme-visible-coverage
R0Y00:codex/readme-research-navigation
R0Y00:codex/integrate-pr-256
R0Y00:codex/indexed-mesh
R0Y00:codex/sampled-coverage
R0Y00:codex/first-ms
R0Y00:codex/dual-ps
R0Y00:codex/ps-attribute
R0Y00:codex/compute-first
R0Y00:codex/ps-export
R0Y00:codex/readme-research-status
R0Y00:codex/ps-layout
R0Y00:codex/blast-window
R0Y00:codex/chart-caption
R0Y00:codex/reviewer-roles
R0Y00:codex/blast-aot
R0Y00:codex/archive-program
R0Y00:codex/crc-stream-program
R0Y00:codex/exe-image-data-chain
R0Y00:codex/local-cpu-fixture-coverage
R0Y00:codex/exe-bound-frame-chain
R0Y00:codex/exe-mapped-comparison
R0Y00:codex/contribution-dependencies
R0Y00:codex/exe-entry-aot
R0Y00:codex/bink-frame-heap-integration
R0Y00:docs/hardware-seven-reports
R0Y00:codex/bink-custom-heap
R0Y00:codex/bink-heap-callers
R0Y00:codex/discussions-entry-points
R0Y00:codex/gpu-community-batch-64
R0Y00:codex/ffx-scratch-writers
R0Y00:codex/generic-project-documentation
R0Y00:codex/ffx-dispatch-rcas
R0Y00:codex/four-windows-gpu-reports
R0Y00:codex/title-neutral-project-wording
R0Y00:codex/community-coverage-provenance
R0Y00:codex/rcas-packed-texels
R0Y00:codex/community-gpu-retests
R0Y00:codex/community-build-and-gpu-reports
R0Y00:codex/ffx-provider-loop
R0Y00:codex/ffx-recurrent-views
R0Y00:codex/ffx-recurrent-resource
R0Y00:codex/amd-wave64-reports
R0Y00:codex/ffx-backend-slots
R0Y00:codex/upscaler-device-init
R0Y00:codex/ffx-context-lifecycle
R0Y00:codex/ffx-version-query
R0Y00:codex/ffx-provider-contract
R0Y00:codex/typed-object-callback
R0Y00:codex/cpu-ordinal-import
R0Y00:codex/chained-cpu-ranges
R0Y00:codex/cpu-import-call
R0Y00:codex/cpu-direct-call
R0Y00:codex/cpu-leaf-aot
R0Y00:codex/community-project-status
R0Y00:codex/script-state-path-replay
R0Y00:codex/script-state-evidence
R0Y00:codex/bc7-resident-tail
R0Y00:codex/bcpack-mip-tail
R0Y00:codex/bc7-texture-draw
R0Y00:codex/asset-ranges
R0Y00:codex/pixel-constants
R0Y00:codex/pixel-aot
R0Y00:codex/pre-exe-workloads
R0Y00:codex/root-signature-device-coverage
R0Y00:engineering/packed-bvh-leaves
R0Y00:engineering/bvh-build-and-update
R0Y00:engineering/intake-root-roundtrip
R0Y00:community/gpu-check-release
R0Y00:community/english-contributor-entry
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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!1663
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1670"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by rm-NoobInCoding on 2026-11-24T16:46:52Z.
Change
tools/pixel_aot.pylowered the SDWA comparisons only for binary32 with whole-dword selections. The integer SDWA comparisons were refused:v_cmp_{f,lt,eq,le,gt,ne,ge,t}_{i32,u32}_sdwa;v_cmp_{lt,eq,le,gt,ne,ge}_{i16,u16}_sdwa(gfx10 has no f/t forms at 16 bits).This PR lowers these 28 forms with byte and word selections:
sext(). The selection uses the existingsdwa_source(), as for the SDWA integer operations.DWORDemits the same HLSL as its e32 spelling. A control asserts this.Refused:
sext(or a missing selection;execas the destination;v_cmpxand 64-bit SDWA forms.tools/scan_unsupported_shaders.pykeeps its own patterns, so a second commit accepts the same forms there, without f/t at 16 bits, and addstest_sdwa_int_compare_instructions.test_binary_scan_recognizes_vopc_sdwaused the word forv_cmp_gt_u32_sdwa vcc_lo, v1, v2 src0_sel:WORD_1 src1_sel:DWORDas its unlowered example; that word now sits in the supported binary, decoded bytools/disasm_rdna2.pyinto the syntax the lowering expects, andv_cmpx_eq_f32_sdwastays the unlowered example.Coverage: +28 gfx1013 and gfx1030 SDWA forms.
Verification
Base
578d1e1c, patches389422b9,85690efeand the round-trip commit. Windows 11 build 26300,devpreset, DXC 10.0.26100.0, NVIDIA GeForce RTX 4070 (driver 32.0.16.1714) and WARP.pixel_aot_sdwa_int_compare_hardwareandpixel_aot_sdwa_int_compare_warp: 2/2 passed, no skips. Both coverage records list all 28 forms.rdna2_tools_check.py: 146 tests OK (18 skipped without LLVM). All 49 platform-independent Python checks listed in AGENTS.md passed on the patch.check_sdwa_int_compare_lowering),form_coverage_check.py, docs links and bidi controls passed.The fixture (
tests/pixel_aot_check.py draw-sdwa-int-compare):s44copied tov20) with B (s45copied tov18) and selects 1.0 or 0 throughv_cndmask_b32.BYTE_1+sext /BYTE_2,WORD_1/WORD_0+sext,BYTE_3+sext /WORD_1,WORD_0+sext /BYTE_0, andDWORD/BYTE_3+sext.pixel_mismatch. The models are: selections ignored,sext()ignored, signedness swapped, and, for the 16-bit kinds, the whole selected word compared. That is 28 controls; a static check asserts each one has a distinguishing pair. In total, 132 draws from 8 compiles.sext()makespixel_aot_sdwa_int_compare_warpfail on the first program, with the passing rows reported asmismatch.LLVM 15 round trip: not run locally (no LLVM with gfx1013 on this host). The first two commits did not put the new forms through it:
check_binaryassembled nov_cmp_*_sdwainteger program (thanks @triggered02). The third commit adds the eightsdwa_int_predicate_groupprograms to its fixtures, so theAssemble and translate gfx1013 fixturesjob now assembles each program, disassembles it with LLVM 15, and requires the disassembly to translate exactly like the source text.Evidence and follow-up
All inputs are synthetic. The draws show that the translated shader computes the stated comparisons on desktop GPUs, not that the console does. The
v_cmpx_*_sdwaforms, which also writeexec, remain uncovered.Checklist
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:00:13Z.
Review: COMMENTED
Peer review of #1670 (
85690efe5b0b6d95a98a8d9b290bddf372d84647): no defects found (0 P1, 0 P2).Summary
tools/pixel_aot.py: lowers all 28 integer SDWA comparison forms (v_cmp_{f,lt,eq,le,gt,ne,ge,t}_{i32,u32}_sdwaandv_cmp_{lt,eq,le,gt,ne,ge}_{i16,u16}_sdwa), applyingsdwa_source(..., bool(sext))on sub-dword selections and matching the e32 operand/sign-extension semantics onDWORDand 16-bit forms, while rejecting 16-bitf/t, unbalancedsext(, constants, float modifiers,execdestinations, andv_cmpx/64-bit forms.tests/pixel_aot_check.py,CMakeLists.txt,docs/experiments.md: addscheck_sdwa_int_compare_lowering(covering all 28 forms, HLSL bit-extraction, e32 equivalence onDWORD, and 11 rejection cases),check_sdwa_int_predicate_draws(8 programs x 13 pairs + 28 negative-control wrong models), andpixel_aot_sdwa_int_compare_${adapter}withFORM_COVERAGE_RECORD. Title-neutral andgit diff --checkclean.Verification
python3 -B tests/pixel_aot_check.py-> PASSgit diff --check origin/main...HEAD-> PASSx2w_pipe.py win2025 1670):tests/form_coverage_check.py-> PASS (16.6s)--preset dev):cmake --build --preset dev --target offscreen_check+ctest --preset dev -R '^(pixel_aot_sdwa_int_compare_warp|pixel_aot_sdwa_integer_warp|pixel_aot_sdwa_unary_warp|pixel_aot_comparisons_warp|pixel_aot_compare_warp|pixel_aot_warp)$'-> 6/6 passed (20.65s:pixel_aot_sdwa_int_compare_warp3.05s;*_hardwareexcluded on VM)./O2(--preset release):cmake --build --preset release --target offscreen_check+ctest --preset release -R '^(pixel_aot_sdwa_int_compare_warp|pixel_aot_sdwa_integer_warp|pixel_aot_sdwa_unary_warp|pixel_aot_comparisons_warp|pixel_aot_compare_warp|pixel_aot_warp)$'-> 6/6 passed (20.68s:pixel_aot_sdwa_int_compare_warp3.06s).sdwa_source(..., bool(sext))->sdwa_source(..., False)intools/pixel_aot.py;python3 -B tests/pixel_aot_check.pyfailed as expected (AssertionErrorincheck_sdwa_int_compare_lowering, exit code 1). Restored viagit checkout -- ..AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T17:00:14Z.
Ran the LLVM job on this head. It passes, but it does not do what the PR body says it does, so the useful part of this comment is the second half.
The run. Independent run of the repository workflow on head
389422b9, in a fork rather than upstream, so it is a fresh execution rather than a re-read of the existing check:triggered02/Xbox2Windows, workflowwindows.ymlviaworkflow_dispatchon the PR head138615257733)ubuntu-22.04, step installsllvm-15and runstests/pixel_aot_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1from theCOMMON_LLVMlist inwindows.ymlUpstream CI on the same commit shows the same job green. I could not run it on Windows locally: this host has no LLVM 15 and no 7-Zip to extract a portable copy, and installing one machine-wide needs elevation I do not have. So this is the Ubuntu runner's LLVM, not a second platform.
The gap. The round trip does not assemble any of the 28 forms this PR adds.
check_binary()intests/pixel_aot_check.pyextends its fixture list with the SDWA operations (SDWA_ARITH,SDWA_UNARY,SDWA_PRESERVE_BODY,SDWA_PAD_BODY,sdwa_integer_group) but nothing that emitsv_cmp_*_{i32,u32,i16,u16}_sdwa; this PR does not touch that list. The only binary-side coverage is intests/rdna2_tools_check.py, and it is hand-written bytes:f904887d01000506moves from theunloweredsample to thesupportedsample, and the count assertion goes 2 → 3. That tests the scanner's recognition, not that an assembler accepts the text LLVM 15 will print back.So "the Ubuntu job is the first assembler check" is not accurate — no assembler sees these forms. The PR's real coverage is the static lowering check and the 132 draws, which do not depend on LLVM at all.
What would close it. Add the integer comparisons to the round trip, either by extending
check_binary()with the eightsdwa_int_predicate_group(kind, program)programs or as a dedicatedcheck_sdwa_int_compare_binary(): assemble each program, re-disassemble it, translate the disassembly, and require the HLSL to equal the text-input translation (the same pattern as the SDWA integer operations). That makes the Ubuntu job genuine coverage for the new forms and would catch a mnemonic or operand-order mistake that the text-input fixtures cannot see.I am happy to send that as a patch on top of this branch — I can verify it with the same workflow run in the fork, which is the only way I can run LLVM 15 here. Say the word and I will open it as a PR against your branch, or post the diff here if you prefer to apply it yourself.
Not claimed: that the new lowering is correct on hardware. My draws and static checks are not part of this comment; this is only about what the LLVM job does and does not cover.
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:31:02Z.
Review: COMMENTED
Review of head
c641cd3951(comment only, not an approval). My earlier review was at85690efe5b.Verdict: 0 P1 / 0 P2.
Since
85690efethe diff is 3 lines in tests/pixel_aot_check.py: the eight new programs are added tocheck_binary, which closes the gap that the LLVM round trip assembled none of the new forms. I ran those 8 programs through a copy of that loop with llvm-mc-19 (-mcpu=gfx1013): assemble, extract, disassemble, andtranslate(decoded) == translate(source)holds for all 8. The fullcheck_binarywith LLVM 19 stops earlier on an unrelated f16 fixture (v_cvt_f16_i16_e32 v1, 0xfff0prints differently than in LLVM 15).Semantics
sext()on either source, SGPR sources,s6destination).v_cmp_f_i16_sdwaandv_cmp_t_u16_sdwaare rejected by the assembler, which matches the 16-bit exclusion in the lowering and the scanner.sdwa_source(zero- or sign-extended undersext()); 16-bit forms take the low 16 bits of the selected word; i32 and u32 compare signed and unsigned; whole-dword selection matches the e32 spelling (a control asserts the same HLSL); a register holding only a low half is refused on sub-dword selections.test_binary_scan_recognizes_vopc_sdwafollow from a word moving from unlowered to supported; no assertion is weakened. No new test asserts source text.Run
python3 -B tests/pixel_aot_check.py,tests/rdna2_tools_check.py(146 OK, 18 skipped),tests/docs_links_check.py,tests/bidi_controls_check.py,tests/shader_census_check.py,tests/shader_corpus_report_check.py: all pass.git checkout -- <file>, green again):bool(sext)->Falsein the sub-dword path failscheck_sdwa_int_compare_loweringon thecmp23line; addingf|tto the scanner's 16-bit list fails rdna2_tools_check onv_cmp_f_i16_sdwa.({word})instead ofasint({word}), and the u16 branch comparing the whole word without& 0xffffu.Non-blocking
check_sdwa_int_compare_loweringpins the HLSL only for i16 program 0 and u32 program 0, so i32 signedness and the u16 mask are guarded only by the Windows draws. One static assertion for an i32 line and one for a u16 line would close that on Linux.Not run on Linux: the 132 draws and 28 negative controls (
pixel_aot_sdwa_int_compare_{hardware,warp}), DXC, D3D12, LLVM 15,form_coverage_check.pyandshader_probe_check.py(need iced_x86 and pefile). Real-hardware behaviour of the 16-bit selections is not established by any check here.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:40:38Z.
Review: COMMENTED
Dual-platform peer review at
head_sha:c641cd3951369167dfb22401ac1be8d81e407e14Findings
No blocking issues (0 P1, 0 P2).
tools/pixel_aot.pyandtools/scan_unsupported_shaders.py: lower the 28 integer SDWA comparison forms (v_cmp_{f,lt,eq,le,gt,ne,ge,t}_{i32,u32}_sdwaandv_cmp_{lt,eq,le,gt,ne,ge}_{i16,u16}_sdwa) withBYTE_0..3,WORD_0..1,DWORD, optionalsext(...), and lane-mask destination (vcc/vcc_lo/SGPR), while rejecting 16-bitf/t, unbalancedsext(, inline constants/literals, float modifiers,exec,v_cmpx, and 64-bit forms. Whole-DWORDselections reuseint_operand/int16_operandso emitted HLSL matches_e32.tests/pixel_aot_check.py,tests/rdna2_tools_check.py,CMakeLists.txt(test-only registrationpixel_aot_sdwa_int_compare_${adapter}),docs/experiments.md: include static lowering/refusal controls, LLVM assemble/disassemble round trip incheck_binaryfor all 8 programs, WARP draw checks with 28 negative-model mismatch controls, and scanner parity; title-neutral.Verification
git diff --check origin/main...HEAD: clean.python3 tests/docs_links_check.py: passed (16 Markdown files, 348 links).python3 tests/bidi_controls_check.py: passed (1276 tracked files).python3 -B tests/rdna2_tools_check.py -k test_binary_scan_recognizes_vopc_sdwa -k test_sdwa_int_compare_instructions: 2 tests ran, OK.python3 -B tests/pixel_aot_check.py: passed.llvm-mc-19 -arch=amdgcn -mcpu=gfx1013 -show-encoding: verified encodings forv_cmp_lt_i32_sdwa,v_cmp_gt_u32_sdwa,v_cmp_ge_u16_sdwa,v_cmp_ne_i16_sdwa.git checkout -- tools/pixel_aot.py):if kind in ("i16", "u16") and op in ("f", "t"):withif False:->python3 -B tests/pixel_aot_check.pyfailed incheck_sdwa_int_compare_lowering(AssertionError: translate accepted invalid input, exit 1).sext(sdwa_source(..., False)) ->python3 -B tests/pixel_aot_check.pyfailed incheck_sdwa_int_compare_lowering(HLSL mismatch oncmp23, exit 1).tests/form_coverage_check.pyok (16.5s).--preset dev):ctest --preset dev -R '^(pixel_aot_sdwa_int_compare_warp|rdna2_tools_check)$' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (5.66s:pixel_aot_sdwa_int_compare_warp2.47s,rdna2_tools_check5.59s)./O2(--preset release):ctest --preset release -R '^(pixel_aot_sdwa_int_compare_warp|rdna2_tools_check)$' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (5.94s:pixel_aot_sdwa_int_compare_warp2.35s,rdna2_tools_check5.87s).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by rm-NoobInCoding on 2026-11-24T17:14:36Z.
You're right, and thanks for running it.
check_binarynever assembled av_cmp_*_sdwainteger program, so my "first assembler check" line was wrong.I've applied your suggestion as
c641cd39: the eightsdwa_int_predicate_group(kind, program)programs are now in thecheck_binaryfixtures. Each is assembled with LLVM 15, disassembled, and the disassembly must translate exactly like the source text, the same pattern the SDWA integer operations use. No patch needed from your side. I can't run LLVM 15 on this host either, so theAssemble and translate gfx1013 fixturesjob on this push is the check; I'll follow up if it finds a spelling mismatch. The PR description is corrected.pixel_aot_check.pystatic controls pass locally.#1680 (the binary16 SDWA comparisons) had the same gap, and I'm closing it there the same way.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:34:43Z.
Thanks for this PR and the earlier fixes at
c641cd39;mainhas moved on and this branch now has a merge conflict.Could you rebase onto the current
mainand push so we can re-verify and merge? AI-assisted.Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-25T10:50:13Z.
Before you spend the rebase tedin7 asked for: most of this is already in
main, so here is what the rebase will actually leave.mainnow lowers the SDWA integer comparisons in two branches oftools/pixel_aot.py:Your branch adds a single regex over
(i32|u32|i16|u16)with the fullINT_COMPAREset, so after a rebase:i32/u32half is already there;i16/u16half is already there foreq,ne,lt,le,gt,ge;v_cmp_f_(i16|u16)_sdwaandv_cmp_t_(i16|u16)_sdwa— the two constant-result forms, whichmainstill refuses because its 16-bit regex lists only the six real comparisons.So the rebase is worth doing only if you want those two; otherwise this can close without losing anything.
INT_COMPAREisf, lt, eq, le, gt, ne, ge, t, sofandtare the whole delta.Context on the other PR: #1923 hits the same collision and its author is holding it for the same reason.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-25T10:50:52Z.
Correction to what I wrote above, after testing instead of reading the regexes.
I said the
v_cmp_f_(i16|u16)_sdwaandv_cmp_t_(i16|u16)_sdwaforms would be the remaining delta. They are not:mainrefuses both — callingpixel_aot.lower(["v_cmp_f_i16_sdwa ..."], 20, 24, [1,2,3,4], constant_descriptor=64)raisesUnsupported instruction;INT_COMPARE, but the code documents that the hardware does not have them.So the six 16-bit comparisons this PR adds are exactly the six
mainalready carries (eq, ne, lt, le, gt, ge), and all eight 32-bit ones are there too. After a rebase this PR adds no coverage at all — it can close without losing anything, and the rebase tedin7 asked for is not worth doing for the translation itself.What is still worth something is the test surface: 198 lines in
tests/pixel_aot_check.pyagainst whatmaincarries for the same forms, plus therdna2_tools_check.pyround trip. If you would rather not rebase a branch that adds nothing, that material could be ported intomainseparately.Sorry for the wrong first read — the regex made me assume those two forms were covered.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T04:46:58Z.
Main already lowers the 28 integer SDWA predicates in #1790. #1923 adds per-predicate 32-bit draw and refusal controls. The current 46-form controls and binary scanner check pass. For any extra 16-bit draw cases, please extend the existing fixture while keeping its single-SGPR destination rule. Thanks for the detailed signedness and selection comparisons. Closing this implementation as superseded.
Pull request closed