startup: draw the gfx2hlsl three-source integer vector operations #1699
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1706"
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 Asimmimx on 2026-11-24T17:28:57Z.
Refs #1149.
Change
No check ran the ten three-source integer operations of the
VEC_Utable intools/startup/gfx2hlsl.py:v_bfe_u32,v_mad_u32_u24,v_lshl_add_u32,v_add_lshl_u32,v_add3_u32,v_or3_b32,v_and_or_b32,v_lshl_or_b32,v_xad_u32andv_bfi_b32. All ten are VOP3 only.This PR adds a check only. The translator does not change.
tests/startup_gfx2hlsl_int3_alu_check.pydraws them with the per-lane runnertests/startup_gfx2hlsl_lane_alu.py. The runner is byte-identical to the copy in #1703, so the two PRs merge in either order without a conflict. In each draw:binarymode;clamp,-v,|v|,op_sel) and operand counts.The references follow the AMD RDNA 2 ISA reference with plain integer arithmetic:
v_bfe_u32: an unsigned field of width S2[4:0] at offset S1[4:0];v_mad_u32_u24: the product of the low 24 bits of S0 and S1;v_bfi_b32: the insert(S0 & S1) | (~S0 & S2).Each operation has eight input sets, which is two draws. They include widths and counts above 31 (33, 40), sources with bits above bit 23, and sums that wrap.
Mutations, one per operation. The first draw with the mutated lowering must read the mutation's own reference words:
- 1;v_mad_u32_u24;v_lshl_add_u32andv_lshl_or_b32;v_add_lshl_u32;a + b - cforv_add3_u32;v_or3_b32;v_and_or_b32;v_xad_u32;Results
Commit
b5b8168eonorigin/main. Windows 11 26300.9974, DXC 1.8.2502.11, FXC 10.0.26100, debug layer on.There were no skips.
One observation. My first bfe mutation masked the width to 4 bits,
(1u << (w & 15)) - 1. FXCps_5_1compiled that mutated shader to one that read00000000in all four channels on WARP. Lane 0 had width 8, where the mask makes no difference, and the correct lowering read00000067there. I replaced the mutation because it no longer tested only the lowering. The correct lowering matched through both compilers on both adapters.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:35:14Z.
Review: COMMENTED
Review of head
b5b8168e669f66114538d64d57b431cfea81134e. Tests, CMake, CI list and docs only; no change totools/startup/gfx2hlsl.py. Verdict: 0 P1, 0 P2.Linux limits. Linux x86_64,
llvm-mc-19(the new CI entry pinsllvm-mc-15), Python 3.14. No Windows, no DXC/FXC, no GPU: I could NOT run thedrawmode, so the claimed WARP and RX 6600 results, the 40 matching draws and the 20 mutated draws are not verified by me.What I ran
python3 -B tests/startup_gfx2hlsl_int3_alu_check.py(controls): passes, exit 0.... binary llvm-mc-19:fixture words match llvm-mc, exit 0.VEC_Uexpressions intools/startup/gfx2hlsl.py(formatted and evaluated in Python with 32-bit masking) on 6000 input triples each (edge values 0, 1, 31, 32, 33, 0xffffff, 0x1000000, 0x7fffffff, 0x80000000, all-ones, plus random): 0 mismatches forv_bfe_u32,v_mad_u32_u24,v_lshl_add_u32,v_add_lshl_u32,v_add3_u32,v_or3_b32,v_and_or_b32,v_lshl_or_b32,v_xad_u32,v_bfi_b32. The test's own references agree with the ISA wording (width and offset from bits 4:0, 24-bit multiply inputs,(S0 & S1) | (~S0 & S2)). Not covered by my check: how FXC/DXC compile these expressions.git checkout -- .):v_add3_u320x6d -> 0x6c: FAILED inbinarymode (assembled words differ), as intended.v_bfi_b32without the complement, andv_add3_u32with- {2}: the controls FAILED, but only because the mutation regex of the control no longer matches the changed text (count == 4 and mutated != text), not because a value was compared.v_add_lshl_u32with operands exchanged (({0} + {2}) << ({1} & 31), same shape): controls PASSED, not caught.Notes
windows.ymlCHECKS entry withbinary llvm-mc-15, the no-argument step, three ctest entries with the same SKIP/timeout conventions as the neighbours) looks consistent; I did not run Actions.git diff --check,docs_links_check,bidi_controls_check: clean.Not approving (comment only).
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-24T22:28:03Z.
Hardware run of head
b5b8168e. Windows 11 Pro 26100.9168, DXC/FXC from Windows SDK 10.0.26100,devpreset, debug layer unavailable here. Adapter selected withXBOX2WINDOWS_ADAPTER: WARP 10.0.26100.8972, NVIDIA Quadro M1000M (Maxwell, 10de:13b1) 32.0.15.7371, Intel HD Graphics 530 (Gen9, 8086:191b) 31.0.101.2111.startup_gfx2hlsl_int3_alu_controlsstartup_gfx2hlsl_int3_alu_warpstartup_gfx2hlsl_int3_alu_hardwareon the Quadro M1000Mstartup_gfx2hlsl_int3_alu_hardwareon the HD 530No changes made.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T05:48:22Z.
Review: APPROVED
Verified head
b5b8168eon Windows x64 (devpreset, MSVC19.44.35228.0, SDK10.0.26100.0, DXC/FXC10.0.26100.0):cmake --build --preset dev --target offscreen_check-> succeededctest --preset dev --no-tests=error -R '^startup_gfx2hlsl_int3_alu' -V-> 3/3 passed (startup_gfx2hlsl_int3_alu_controls,startup_gfx2hlsl_int3_alu_warp,startup_gfx2hlsl_int3_alu_hardware)AMD Radeon RX 7900 XTX(vendor=1002 device=744c, driver32.0.32029.2010)Microsoft Basic Render Driver(vendor=1414 device=008c, driver10.0.26100.9818)Verdict: Approved at
b5b8168e.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:52:56Z.
@Asimmimx could you rebase this branch onto current
mainand force-push?GitHub reports head
b5b8168eas conflicting withmain, so it cannot be merged as is.Files that conflict with current
main(4aaea119):tests/startup_gfx2hlsl_lane_alu.pyCommands run locally:
Once it is rebased and CI is green it will be re-checked right away.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:15:45Z.
Pushed one merge commit (
4efb99c46, no force, no rebase) that merges currentmaininto this branch. This clears the only conflict GitHub reported,tests/startup_gfx2hlsl_lane_alu.py(add/add).Resolution: kept
main's copy of that file. Against the branch's copy it differs in three places only: thepipeline:docstring line and the**family.get('pipeline', {})keyword arguments passed toG.Pipelineintranslate()and in the draw loop. No other file in the PR conflicted, and nothing intools/changed.Commands executed:
git merge origin/main, thengit checkout --theirs tests/startup_gfx2hlsl_lane_alu.py(add/add)python3 tests/startup_gfx2hlsl_int3_alu_check.py(Linux, translation controls, mutations, refused/accepted forms): all okb5b8168eplus the one-file diff oflane_alu.pyabove:ctest -R startup_gfx2hlsl_int3_alu-> 3/3 passed ondevand 3/3 passed onreleaseThe merged tree itself was checked on Linux only; the Windows run used the PR head with the resolved
lane_alu.pyapplied.AI-assisted; commands listed were executed locally.