shader: accept binary16 and binary64 v_cmpx forms as pixel_aot region openers #1424
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1431"
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 Maxim-Root on 2026-11-24T11:23:43Z.
Change
Depends on #1411, which adds
v_cmpx_class_f32and is open. This branch includes it, so only the last commit is new: review only that commit. I will rebase once #1411 lands.The
v_cmpxregion opener (#932, #1335, #1411) accepted the VOPC_e32compares on binary32 and integers, plusv_cmpx_class_f32. This PR accepts the remaining VOPCv_cmpxforms. That is 34 forms:v_cmpx_{f,lt,eq,le,gt,lg,ge,o,u,nge,nlg,ngt,nle,neq,nlt,tru}_f16_e32) andv_cmpx_class_f16_e32;v_cmpx_class_f64_e32.With it,
form_coverage --gaps gfx1013lists no VOPC row.One lowering per kind, shared with
v_cmp. The opener does not reimplement anything:f16_comparisonandf16_classare moved unchanged out of thev_cmp_<op>_f16andv_cmp_class_f16branches, which now call them. Thef16_compares()program translates byte for byte as before.f64_comparisonis moved out of thev_cmp_*_f64/v_cmp_class_f64branch in the same way, next to the existingint64_comparison. The binary64 forms still compare raw words with thecmp_f64helpers and use no HLSL double. They need the declared binary64 denormal entry state, exactly asv_cmp_*_f64does.v_cmpof the same form: 69 binary16 pairs and 4 binary64 pairs, the class tests included.Operand rules are the existing e32 ones:
Refused, with controls:
_e64, SDWA, an SGPR or single-VGPR VSRC1 where a pair is required, an SGPR class mask, modifiers, and a binary64 form without the binary64 entry state.Refs #932.
Verification
Windows 11 Pro 26300.9818, MSVC 14.44.35207, Python 3.12.10, at
8f9faa92(on429a8b92). Adapters: NVIDIA GeForce RTX 3070 Ti (10de:2482), driver 32.0.16.2114, and WARP 10.0.26100, with the D3D12 debug layer enabled.New draws in
pixel_aot_cmpx_regions_{warp,hardware}:v_cmp_*_f64draw, on all 16CMPF64_WORDSrows againstcmpf64_expected. Those rows separate the unsigned integer order, unequal signed zeros, flushed denormals and a high-word-only NaN test. Swapped operands on -1.0 against -2.0 and flipped class channels must mismatch.Commands and results:
cmp_f64,compareandcomparisonsexercise the movedv_cmp_f16/v_cmp_f64lowering.ctest --preset dev --no-tests=error -R '^(pixel_aot_|compute_store_aot_).*_warp$' -j 16: 96/96.python -B tests/pixel_aot_check.py binary <llvm-mc> <llvm-objcopy> <LLVM-C.dll>: exit 0. This runs the translator controls and the LLVM 15.0.7 gfx1013 round trip of the ten new programs.AGENTS.mdpass, includingform_coverage_check(now 95v_cmpxforms),rdna2_tools_checkanddocs_links_check.pixel_aot_cmpx_regions_warpatbinary64 v_cmpx draw on warp, group=0, where all 16 pass cases mismatch;tools/form_coverage.pyon the WARP run above: gfx1013 goes from 1057 to 1091 of 1968 (main+ #1411 → this branch) and gfx1030 from 1047 to 1081. The VOPC gap list goes from 34 rows to 0.Not shown, as before for
v_cmpx: the EXEC intersection rule is taken from the ISA text and LLVM, not measured on gfx1013 hardware.Checklist
AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:43:16Z.
Review: COMMENTED
Reviewed commit
8f9faa9201eb090d51753c2239a3cea3faae9689(tools/pixel_aot.py,tests/pixel_aot_check.py,tests/form_coverage_check.py,docs/experiments.md).Audit notes
tools/pixel_aot.py):f16_comparison,f16_class, andf64_comparisonare factored out cleanly fromv_cmp_*_f16/v_cmp_*_f64and shared with thev_cmpxregion opener without duplicating predicate logic.v_cmpxforms enforcehalf_denorm == HALF_DENORM_PRESERVE, matchingv_cmp_*_f64.vsrc1requires a VGPR pair for binary64 predicates and a single VGPR forv_cmpx_class_f64and binary16 forms; source modifiers (|...|,abs(,neg(,-[vs]...) are rejected while negative inline literals (e.g.-1.0,-2.0) remain accepted; literals > 16 bits are rejected for binary16.tests/pixel_aot_check.py,tests/form_coverage_check.py):v_cmpxopener and itsv_cmpcounterpart (binary16 predicates + class, binary64 predicates + class) and refusal of_e64, SDWA, SGPRVSRC1, single-VGPRVSRC1for 64-bit predicates, source modifiers, and >16-bit literals on binary16.CMPF64_WORDSwith mismatch controls.form_coverage_check.pyupdatesv_cmpxcount from 61 to 95 and clearscompare_neighbours.#1411is now merged onmain, and this branch is still based on429a8b92, so a rebase onto currentmainis needed before merge (no issues in8f9faa92itself).Verification
Linux (at
8f9faa9201eb090d51753c2239a3cea3faae9689):git diff --check origin/main..HEAD: clean (exit 0).python3 tests/docs_links_check.py:Checked 16 Markdown files and 322 links.(exit 0).python3 tests/bidi_controls_check.py:Checked 1181 tracked source, script and build/CI files: no bidirectional controls.(exit 0).python3 -B tests/pixel_aot_check.py: exit 0.python3 -B tests/rdna2_tools_check.py:Ran 140 tests in 2.692s — OK (skipped=18).Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP, commit
8f9faa9201eb090d51753c2239a3cea3faae9689):tests/form_coverage_check.py:form coverage checks passed(42.3s, exit 0).--preset dev):cmake --build --preset dev --target offscreen_check -- -j 6: built cleanly (10.30s).ctest --preset dev -R '^pixel_aot_(cmpx_regions|cmp_f64|compare|comparisons)_warp$' --parallel 4 --no-tests=error --output-on-failure: 4/4 passed (pixel_aot_cmp_f64_warp4.63s,pixel_aot_cmpx_regions_warp6.70s,pixel_aot_comparisons_warp8.30s,pixel_aot_compare_warp13.63s)./O2(--preset release):cmake --build --preset release --target offscreen_check -- -j 6: built cleanly (7.81s).ctest --preset release -R '^pixel_aot_(cmpx_regions|cmp_f64|compare|comparisons)_warp$' --parallel 4 --no-tests=error --output-on-failure: 4/4 passed (pixel_aot_cmp_f64_warp4.43s,pixel_aot_cmpx_regions_warp6.58s,pixel_aot_comparisons_warp8.26s,pixel_aot_compare_warp13.79s).*_hardwaretests were not run (no physical GPU on the verification node).Looks solid once rebased onto
main.