shader: lower quad-local DPP16 and DPP8 conversion ops in pixel_aot #415
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/421"
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:15:50Z.
Change
Lower quad-local
DPP16(quad_perm) andDPP8(dpp8) forms for all 19 conversionVOP1/VOP2operations intools/pixel_aot.py, covering 19 additionalDPP16and 19 additionalDPP8forms (+38 forms on bothgfx1013andgfx1030):v_*_dppinstructions (19):v_cvt_f32_i32_dpp,v_cvt_f32_u32_dpp,v_cvt_f32_ubyte0_dpp,v_cvt_f32_ubyte1_dpp,v_cvt_f32_ubyte2_dpp,v_cvt_f32_ubyte3_dpp,v_cvt_off_f32_i4_dpp.v_cvt_i32_f32_dpp,v_cvt_u32_f32_dpp,v_cvt_flr_i32_f32_dpp,v_cvt_rpi_i32_f32_dpp.v_cvt_f16_i16_dpp,v_cvt_f16_u16_dpp,v_cvt_i16_f16_dpp,v_cvt_u16_f16_dpp,v_cvt_norm_i16_f16_dpp,v_cvt_norm_u16_f16_dpp.v_sat_pk_u8_i16_dpp,v_cvt_pkrtz_f16_f32_dpp.src0asuintbits via SM 6.0 quad intrinsics, preservesvdst[31:16]on all 7 16-bit destination forms pergfx1013(rejecting uninitialized destination VGPRs), applies saturating integer conversions and deterministicpack16_rne/pack16_rtzhelpers emitted only when used, allows-/|.|only onDPP16float-input forms, and rejects integer-input modifiers,DPP8modifiers, cross-quadDPP8,row_*/wave_*, partial masks, non-VGPR operands, WQM, andvmcnthazards.DPP_CVT_BODYderives quad lane ID{0, 1, 2, 3}fromuv.x/uv.y, tests all 19 forms across 2 constant sets, and checks 5 negative mutations (AcrossXvsAcrossY, cyclicdpp8rotation,rpivsflr,norm_i16vsnorm_u16, andDPP16negation).Verification
Tested on Linux x86_64 (Python 3.13.5, LLVM 19.1.7, Clang 19.1.7) on top of
e5e0079: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_CVT_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 19DPP16and 19DPP8forms against bothdocs/coverage/gfx1013.tsvanddocs/coverage/rdna2.tsv.DPP_CVT_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.f32/move/select), #414 (23 integer/bitwise/shift), and #419 (23f16) with zero opcode overlap (combined85/101DPP16+85/101DPP8).Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by abilliontokens on 2026-11-22T02:39:03Z.
Physical-silicon verification: DPP conversion 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.PR head:
3b88c14f5e75d533971f086857ee68d205141667(single commit one5e0079, which is 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_CVT_BODY), i.e. gfx1013 assembly → DXBC/XDAT/XBCH/FSSM → disassembly → lowering parity passed for this fixture alongside all pre-existing fixtures.FORM_COVERAGE_RECORDconfirms all 19 new opcodes translated on every backend — exactly the 19 forms listed in the PR body:v_cvt_f32_i32_dpp v_cvt_f32_u32_dpp v_cvt_f32_ubyte0_dpp v_cvt_f32_ubyte1_dpp v_cvt_f32_ubyte2_dpp v_cvt_f32_ubyte3_dpp v_cvt_off_f32_i4_dpp v_cvt_i32_f32_dpp v_cvt_u32_f32_dpp v_cvt_flr_i32_f32_dpp v_cvt_rpi_i32_f32_dpp v_cvt_f16_i16_dpp v_cvt_f16_u16_dpp v_cvt_i16_f16_dpp v_cvt_u16_f16_dpp v_cvt_norm_i16_f16_dpp v_cvt_norm_u16_f16_dpp v_sat_pk_u8_i16_dpp v_cvt_pkrtz_f16_f32_dpp.pixel_aot_*skips on any backend (thebvh_wave64_*/wave_shuffle_warpcapability skips are outside this group and did not occur here).Wave-width verdict
The claim that the quad-local DPP lowering is wave-width independent holds on silicon as measured: bit-exact readback (
max_absolute_error=0over 16384 channels × 2 constant sets) on all three native widths (WARP 4, RTX 5060 Ti 32, RX 9060 XT 64). Everything above was measured on this box except the native wave-width labels themselves, which are platform facts for these adapters (not re-derived by this harness run).Note: this branch contains only this PR's own fixture (
DPP_CVT_BODY), so this run measures #421's forms specifically. #423 and #428 were verified in separate worktrees (separate comments); #408/#414/#419 were not re-run here.AI-assisted; runs executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-22T17:43:33Z.
@KomaGuy Independent AMD (RDNA4, native wave64) result on
3c042c9. Measurements only, no code change.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)3c042c9.Commands
Observed
pixels=4096 channels=16384and one atpixels=64 channels=256, every onemax_absolute_error=0.max_absolute_error=0.Why an AMD result is worth having here
The conversions go through the same quad-local path (
QuadReadAcross*,QuadReadLaneAt,WaveGetLaneIndex() & 3u). On a native wave64 part the lane-to-quad mapping has to produce the same source lane as on wave32, and rounding/conversion differences are exactly where a vendor-specific drift would show as a non-zero absolute error rather than a crash. None appeared: 16,384 channels per draw matched the CPU reference exactly on both backends.Limit
The harness prints per-draw counters but no per-program label, so this is a whole-suite result: every one of the 111 draws matched, but I cannot attribute a given line of output to a specific conversion form.
AI-assisted; runs executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-22T20:11:22Z.
Thanks @thepatrickworld for the independent RX 9070 XT wave64 verification! Holding this branch in place until #419 lands, then I'll refresh onto
main.Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T16:40:35Z.
Measured on RDNA4 at
3c042c9, plus one thing the fixture cannot see. Hardware pass, external mutation catch, and where the coverage claims outrun the fixture.Environment and result
Windows 11 25H2 (build 26200.9711), MSVC 19.44 + DXC, adapter AMD Radeon RX 9070 XT (vendor
1002, device7550), driver32.0.32029.2010,debug_layer=unavailable, head3c042c9, clean build.pixel_aot_hardwarePassed 25.65 s,pixel_aot_warpPassed 11.18 s. All five internal mutation controls fire on both backends.The fixture bites (checked from outside)
I made the swizzle inert in
emit_quad_swizzle_u32(perm = [0, 0, 0, 0], every lane reads lane 0 — the classic fan-out bug) and re-ran the hardware test:So the draw does discriminate the live swizzle path. Tree restored afterwards,
git statusclean.What the fixture does not establish
1.
vdst[31:16]preservation is the central claim and nothing observes it.v32..v38are zeroed (tests/pixel_aot_check.py, the sevenv_mov_b32_e32 v3x, 0) and every consumer reads the low half only (v_cvt_f32_f16onv32/v35,v_cvt_f32_ubyte0/1onv33/v36/v37/v38). Preserving the high half and zeroing it produce the same 64 pixels. Preloading those destinations with0xdead0000and readingubyte2/ubyte3would make the claim observable in one line.2. Fourteen of the nineteen forms have a quad-invariant source, so their permutation is provably inert.
v28/v29/v39/v40arev_movcopies ofs44..s47; every lane holds the same value, so anyquad_perm/dpp8gives the same result. The live swizzles arev_cvt_pkrtz_f16_f32_dpp(sourcev8/v9, the interpolated UV),v_cvt_i32_f32_dpp,v_cvt_u32_f32_dppandv_cvt_f32_u32_dpp. The other fourteen — includingflr,rpi, the fourubyteforms,off_f32_i4, the six 16-bit forms andsat_pk— are only tested for instruction identity, not for lane mapping. Feeding them fromv20instead ofs45would cover them.3. On the one live
dpp8form, only one mux branch is observed. The generated code builds all four (QuadReadLaneAt(dpp36_in, 0..3)) then selects byWaveGetLaneIndex() & 3u, but the value that reaches the output isQuadReadLaneAt(asuint(alu36), 3)— lane 3's pick. Lanes 0-2 of the mux are computed and never asserted.4.
pack16_rne/pack16_rtzrounding is never exercised. Every input in both sets is exactly representable in half (-5,14,122,-128,512;1.5,-1.5; the UV integers). The round-bit path, ties-to-even, subnormals,infand NaN in the two helpers are unreached —v_cvt_f16_i16with2049/2050/2051andpkrtzwith1 + 2^-11would hit them.5. No negative control for any new reject path. None of the eleven new error strings appears in
tests/(zero occurrences), while the rest ofpixel_aot_check.pycarries more than a hundredmust_reject/expect_value_errorcases. Two of those paths also report the wrong cause:dpp8:[0,1,2,3,7,6,5,4]is quad-local — lanes 4..7 only read lanes 4..7 — but it is refused asCross-quad DPP8 permutation is unsupported. The rule requiresperm8[4:] == perm8[:4] + 4, which is stricter than the hardware. A legal permutation is rejected, and the message points at the wrong reason.Invalid conversion DPP operation, and an uninitialised 16-bit destination raises a bareKeyError: 'v50'instead of the intended message.fi:andbound_ctrl:are parsed and dropped: a program carryingfi:1translates as if the fetch were active.6. One question, not a finding.
v_cvt_rpi_i32_f32is lowered asfloor(x + 0.5f), anddpp_cvt_referenceuses the same formula. If RPI is round-to-nearest with ties away from zero, then for-1.5the answer is-2, not-1— and no case can catch it, because the reference shares the implementation's formula. Worth confirming against the ISA before someone relies on it.None of this blocks the lowering: where the fixture exercises it, it is green on RDNA4 and it catches a broken swizzle. The gaps are in what the PR body claims (
all 19 forms across permutations) versus what is observed, and in the reject paths, which have no coverage at all yet.Happy to re-run after any of the above changes — the negatives in item 5 are one
must_rejectblock each, and item 1 is the one I would add first.AI-assisted; the run, the external mutation and the translator probes were executed locally on the adapter above. The coverage inventory comes from a separate review pass and was re-verified here at
3c042c9.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T16:51:10Z.
Thanks for separating the native-wave64 run from the mutations and the coverage gaps. #421 remains behind #419. For the next candidate, first make the high-half sentinel observable, feed lane-varying inputs to the forms claimed as swizzled, and observe all four DPP8 lanes. Then add targeted refusals for unproved modifiers and the uninitialized destination. Report the stricter repeated-quad selection with its own diagnostic. Please include rounding cases with independently specified results, including negative half ties for RPI and inputs that distinguish RNE from RTZ. The current RDNA4 result and forced-lane mutation are still useful evidence for the paths they actually exercise.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T17:26:03Z.
Thanks — taking the list as ordered. Two things I can already contribute from the work on the later PRs in the series.
On item 1 (high-half sentinel): the pattern already exists and is proven in
#419.check_dpp_f16_trigpreloads the destination withv_mov_b32_e32 v12, 0x3f400000, runsv_cos_f16_dpp v12, v20, and expectsresult | 0x3f400000in an integer export (translate_int). I zeroed the preservation in the emitter (dpp_hi = asuint(...) & 0u) and all five rows turned red, so it is a real control, not a decorative one. For the 32-bit forms the equivalent is: preloadv32..v38with0xdead0000instead of0, then read bytes 2 and 3 (v_cvt_f32_ubyte2/ubyte3) into the channel sum. Today those destinations are zeroed and every consumer reads the low half, so preserving and zeroing the high half produce identical pixels.On item 6 (rounding with independently specified results): exact values, and three traps. I computed these by hand rather than with the project's helpers, because
half_rtzandpack16_rneshare the emitted algorithm and would agree with any bug.RPI, ties (
v_cvt_rpi_i32_f32):-0.5,-1.5,-2.5give-1,-2,-3under ties-away-from-zero, and0,-1,-2underfloor(x + 0.5f).+0.5,+1.5,+2.5are useless: both rules agree (1,2,3).RNE vs RTZ on
v_cvt_f16_i16(RNE is what the emitter claims for this form):2051→0x6802(RNE) vs0x6801(RTZ)4099→0x6c01vs0x6c00-2051→0xe802vs0xe8012049and2050are duds: both give the same word under either rule. Worth knowing before they go in the fixture and look like coverage.RNE vs RTZ on
v_cvt_pkrtz_f16_f32(RTZ is the claim):1 + 3 * 2^-11 = 1.00146484375→0x3c02(RNE) vs0x3c01(RTZ)1 + 7 * 2^-11 = 1.00341796875→0x3c04vs0x3c031 + 2^-11 = 1.00048828125is a dud:0x3c00under both — and it is the first value one would reach for.I am prototyping items 1-6 on the PR head locally and will send them as a patch against
3c042c9rather than as prose, so you can take what holds up and drop the rest. The two code findings from the later PRs stand on their own:#423's f32sin/cosskipturns(), and#419's f16sinreturns a subnormal at half turns (WARP0x8001, RDNA40x0000).AI-assisted; the rounding words above were computed independently and the mutation result is from my own run on the RX 9070 XT.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T17:33:44Z.
Here is the prototype, as a patch against
3c042c9(git am).What it proves, measured on the RX 9070 XT and on WARP at
3c042c9+ patch (pixel_aot_hardwarePassed 26.96 s,pixel_aot_warpPassed 11.72 s, 2/2). The two backends agree on every value below.The probe writes four channels whose expected words are literals in the test, never computed from
half_rtz/pack16_rne:v_cvt_i16_f16_dppinto a destination preloaded with0xdead0000, thenv_cvt_f32_ubyte2/3read the high half back (0xad + 0xde). Today those destinations are zeroed, so this is the one channel that makesvdst[31:16]observable.dpp8:[1,2,3,0,5,6,7,4]over a lane-varying source ((uv.x - uv.x[lane 0]) * 64={0,1,0,1}), then four broadcasts weighted 1, 2, 4, 8. All four lanes are read, and a wrong permutation lands on a different subset sum.v_cvt_rpi_i32_f32:1*rpi(-0.5) + 2*rpi(-1.5) + 4*rpi(-2.5).-10is the ties-toward-+∞ reading (floor(x + 0.5)); ties-away-from-zero would give-17. This needs your call: both backends execute our own HLSL, so the run cannot settle which one the ISA implements — it only pins that the fixture now distinguishes them. If the R600/RDNA manual says ties-away, the literal becomes-17and the emitter is wrong.2051throughv_cvt_f16_i16(0x6802, RNE) read as2 + 104. RTZ would give105.A second program pins the other rounding pair: 61 for
1 + 3*2^-11throughv_cvt_pkrtz_f16_f32(RTZ,0x3c01; RNE would give62), and 109 for4099throughv_cvt_f16_i16(RNE,0x6c01; RTZ would give108). Note that2049,2050and1 + 2^-11are duds — they give the same word under both modes — and the probe says so in a comment so nobody adds them later as coverage.Each channel has its mutation, and all six are caught, with the reported values: zeroing
& 0xffff0000u(ch0395 → 0), rotating thedpp8selection (ch15 → 10),rpi→flron the first tie only (ch2-10 → -11), removing the RNE round bit (ch3106 → 105, and in the second program109 → 108), and steeringpkrtzto a zero input (ch061 → 0).The refusals now have messages and controls. Eight
rejects_withassertions pin the diagnostic, not just "some ValueError": destination abovev255, an uninitialized DPP operand, a duplicated modifier, an unsupported modifier, the operand count, a genuine cross-quad DPP8, an unsupported DPP8 modifier, and the new one below. Two emitter changes make that possible:dpp_cvt_vgprread an unwritten register throughvector[raw]and raised a bareKeyError('v34'); it now raisesDPP operand v34 is read before it is written. This is a behaviour change —must_rejectcatches both, but anything else matching onKeyErrorthere will see aValueErrorinstead.parse_dppreported a quad-local-but-not-repeated DPP8 (dpp8:[0,1,2,3,7,6,5,4]) as "Cross-quad DPP8 permutation is unsupported", which is misleading: the first half is local. It now has its own message, and the cross-quad case is still tested separately.What the patch does not do: it leaves
DPP_CVT_SETSand the existing five mutations untouched, so it is purely additive, and it does not replace the reference function — the new channels are literals, which is the point. Thesin/costurns()question from#423and the f16 half-turn subnormal from#419are separate and still open.AI-assisted; both runs and all six mutations executed locally on the adapter named above.
Patch (2 files, +158/-1)
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T20:18:40Z.
The new sentinel, injective lane weights, negative RPI ties, and RNE/RTZ controls make the translated draws much stronger. The high-half probe and its mutation still compare HLSL with an expected preservation policy. The LLVM function lists specific e32/e64 opcodes and also returns false by default, so that function alone does not identify high-half behavior for all seven DPP forms here. Please link a source-built native result or a primary definition for the exact DPP16/DPP8 encodings before exposing those high halves. A smaller slice of the already verified 32-bit conversions can proceed with the new quad controls. Keep half-to-int outside the proved source range and avoid importing the broader clamp/exception policy from this prototype. The new head also has conflicts with main, so its old CI cannot be used for the final candidate.
LLVM subtarget implementation
Imported from R0Y00/Xbox2Windows. Originally posted by KomaGuy on 2026-11-23T20:53:29Z.
@R0Y00 @thepatrickworld Thanks for the detailed review and RX 9070 XT probes — pushed an update (
25e9451, merged cleanly ontomaindae1ca2, all 4/4 CI checks passing):tools/pixel_aot.py):dpp_cvt_vgpr,parse_dpp, andemit_quad_swizzle_u32helpers and routedDPP_CVTthrough the shareddpp_vgpr,parse_dpp, andemit_quad_swizzle_u32(preserving the unconditional local hoisting forQuadRead*).dpp_vgprnow raises an explicitValueError(f"DPP operand {raw} is read before it is written")when a source or 16-bit destination VGPR has not been written yet.parse_dppnow splits cross-quadDPP8(Cross-quad DPP8 permutation is unsupported) from non-repeated quad-localDPP8(DPP8 permutation must repeat the same quad selection in both halves), and refuses unprovedfi:andbound_ctrl:modifiers.v_cvt_rpi_i32_f32_dppto usedpp_cvt_rpi_i32_f32(floor(x) + ((x - floor(x)) >= 0.5f ? 1.0f : 0.0f)), matching both the AMD RDNA 2 ISA definition (D.i = (int)floor(S0.f + 0.5), ties toward+∞) andmain's plaincvt_rpi_i32_f32withoutx + 0.5fbinary32 rounding drift.tests/pixel_aot_check.py,CMakeLists.txt):draw-coreinto their ownpixel_aot_dpp_cvt_{hardware,warp}CTest (draw-dpp-cvt,TIMEOUT 60 SKIP_RETURN_CODE 77, recordingFORM_COVERAGE_RECORD) and switched to sharedcompile_shader.DPP_CVT_PROBE_BODYchecking:vdst[31:16]0xdead0000sentinel preservation acrossv_cvt_i16_f16_dpp(0x01 + 0xad + 0xde = 396.0, with a mutation zeroing& 0xffff0000u).dpp8:[1,2,3,0,5,6,7,4]andquad_perm:[2,3,0,1]on lane-varyingv20under injective base-4 weights(1, 4, 16, 64)(57.0and78.0), plus mutations.(-0.5, -1.5, -2.5, -0.75)onv_cvt_rpi_i32_f32_dpp(0, -1, -2, -1->-18.0, distinguishing ISA RPI from floor-25.0, truncation-10.0, ties-to-even-20.0, and ties-away-25.0), with mutations toflrandtrunc.DPP_CVT_PROBE_ROUND_BODYwith RNE vs RTZ discriminators:2051 -> 0x6802and4099 -> 0x6c01onv_cvt_f16_i16_dpp,65520 -> 0x7c00onv_cvt_f16_u16_dpp, and1 + 3*2^-11 -> 0x3c01onv_cvt_pkrtz_f16_f32_dpp, with HLSL mutations turningpack16_rneinto RTZ andpack16_rtzinto RNE.check_dpp_cvt_refusals()pinning exactValueErrordiagnostics viaexpect_value_errorforv256, uninitialized 16-bit destination/source, duplicate modifiers, partial masks,fi:/bound_ctrl:, wrong operand count, cross-quad vs non-repeatedDPP8, and disallowed source modifiers.docs/experiments.mdto match what each fixture observes and include thepixel_aot_dpp_cvt_reproduction command.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:54:19Z.
I pushed the independent 32-bit slice in
d185cab5. It keeps the author's quad routing and base-4 lane witness, and uses the existing signed and unsigned truncation helpers. The new integer-target draw checks the raw outputs for endpoints, NaN/Inf, the 2^24+1 rounding point, all byte positions and both offset signs. Reversing the DPP8 rotation, swapping DPP16 axes, dropping the negation or selecting the wrong byte each mismatches. The LLVM 15 binary round trip and both Windows WARP/RTX draws pass. Binary16 destinations, packed conversion and FLR/RPI remain in the earlier branch commits for separate review; the unsupported high-half path is absent from the candidate.Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T21:42:03Z.
25e9451measured on the RX 9070 XT (driver 32.0.32029.2010, DXC 1.9.2602.17), fresh clone,INTAKE_PYTHONpointed at the existing venv:pixel_aot_dpp_cvt_hardwarePassed 4.42 spixel_aot_dpp_cvt_warpPassed 2.23 spixel_aot_hardwarePassed 21.71 spixel_aot_warpPassed 15.20 s539 tests registered, everything I ran green. CI excludes the
_hardwareentries, so this is the only place the split entry has actually run on silicon.Two things I checked in the integration:
v_cvt_rpi_i32_f32_dpp— your change is backed by the primary source. RDNA 2 ISA §12.8 VOP1 opcode 12:D.i = (int)floor(S0.f + 0.5), i.e. ties toward +∞, which is what yourfloor(x) + ((x - floor(x)) >= 0.5f ? 1.0f : 0.0f)computes. It also reproduces the values I measured earlier on this card — your-18.0is the same series with a fourth tie (-0.75) added.On the high half, the ISA does not say what the sentinel assumes. This is the primary definition asked for upstream, and it cuts against the probe:
op_sel[3]— 832V_MAD_U16(p. 180 of 283), 843V_FMA_F16(p. 181 of 283), 858V_INTERP_P2_F16(p. 182 of 283), 862V_MAD_I16and 863V_DIV_FIXUP_F16(p. 183 of 283): "If op_sel[3] is 0: Result is written to 16 LSBs of destination VGPR and hi 16 bits are preserved. If op_sel[3] is 1: Result is written to 16 MSBs of destination VGPR and lo 16 bits are preserved." The rest of §12.12 does not:V_ADD_NC_U16,V_SUB_NC_U16,V_MUL_LO_U16,V_MAX_U16,V_MIN_U16,V_PACK_B32_F16are all writtenD.u16 = ...with no clause. So the preservation statement follows the half selector, not the VOP3 encoding — I overstated it in my first version by writing "the VOP3 forms".V_CVT_I16_F16(§12.8): "D.i16 = flt16_to_int16(S.f16)." — the low half, and nothing about the upper one. Same forV_CVT_F16_F32(opcode 10, VOP1) and forV_ADD_F16/V_MUL_F16(opcodes 50/53, which are VOP2, §12.7, not VOP1 as I wrote). The document's only general mechanism for the bits a write does not touch is SDWA'sDST_Ufield (§13.3.7, p. 266 of 283: pad with zeros / sign-extend / preserve / reserved) — and the DPP word has no such field (§13.3.x, p. 268 of 283: onlyROW_MASKandBANK_MASK). So where the document can be explicit about a half, it is; these forms simply do not say.So for
v_cvt_i16_f16_dppand the other VOP1 DPP forms, the RDNA 2 document neither preserves nor clears the high half: it is simply not specified. The sentinel inDPP_CVT_PROBE_BODYtherefore asserts a policy the primary source does not support — which is the same conclusion the low-16-only contract draws, and it is worth saying so in the test comment rather than leaving the assertion looking like it has a citation behind it.Two consequences for the probe, neither of which is a code change I would push without your call:
0x01 + 0xad + 0xde = 396.0). If the high half goes to the unknown half, that channel has to split:0x01alone as the verified low-half widening, and the0xad + 0xdepart as a control that only runs where a primary definition exists for the encoding (the VOP3 forms).WORD_1and whole-word reads rejected even with a preloaded sentinel — is exactly the right shape for the unspecified case, and it is the part that survives the change.Measured numbers and the ISA quotes are from the same tree as the run, so if you want I can re-run after the split and post the timing against the new head.
AI-assisted; runs on the adapter above, ISA citations from the RDNA 2 instruction set document.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T23:05:07Z.
Measured
d185cab5on an RX 9070 XT. Two reds in the DPP family, and both come from the quad routing rather than the conversion: they disappear when364eb99is applied on top and nothing else changes.ctest --preset dev --no-tests=error -R '^pixel_aot_dpp_(cvt|extra)_hardware$' -V, adapter1002:7550,backend=hardware, driver32.0.32029.2010, DXC1.9.2602.17, presetdev,debug_layer=unavailable.Before, at
d185cab5, three consecutive runs, exit 8 in all three:dpp_cvt_hardware, two cases, both on channel 1, both reading exactly zero:The instruction feeding channel 1 is
a uniform operand through permutation
[1,2,3,0], i.e. the general branch: fourQuadReadLaneAtplus a select. The draw reports exactlycvt_f32_u32(0), and channels 0, 2 and 3 are bit-exact in the same pixel.The fixture already separates the two variables inside itself:
from_floatuses the samedpp8:[1,2,3,0,5,6,7,4]permutation on a source built from the interpolated lanes, and it is exact. Same routing shape, only the uniformity of the operand differs.After
364eb99(Use integer masks after quad reads for general DPP permutations, the seven-line select-to-mask change that became #1030), applied alone withgit am, three consecutive runs each, exit 0:git diff --statbetween the two builds touchestools/pixel_aot.pyand two lines ofdocs/experiments.mdonly.d185cab5sits on26d1947, which mergedorigin/mainbefore4bc40d05, so the branch simply predates the routing fix —pixel_aot_dpp_extra_hardwarefails there for that reason, not because of this candidate. On the measurement above, bringing the branch up to currentmainshould carry the same fix; push it and I will re-measure both entries on the new head.One note from reading the candidate rather than measuring it: the high-half question I raised earlier is gone by construction.
DPP_CVTnow holds only 32-bit targets (cvt_f32_i32,cvt_f32_u32,cvt_f32_ubyte0..3,cvt_off_f32_i4,cvt_i32_f32,cvt_u32_f32) andv_cvt_f16_f32_dppis refused with a specific diagnostic, so there is no form left that writes a 16-bit destination and nothing for an unspecified high half to corrupt.AI-assisted; one machine, one adapter.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-23T23:09:10Z.
Rebased head
0bf1382measured on the RX 9070 XT: both entries green, three consecutive runs each.Exit 0 on all three runs, no
pixel_mismatchline in any transcript. So the prediction holds: with #1030 and #419 in the tree, the two reds I reported atd185cab5are gone, and the DPP conversion and extra entries are clean on this adapter.AI-assisted; one machine, one adapter.
Imported from R0Y00/Xbox2Windows. Originally posted by lantiumBot on 2026-11-23T23:21:45Z.
RX 9060 XT check of the merged head, for the record: #1024 noted that this PR shares the #1030 quad routing. It adds a second RDNA 4 device to the RX 9070 XT result above on the same head, and the full
_hardwareand_warpsets. Data only.Head
0bf13820412b1fb5040af4b43a59bf24e9a5cd15, which contains4bc40d0(#1030). First the four lane-permutation draw entries, run directly from a detached worktree of the head, three times per backend:draw-dpp-cvtpixel_aot_dpp_cvt_*(this PR)draw-dpp-extrapixel_aot_dpp_extra_*draw-dpp-f16pixel_aot_dpp_f16_*draw-ds-swizzlepixel_aot_ds_swizzle_*draw-dpp-cvtanddraw-dpp-f16print nothing on success: their draws go throughrun_pixel_batch, which captures the renderer output and asserts each expectedpassormismatchstatus, so exit 0 means every positive case matched and every control mismatched.draw-dpp-cvtmakes 6 batch calls with 11 cases (7pass, 4mismatch);draw-dpp-f16makes 9 batch calls with 13 cases (5pass, 8mismatch).draw-dpp-extraprinted 7 strict draws per run, eachpixels=4096 channels=16384 max_absolute_error=0, includingdpp_dotc_wrap, the draw that failed on this adapter atee04692, as reported in #1024.draw-ds-swizzleprinted two clean draws and onepixel_mismatch, which is its own negative control; the mode exits 0.Full
_hardwareand_warpsets through CTestThe checkout was then placed on this head, reconfigured and rebuilt (
devpreset), and both sets were run once each:_hardwareon the RX 9060 XT_warpon in-box WARPdxr_opacity_hardware,gpu_alias_lookup_writes_hardwareandpixel_aot_comparisons_hardware(#958). None is apixel_aot_dpp*entry.pixel_aot_dpp_cvt,pixel_aot_dpp_f16,pixel_aot_dpp_extraandpixel_aot_ds_swizzlepassed in both sets.bc7_mode6_multiblock_hardware;bvh_wave64_warp,wave_shuffle_warpandbc7_mode6_multiblock_warp.spirv_*_hardwareentries ran and passed; the build uses the repository-pinned SPIR-V tools fromtools/setup-spirv-tools.ps1.Environment
offscreen_checkfrom thedevpreset, built atmain7baa8543. No renderer source (tests/*.cpp,tests/*.h,tests/*.hlsl,src/) differs between7baa8543and this head;CMakeLists.txtdiffers only by this PR'spixel_aot_dpp_cvtregistration and a CPU fixture thatmaingained since. The test drivertests/pixel_aot_check.pyand the translatortools/pixel_aot.pyare this head's.Not covered
git rev-parsegave0bf13820immediately before the two CTest runs.AI-assisted (Claude Code - Fable 5.2); runs executed locally on the adapter above.