shader: return the old qword from LDS comparisons and XOR #937
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/944"
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 stan495 on 2026-11-23T18:10:55Z.
Scope
Add the five returning forms of signed and unsigned qword min/max and bitwise XOR. Return the original qword even when the destination aliases the data pair.
Depends on #942. Review this batch with
git diff 9926b9f6 f02da958. The non-returning forms are already in main via #1002. This batch adds the five returning forms.Verification
Tested
f02da958on Windows 11 25H2 (10.0.26200.9974) with the D3D12 debug layer enabled. Hardware used AMD Radeon RX 7900 XTX (32.0.32029.2010). WARP used Microsoft Basic Render Driver (10.0.26100.9818).9 passed, 0 failed, 0 skipped. Both backends compared all 320 UAV words. Each fixture compares the original and updated pairs after one and two groups. Negative controls copy the post-update pair where the original should be returned.
LLVM 15.0.7 round trips reproduced the same HLSL as text translation. Coverage records include all five new forms.
Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T00:34:17Z.
Coordination from the XCL-15 candidate (#1061), per the maintainer's note. Our branch independently implements the same five returning forms (ds_xor_rtn_b64, ds_min/max_rtn_i64, ds_min/max_rtn_u64) on the current private LDS gfx1030 profile. It passes the binary control, WARP (Microsoft Basic Render Driver 10.0.26100.10068) and hardware (AMD RX 9060 XT, driver 32.0.32029.2010, Windows 10.0.26300): 320 words per case, one and two groups, no mismatches. Distinct controls in our branch: signed-high/unsigned-low ties, destination/source overlap, and a mutant that returns the post-update pair instead of the old pair; the unsigned signed-comparison mutant is expected at word 0. I will close #1061 to keep one implementation candidate. If useful, I can add those tests as a small follow-up with attribution after #944 lands, or share the exact fixture lines here.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T00:51:57Z.
Thanks @lambirou for coordinating #1061 and sharing your independent WARP and RX 9060 XT results. I resolved the merge conflict in
0b45e7f2, and the LDS qword tests passed on WARP and Arc B390.Could you paste the fixture lines for the case where the high dwords are equal and the low dwords need an unsigned comparison? I'd like to compare that case with what #944 exercises.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T01:05:06Z.
Measured your head
0b45e7f2on an RX 9070 XT, and tried the independent comparison @R0Y00 asked for in #1061: not only running the fixtures, but injecting the two mutations the tie cases are supposed to catch.Merge and run.
0b45e7f2onto72270be3, no conflict: merge051db16b, tree0f76fc71.devpreset, your exact selection, three consecutive runs — the table is one of the three, the other two exited 0 with the same 9/9:on
AMD Radeon RX 9070 XT vendor=1002 device=7550, driver32.0.32029.2010, DXC1.9.2602.17, Windows10.0.26200.9711. Your hardware column was a 7900 XTX, so this adds the RDNA 4 side of the same head.The three checks R0Y00 named. I ran
compute_store_check.py draw-lds-qwordon the card with the tree clean, then with two mutations intools/compute_store_aot.py, then clean again:if op.endswith("_i64")→if True:ds_min_u64,mismatches=32,word=0 expected=fffffff0 actual=00000018without_low_tiebreak)ds_min_u64,mismatches=8,word=34 expected=00000001 actual=00000018word=34is lane 17, the low dword of the stored pair (34 = 17x2); 8 = the eight odd lanes 17..31, one stored dword eachThe two failure sets are disjoint by lane parity, which pins each to its own clause: the even lanes are the ones where the two high words differ across the sign bit (
0x7fffffffagainst0x80000000), the odd lanes are the ones where the high words are equal (0x80000000 + 1on both sides) and only the low dword (0xfffffff0 + laneagainst0x18) decides. So the fixture's data does carry both distinctions.That is coverage, not proof of the ISA: the expected words come from the project's own
lds_qword_reference, and no RGA comparison was made. And one limit matters for how far this reads: both mutations abort the draw atds_min_u64, a non-returning form, so the four returning min/max forms were exercised by the clean run only — the mutation result says the shared comparison path is discriminating, not that each_rtnform was individually mutated.The third item, the old-value return, is covered by your own mutant in
ds_mutants(theLDS_QWORD_RETURNSbranch substitutes the post-update pair) and is one of the 24 rejections in the clean row.Overlap is the shape of the shared program rather than a separate case:
v[18:19]is both the destination and the data operand, seeded byds_write_b64 v5, v[16:17] offset:8. The two hazards show in different words — a destination written from the post-update pair shows in the returned dwords (v18/v19, which the fixture exports and whichLDS_QWORD_RETURNSsubstitutes), while a source clobbered before the compare would show in the LDS pair read back byds_read_b64. No separatelds_overlap-style case is added for the qword forms; that geometry comes with wideningLDS_QWORD_RETURNS.Scope: only those nine entries; three runs of a deterministic draw, so they repeat the same cases rather than covering more; one physical GPU (9070 XT, RDNA 4), one driver, Windows only;
devpreset; nobinarymode with LLVM; no RGA disassembly. This is a measurement, not a merge green light — the PR is still a draft and I am not reviewing the rest of it.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T01:35:13Z.
Follow-up, since this landed: the run above was on a merge I built myself (
051db16b, tree0f76fc71) onto a base that has moved since, so it is not the tree that shipped.Re-ran the same nine-entry selection on the merged commit
58da41c34c8c4c9b22f6fe526938228dc0c3f191, tree8256e22ae8e21eb1a2072dcf0293fb56d0be731a(parents2db96ba+0b45e7f2), clean tree, twice: 9/9 both times, same entries, timings within a second of the ones above (compute_store_aot_lds_qword_hardware10.98 s,..._warp4.88 s). So the pass result holds on what landed.The mutation experiment was not re-run on the merged tree — it stands for the code I measured, not for the merge.
AI-assisted.