fix(shader): lower 16-bit DPP compares and refuse 64-bit DPP compares #259
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/259"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T05:37:28Z.
What this changes
Refs #258
f16,i16,u16,v_cmp_class_f16, andv_cmpx_*_16) throughLower::half_srcwhenLower::dppreturnsOk((x, None))."a 64-bit compare with DPP", sincesrc64does not readself.src0).Ok((_, Some(_))) => Err("a compare with DPP row masks or bounds")refused, matching LLVMGCNDPPCombine.cpp'sMaskAllLanesconstraint (assert(MaskAllLanes || !isVOPC(DPPOp))).How it was tested
native::addr_tests::compares_with_16bit_dpp_vcmpx_and_class_run_on_the_gpu(on Apple Silicon Metal GPU, with explicit constant expected arrays): testsv_cmp_gt_f16_dpp([1, 0, 0, 1]),v_cmp_lt_i16_dppwithrow_shr:1 bound_ctrl:1([0, 1]),v_cmp_class_f16_dpp([0, 1, 1, 0]), andv_cmpx_eq_u16_dppnarrowingEXEC([77, 77, CANARY, CANARY]).emit::graphics::tests::pixel_compares_with_16bit_dpp_and_64bit_or_partial_mask_refusals.0 newly translated, 0 output changed, 0 newly refused.cargo test -p victory-hle -p victory -p victory-gpu -p victory-metal -p victory-shader -p xtask, bothx86_64-pc-windows-gnullvmclippy targets, andcargo xtask policy.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T06:48:33Z.
Thank you for this. It converts a refusal into an accept, so I need three things before it can merge.
compares_with_16bit_dpp_and_row_bank_bounds_run_on_the_gpucomputes its expected values from the same rule as the code. Please add one whose expected values come from somewhere else, and one each forv_cmpxwith DPP,v_cmp_class_f16with DPP, and the new 64-bit refusal.Also: #182 and #15 are closed, please refer to #258. This pull request, #261 and #262 all append to the same place in
docs/native-host.md, so the second and third will need a rebase after the first merges.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T08:07:58Z.
Sandile-0511's corpus run (his comment in #258) finds no shader whose outcome or output changes with this pull request. So there is no measured harm, and also no measured use: none of the title's shaders in that corpus needs it.
My three points stand, and the first matters most: please quote the ISA text that says a DPP compare writes 0 in the lanes it leaves out, and say how it was confirmed. If it is not, those shaders stay refused. Without a shader that needs it, I would also like to hear why it should merge now. The branch is also behind main.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T08:39:06Z.
Addressed all three points and rebased onto
main(2a3b03d):Ok((_, Some(_)))(row_mask/bank_mask/unguardedbound_ctrl:0) refused: Checking LLVMlib/Target/AMDGPU/GCNDPPCombine.cppconfirms LLVM itself enforcesassert((MaskAllLanes || !(TII->isVOPC(DPPOp) || ...)) && "VOPC cannot form DPP unless mask is full")alongsideBoundCtrlZero || ExecMaskSamebecause VOPC DPP lacks anoldoperand and partial masks do not clear unmaskedsdstbits. Revertedenablemasking soOk((_, Some(_)))continues to returnErr("a compare with DPP row masks or bounds"), keeping only full-mask 16-bit VOPC DPP (Ok((x, None))) and the new 64-bit DPP refusal (src64ignoresself.src0).native::addr_tests::compares_with_16bit_dpp_vcmpx_and_class_run_on_the_gputesting explicit input tables against fixed constant arrays forv_cmp_gt_f16_dpp([1, 0, 0, 1]),v_cmp_lt_i16_dppwithrow_shr:1 bound_ctrl:1([0, 1]),v_cmp_class_f16_dpp([0, 1, 1, 0]), andv_cmpx_eq_u16_dppnarrowingEXEC([77, 77, CANARY, CANARY]), plus negative assertions inemit::graphics::tests::pixel_compares_with_16bit_dpp_and_64bit_or_partial_mask_refusalsfor"a 64-bit compare with DPP"and"a compare with DPP row masks or bounds".#258. Per @Sandile-0511's 21,608-shader output-fingerprint sweep (#258), 0 existing shaders in that corpus change output or regress.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T08:53:16Z.
My own corpus run (33,625 containers, compared by output fingerprint, this branch merged onto main
2a3b03d1):No shader gained, lost or changed.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T10:32:14Z.
Thank you. Keeping the partial masks and the unguarded
bound_ctrl:0compares refused is the right narrowing, and the tests with fixed expected values answer my second point.What is left: you quote LLVM's combiner, not the ISA text, and nothing was confirmed on hardware. And my corpus run shows no shader gained, lost or changed, so nothing in the corpus needs this change. I do not see a reason to merge it now. Please say which shader or which game screen needs 16-bit DPP compares. If there is none, I will keep it open until one shows up. The branch is also behind main.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T11:53:54Z.
Rebased onto current
main(e2f211a8).I do not have a game shader or screen that needs 16-bit DPP compares today: the 9
"a compare with DPP is not supported"refusals from the earlier boot log that prompted this branch turned out to be 32-bit VOPC DPP compares, which37f9cb54subsequently covered onmain. Your 33,625-container corpus run confirms nothing in the current corpus hits 16-bit or 64-bit VOPC DPP compares yet, so parking this open until a shader hits it (or closing it until needed) makes complete sense.