shader: lower quad-local DPP16 and DPP8 v_movrel ops in pixel_aot #422
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/428"
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 KomaGuy on 2026-11-22T01:41:29Z.
Change
Lower quad-local
DPP16(quad_perm) andDPP8(dpp8) forms for all four relative VGPR-indexing move instructions intools/pixel_aot.py, covering the final 4DPP16and 4DPP8forms (+8 forms on bothgfx1013andgfx1030):v_*_dppinstructions (4):v_movreld_b32_dpp,v_movrels_b32_dpp,v_movrelsd_b32_dpp, andv_movrelsd_2_b32_dpp.m0indexing:m0immediates directly (VGPR[dst + m0],VGPR[src + m0], or splitsrc + m0[9:0]/dst + m0[25:16]onv_movrelsd_2_b32_dpp).s_bfe_u32,s_and_b64,s_or_b64,s_lshl_b64,s_lshr_b64, ands_mov_b32so runtime-dynamicm0offsets proven bounded (up to 16 reachable slots, all initialized and in0..255) lower to conditional VGPR selects and per-slot conditional updates (reading all reachable sources before updating destinations, supporting overlapping source/destination banks).QuadReadAcross*,QuadReadLaneAt,WaveGetLaneIndex() & 3u), emitting zero extra helper functions for existing shaders.m0still holdinginterp_base, unbounded or overly wide dynamicm0, out-of-range or uninitialized reachable VGPRs, source modifiers (-/|.|), cross-quadDPP8,row_*/wave_*, partial masks, non-VGPR operands, WQM, andvmcnt/sample_desthazards.DPP_MOVREL_BODYderives quad coordinates fromuv.x/uv.y, tests all 4 forms across bothDPP16andDPP8with both runtime-dynamicm0(different VGPR indices across 2 constant sets on one compiled shader) and staticm0, and verifies 5 negative mutations.Verification
Tested on Linux x86_64 (Python 3.13.5, LLVM 19.1.7, Clang 19.1.7) on top of
ac48a50:python3 -B tests/pixel_aot_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so— passed (controls, negative controls, andllvm-mc -mcpu=gfx1013assembly→DXBC/XDAT/XBCH/FSSM→disassembly→lowering parity forDPP_MOVREL_BODYand all existing fixtures).python3 -B tests/ffx_dispatch_aot_check.py llvm-mc-19 llvm-objcopy-19 libLLVM-19.so— passed.python3 -B tests/script_state_check.py,tests/bcpack_check.py,tests/resource_ranges_check.py,tests/layout_chunks_check.py,tests/docs_links_check.py,tests/bidi_controls_check.py— all passed.tools/form_coverage.pyrecords 4DPP16and 4DPP8forms against bothdocs/coverage/gfx1013.tsvanddocs/coverage/rdna2.tsv.DPP_MOVREL_BODYand all 5 negative mutations on a 4-lane SIMT 2×2 pixel quad C++20 harness withclang++-19 -std=c++20 -O2 -Wall -Wextra -Wpedantic -Werror -fsanitize=undefined,address— bit-exact match across all 4 quad lanes on both constant sets and all 5 mutations caught; 0 sanitizer errors.dxc -Gis -T ps_6_0), WARP (pixel_aot_warp), and hardware (pixel_aot_hardware) checks were not run locally on Linux; relying on thebuild-and-testWindows CI job to verify DXC compilation and D3D12 WARP quad readback.Evidence and follow-up
tests/pixel_aot_check.pyare original MIT-licensedgfx1013assembly sequences built from source at test time.M0[31:0]forv_movrel{s,d,sd}_b32,M0[9:0]source /M0[25:16]destination forv_movrelsd_2_b32) and DirectX Shader Model 6.0 quad-intrinsic specification.f32/move/select), #414 (23 integer/bitwise/shift), #419 (23f16), #421 (19 conversions), and #423 (12 extraf32/carry/dot) with zero opcode overlap — completing 101/101DPP16+ 101/101DPP8ongfx1013and 100/100DPP16+ 100/100DPP8ongfx1030.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T02:38:59Z.
Physical-silicon verification: v_movrel* DPP forms pass on wave 4 / 32 / 64
Independent verification of the wave-width-independence claim ("valid across wave sizes 4 (WARP) through 64") that CI cannot cover (CI excludes
_hardwaretests). Measured on this dual-GPU Windows box. This is the first Windows/hardware coverage for the dynamic-VGPR-indexing forms.PR head:
5654af9e70b7e109d80860060fd96c333f62d8ef(single commit onac48a50, an ancestor of currentmain; PR mergeable/clean).Environment
tools/dev.ps1(VS 2022 BuildTools, MSVC 14.44.35207); venv Python forINTAKE_PYTHONC:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/dxc.exe(Windows SDK 10.0.26100.0, CTestfind_program)adapter=Microsoft Basic Render Driver vendor=1414 device=008c,driver=10.0.26100.9711— native wave width 4adapter=AMD Radeon RX 9060 XT vendor=1002 device=7590,driver=32.0.32029.2010— native wave width 64 (RDNA4)adapter=NVIDIA GeForce RTX 5060 Ti vendor=10de device=2d04,driver=32.0.16.2124— native wave width 32Commands (exact)
Results
pixels=4096 channels=16384 max_absolute_error=0pixels=4096 channels=16384 max_absolute_error=0pixels=4096 channels=16384 max_absolute_error=0llvm-objcopy+LLVM-C.dll): exit 0 —check_binaryis assert-only/silent on success and includeswith_constants(DPP_MOVREL_BODY): gfx1013 assembly → DXBC/XDAT/XBCH/FSSM → disassembly → lowering parity passed alongside all pre-existing fixtures.FORM_COVERAGE_RECORDconfirms all four new opcodes translated on every backend:v_movreld_b32_dpp v_movrels_b32_dpp v_movrelsd_b32_dpp v_movrelsd_2_b32_dpp(both the runtime-dynamic-m0and static-m0constant sets exercised by the fixture).pixel_aot_*skips on any backend; capability skips outside this group (bvh_wave64_*,wave_shuffle_warp) did not occur here.Wave-width verdict
The wave-width-independence claim holds on silicon as measured for the dynamic-VGPR-indexing forms: bit-exact readback (
max_absolute_error=0over 16384 channels) on all three native widths (WARP 4, RTX 5060 Ti 32, RX 9060 XT 64) — i.e. theQuadReadAcross*/QuadReadLaneAt-based conditional-select lowering behaves identically whether the quad occupies a full wave (WARP width 4), a quarter wave (RDNA4 wave 64), or half a Blackwell wave (width 32). Everything above was measured on this box except the native wave-width labels themselves, which are platform facts for these adapters.#421 (conversions) and #423 (extra f32/carry/dot) were verified in separate worktrees; separate comments posted there.
AI-assisted; runs executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T17:43:32Z.
@KomaGuy Independent AMD (RDNA4, native wave64) result on
2d16598. Measurements only, no code change.Why this adapter matters for these forms
Your lowering turns quad-local
DPP16/DPP8relative moves intoQuadReadAcross*,QuadReadLaneAtandWaveGetLaneIndex() & 3u. The RX 9070 XT is a native wave64 part, not wave32, so the quad-intrinsic path is exercised under a different lane topology than your adapter. That is the specific thing this run adds; it is not just a repeat of your numbers.Environment
native_wave_width=64 logical_width=64measured in the same worktree (bvh_waves_hardware); thepixel_aotharness does not print the wave width itself.debug_layer=unavailable(Tools.Graphics.DirectXisNotPresenthere)2d16598.Commands
Observed
pixels=4096 channels=16384and one atpixels=64 channels=256, every onemax_absolute_error=0.max_absolute_error=0.What it establishes
The static and runtime-dynamic
m0resolution, the splitm0[9:0]/m0[25:16]destination path onv_movrelsd_2_b32_dpp, and the refusal set (unboundedm0, out-of-range or uninitialised indexed VGPRs, cross-quadDPP8,row_*/wave_*, partial masks, WQM) behave identically on a wave64 adapter, whereWaveGetLaneIndex() & 3uhas to select the same quad as on wave32.The negative mutations built into
DPP_MOVREL_BODYare part of the same run and did not fire, so the fixtures are still discriminating.Limit
The harness prints per-draw counters but no per-program label, so this is a whole-suite result: I can say every one of the 111 draws matched with zero absolute error, not which line of output belongs to which of the four instructions.
AI-assisted; runs executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-22T20:11:24Z.
Thanks @thepatrickworld for the independent RX 9070 XT wave64 verification on the
v_movrel*forms! Holding this branch in place until the earlier DPP PRs land, then I'll refresh ontomain.Imported from R0Y00/Xbox2Windows. Originally posted by FZNull on 2026-11-23T00:30:11Z.
Independent Windows verification on a physical GPU (the PR author verified only on Linux and left Windows to CI). I trial-merged this PR onto main and ran the draws here.
Merge state: conflicts against current main (
5a2c782) indocs/experiments.mdandtests/pixel_aot_check.py, both from additive hunks landing on the same regions (main gained #477/#475/#471 content there).tools/pixel_aot.pymerged cleanly. I resolved the two hunks locally for measurement only; nothing was pushed. The PR needs a rebase to be mergeable (mergeable_state: dirty).Environment: Windows 11 build 26300.9974, NVIDIA GeForce RTX 4060, driver 32.0.16.2124, debug layer unavailable, MSVC 19.50.35726, Windows SDK 10.0.26100.0, DXC 1.9.2609.5, Python 3.13.12.
Build: 881/881 targets, exit 0.
pixel_aot_warpmax_absolute_error=0pixel_aot_hardwaremax_absolute_error=0for every case. ctest reportsTimeoutbecause the test'sTIMEOUTproperty is 60 s and the draw takes 61.2 s on this machine (see #448).tests/rdna2_tools_check.pytests/form_coverage_check.pyThe four new forms do run in the hardware draw:
FORM_COVERAGE_RECORDcontainsv_movreld_b32_dpp,v_movrels_b32_dpp,v_movrelsd_b32_dppandv_movrelsd_2_b32_dpp, matching the four DPP16/DPP8 forms this PR declares.The timeout is not a mismatch — the same test needs about 59 s on this adapter on unmodified main and crosses the 60 s limit once the extra draw cases are added. Raising or removing the per-test
TIMEOUT, or landing the batch-device mode proposed in #448, would let the hardware job report the result instead of a timeout.Verdict on behavior: the new DPP16/DPP8
v_movrel*lowering produces correct pixels on RTX 4060 hardware and WARP at this commit. The blocker for merging is the rebase, not the DQ.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T17:23:39Z.
Follow-up: the three earlier DPP PRs are now measured on RDNA4. Since your note above,
#421,#423and#419all have an independent wave64 run plus a coverage audit:#421— https://github.com/R0Y00/Xbox2Windows/pull/421#issuecomment-7107500778#423— https://github.com/R0Y00/Xbox2Windows/pull/423#issuecomment-7107956814#419— https://github.com/R0Y00/Xbox2Windows/pull/419#issuecomment-7108482626All three are green on the RX 9070 XT, and in each case I checked the fixture against an external mutation rather than trusting the pass. Two of the findings are code-level rather than coverage-level, so they may matter for the refresh:
#423:v_sin_f32_dppandv_cos_f32_dppemitsin((x) * 6.283185307179586f)directly, whilev_sin_f32/v_cos_f32go throughsin32/cos32, which callturns()first. The comment above those helpers explains why the reduction is required. Same instruction, two lowerings: past|x| = 0.5the DPP path loses precision and beyond ~2.7e6 it carries no information. No case in the fixture exceeds|x| = 0.25, so this is not caught.#419:dpp_sincos_f16special-casescosine && abs(phase) == 0.25and!cosine && phase == 0.0, then falls through topack16_rne(sin(phase * 2π)). At a half turn that lands on an f16 subnormal: WARP returns0x8001, RDNA4 returns0x0000for the same shader. That is also why no endpoint case exists at±0.5turns — it would make_warpand_hardwaredisagree. A guard at±0.5turns, mirroring the cosine one, makes the case backend-stable.Unrelated to this series, but it affects anyone measuring on AMD:
maincurrently has one red hardware test,pixel_aot_comparisons_hardware(041ca68, casef32-cmp-1), caused by a subnormal comparison meeting the FP32 flush. Reported on#855.On
#428itself: still2d16598, basea8e2d398a, which is now 807 commits behindmain(a8a88e1), with conflicts in both files. I am deliberately not measuring the trial merge — with eight conflict regions intools/pixel_aot.py, that would be measuring the resolution, not your PR. Ping me when the rebase lands and I will re-run the wave64 draw on the refreshed head the same day, with the same command and adapter, so the numbers stay comparable with the2d16598run above.AI-assisted; all runs and mutations executed locally on the adapter described in the earlier comment.
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-23T19:52:38Z.
Thanks @FZNull for the RTX 4060 verification and @thepatrickworld for the thorough RDNA4 audits across the whole series! I'm addressing the feedback on #421 and #423 now, and I'll rebase #428 onto
main(with its own split CTest entry) and ping you for a wave64 re-run once the earlier DPP PRs land.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T23:18:11Z.
#421 has now merged. Please go ahead with the refresh you described. #428 currently conflicts in the lowerer, draw fixture and experiment notes. Please keep the standalone CTest and the static/dynamic m0 and overlap controls. Once the refreshed head is ready, the independent wave64 rerun can use that exact revision.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T23:35:04Z.
Refreshed head
d0bede8c(merge of2d16598with45ad903) measured on the RX 9070 XT, as asked.adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550,backend=hardware, driver32.0.32029.2010,debug_layer=unavailable, Windows build26200.9711,XBOX2WINDOWS_ADAPTERset to the adapter name1.9.2602.17, presetdev, clean tree (git status --porcelainempty),INTAKE_PYTHONset to the local venv, 122^pixel_aot_entries registeredctest --preset dev --no-tests=error -R '^pixel_aot_dpp_movrel_' -V, three consecutive runsExit 0 in each run, both entries passed in all three (six executions, none skipped), and each draw reports
pixels=4096 channels=16384 max_absolute_error=0.The five mutation controls are part of the same exit code rather than a separate line:
pixel_aot_check.py:15758-15775raises unless every mutated draw returns 1 with apixel_mismatchin stderr, so a 0 here means all five were rejected after the rebase.Scope, so this is not read as more than it is: only the
^pixel_aot_dpp_movrel_selection ran at this head; the rest of the hardware suite was not replayed there. Wave width is not printed by the harness either — the 64 lanes on this adapter were measured withnative_wave_widthat2d16598, not at this head, so treat "native wave64" as the architecture, not as a fresh measurement.What is new is the split entry, not the coverage: these four forms already had hardware runs in this thread through the whole
pixel_aot_hardwareentry —5654af9eon the RX 9060 XT and RTX 5060 Ti, and2d16598on this adapter.Two things on the merge itself.
git merge-tree --write-tree origin/main d0bede8reports no conflict againstmainatd4cbfcd. And the Linux jobs on this head passed at 23:27Z (Run platform-independent Python checks,Assemble and translate gfx1013 fixtures); the two Windows jobs were still in progress when I looked, so nothing here should be read as their result.One suggestion for the PR body, since it is the reason the refresh matters: the Linux evidence is still stated on top of
ac48a50, which the refresh supersedes. Thepixel-binaryjob atd0bede8crunspixel_aot_check.py binary(windows.yml:34) and passed, so that line can move to the head — "Linux x86_64 checks,pixel_aot_check.py binaryincluded, pass in CI atd0bede8c; Windows DXC, WARP and hardware are covered by the reruns in this thread."AI-assisted; one machine, one adapter.
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-23T23:42:27Z.
Refreshed onto
main(45ad903c, after #419, #421, #423, and the #1030 uniform quad-read bit-mask fix) ind0bede8c, with all 4 CI checks green:main's sharedparse_dppandemit_quad_swizzle_u32helpers (removing the duplicate DPP helpers and rejecting unprovedbound_ctrl:/fi:modifiers).TrackedScalarso any scalar overwrite automatically invalidatesscalar_mask(with a negative control incheck_controls).pixel_aot_dpp_movrel_{hardware,warp}(draw-dpp-movrel, withFORM_COVERAGE_RECORD) and updateddocs/experiments.md.@thepatrickworld — refreshed head is
d0bede8candMERGEABLEif you'd like to re-runpixel_aot_dpp_movrel_hardwareon RDNA4.Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T23:49:54Z.
Already run — the rerun on
d0bede8cis above, posted before your message crossed mine:pixel_aot_dpp_movrel_hardwarePassed 2.14 / 1.79 / 1.87 s and_warpPassed 1.44 / 1.14 / 1.24 s, three runs each,max_absolute_error=0over 16384 channels, no skips, on an RX 9070 XT (1002:7550, driver32.0.32029.2010).So nothing is waiting on me for this head. The one thing I flagged there and would repeat: wave width is not printed by the harness, so the "wave64" in the run is the architecture, not a measurement at
d0bede8c.AI-assisted.