shader: accept inline, literal and SGPR-pair values in direct C++ 64-bit shifts #2952
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2952"
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 Leyukaka on 2026-11-26T23:10:52Z.
Fixes #2951 (it needs closing by hand, since the base is not the default branch). Part of #2935. Target branch
cpp-migration.Change (
src/gfx1013_direct_compute.inl):v_lshrrev_b64andv_lshlrev_b64accepted only a VGPR pair or the inline0as the shifted value. They now also take:s[2k:2k+1],k <= 52), read throughoperand32, so the numeric-SGPR check applies to both words.These are the rules
tools/startup/gfx2hlsl.pyapplies to the same shifts throughi64_words. Inline floats, odd or special scalar sources andv_ashrrev_i64stay refused. The shift amount handling is unchanged.Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, on
cpp-migrationea07313bplus this commit.native_shift64_hardwarepassed. It covers-1,-16,64,1, the literal0x80000001and an SGPR pair with different words, each shifted right and left by 0, 1, 31, 32, 33 and 63, with one source per dispatch. Two 32-lane groups are compared with a 64-bit integer reference, and the guards are checked.native_shift64_controlspassed: an inline float as the shifted value is refused.native_dpp_quad_hardware,native_dpp_mirror_hardwareandnative_compute_clearstill pass.Mutation checks, run by hand; each fails the hardware test on its own case:
inline -1;literal;SGPR pair.Measured on a local capture (counts and instruction shape only) with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requestsbuilt from this branch.ea07313band 249 with this commit; none that compiled before stops compiling.ea07313b, 38 requests stop first at "direct 64-bit shift operand". With this commit none does: 6 compile, and most of the rest stop next at:AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T23:18:46Z.
Review: APPROVED
Review of head
bcaf4133, tested merged ontocpp-migration641add96(with #2950). It auto-merges cleanly, and CI on the head is green. Approving and merging.Code read: the accepted sources match
gfx2hlsl.i64_words:s[104:105], or a VGPR pair, with both words read throughoperand32;Inline floats, odd or special scalars and
v_ashrrev_i64stay refused. One side effect is worth stating: VGPR pairs now also go throughoperand32's numeric check, where before they were read raw. Your capture run says nothing that compiled before stops compiling.Run on AMD: Windows 11 26300.9974, AMD Radeon RX 9070 XT (driver 32.0.32029.2010), release.
ctest --preset release --no-tests=error -R '^native_'gives 40 tests, 39 passed and 1 skipped (77,native_comparison_pso_warp), includingnative_shift64_hardwareandnative_shift64_controls.Mutation here: dropping the sign extension of negative inlines fails
native_shift64_hardwareat('inline -1', 'right', 0, …). With it restored, it passes.I will close #2951 by hand.
AI-assisted; the commands above were run locally.