startup: lower abs source modifiers on v_cndmask_b32_e64 #2431
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2439"
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 triggered02 on 2026-11-25T16:48:05Z.
Lowers
abs(|src|and-|src|) onv_cndmask_b32_e64register data sources intools/startup/gfx2hlsl.py.What changed
tools/startup/gfx2hlsl.py:Stage.u_srcnow handles|...|aftersplit_neg(tok), applying(%s & 0x7fffffffu)first forabsand(%s ^ 0x80000000u)second fornegper RDNA2 VOP3A source-modifier order (so|v0|->(v0 & 0x7fffffffu),-|v0|->((v0 & 0x7fffffffu) ^ 0x80000000u)).check_encoding()continues to refuseABSon immediates,Stage.u()continues to refuselow16_only_vwhole-word reads, andsrc2mask modifiers stay refused.tests/startup_gfx2hlsl_cndmask_abs_check.py,tests/startup_gfx2hlsl_cndmask_neg_check.py(removed the 3 superseded VGPRabsrefusal checks while keeping immediateABS/neg_maskand addingv_and_b32_e64absrefusal),CMakeLists.txt, anddocs/experiments.md.Measured checks (
30c2e6beonorigin/mainb442b57f)tests/startup_gfx2hlsl_cndmask_abs_check.py(pure Python): PASS (31 checks: synthetic VOP3A decoding incl.v_cndmask_b32_e64 v0, v0, |v0|, s30, SGPR|s4|/-|s4|, 17 refusal controls, CPU evaluation across 22 combinations of 11 IEEE bit patterns incl.-0.0/qNaN/inf, and 22/22 mismatch checks for order-reversed &abs-dropped mutations).tests/startup_gfx2hlsl_cndmask_abs_check.py draw <dxc> <offscreen_check> warp <fxc>(Microsoft Basic Render Driver1414:008c,10.0.26100.9818): PASS — 44/44 positive draws (22 FXCps_5_1+ 22 DXCps_6_0) matched bit-for-bit, and 8/8 mutated draws failed with exact wrong words.startup_gfx2hlsl_*_check.py+startup_translator_check.py,docs_links_check.py(467 links),bidi_controls_check.py(1,726 files),git diff --check: all PASS.tools/startup/gfx2hlsl.py(droppingabs; reversingneg/absorder): both caught (exit 1).Not established
hardwaredraw has since been measured by @Makto94 on an NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.2101), Windows 11 build 26300.9974, MSVC 19.44.35230,devpreset, serial-j1runs:startup_gfx2hlsl_cndmask_abs_hardwarepassed withdebug_errors=0 debug_warnings=0, 0 capability skips, 22 cases through both the FXC and DXC paths (44 readbacks), and all four mutations reportedfails as expectedin both paths (report: https://github.com/R0Y00/Xbox2Windows/pull/2439#issuecomment-7170698898).AI-assisted (Gemini).
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T16:48:21Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
30c2e6bℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:24:13Z.
Review: COMMENTED
Review of head
30c2e6be(comment only, no Windows run from me).Checked:
Stage.u_src(gfx2hlsl.py): abs is applied first (& 0x7fffffffu), then neg (^ 0x80000000u). That is the VOP3 modifier order, so-|x|forces bit 31 to 1. Its only caller is thev_cndmask_b32_e64data sources (line ~4063). Other integer ops still go throughu()and keep refusing|..|.startup_gfx2hlsl_cndmask_neg_check.pyare replaced by one that still pins the refusal onAND_B32.controls,warpandhardwaretests next tobit_alu; the docs section is added.negtest passed) names head30c2e6be, which is the current head. I did not re-run them.Commands run (Linux):
python3 -B tests/startup_gfx2hlsl_cndmask_abs_check.py: PASSpython3 -B tests/startup_gfx2hlsl_cndmask_neg_check.py: PASSpython3 tests/docs_links_check.py: passpython3 tests/bidi_controls_check.py: passgit diff --check origin/main...HEAD: cleanu_src. The abs check fails.u_src. The abs check fails.git checkout -- ..No blocking findings. The branch is 23 commits behind main; I did not update it, so the author's test results stay tied to this head.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-25T18:17:09Z.
Hardware run and Windows 11 MSVC build at head
30c2e6be.Environment: Windows 11 Pro build 26300.9974, Debug (
devpreset), MSVC toolset 14.44.35207 (cl 19.44.35230.0), driver 32.0.16.2101. The hardware test printsadapter=NVIDIA GeForce RTX 3070 Ti vendor=10de device=2482andbackend=hardware debug_layer=enabled, withdebug_errors=0 debug_warnings=0. The runs were serial (-j1).Build:
cmake --build --preset devexited 0. This PR changes no C++ source.Tests:
ctest --preset dev --no-tests=error -j1 -R 'startup_gfx2hlsl_cndmask_abs' -E 'hardware' -V: 2/2 passed (startup_gfx2hlsl_cndmask_abs_controls,_warp).ctest --preset dev --no-tests=error -j1 -R 'startup_gfx2hlsl_cndmask_abs_hardware' -V: 1/1 passed. 0 capability skips (77).ctest --preset dev --no-tests=error -j1 -R '^startup_gfx2hlsl_cndmask_neg$': 1/1 passed (CPU-only check, also changed by this PR).The hardware test checks 22 cases through both the fxc and the dxc path (44 readbacks) and prints
PASS. The 4 mutations (rev_neg_one_m1,drop_neg_one_m1,rev_neg_zero_m0,drop_neg_zero_m0) each printfails as expectedin both paths, so the check can fail.The PR body lists as not established: "Physical GPU
hardwaredraw was not run locally (WARP only)." This run adds that measurement.Not covered by this run: AMD hardware; only these 22 cases were run.
Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-25T18:45:43Z.
Thanks � recorded in the PR description: the physical-GPU hardware draw is no longer listed as not established. The body now cites your RTX 3070 Ti run (driver 32.0.16.2101, Windows build 26300.9974, MSVC 19.44.35230, dev preset, debug_errors=0 debug_warnings=0, 0 skips), the 22 cases through both the FXC and DXC paths, and that all four mutations reported \ails as expected, with a link to your comment. AMD hardware stays listed as unexercised, and this PR's head is unchanged at
30c2e6be, so your measurement is of the current head � nothing to re-run.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:07:26Z.
Review: COMMENTED
Review of head
8246b007(comment review, no merge from this side).Checked:
Stage.u_srcintools/startup/gfx2hlsl.py: abs applied first (& 0x7fffffffu), neg second (^ 0x80000000u), matching the VOP3 modifier order. The only callsite is thev_cndmask_b32_e64data sources; other integer handlers still useu()and keep refusing modifiers.tests/startup_gfx2hlsl_cndmask_abs_check.pyand the updatedtests/startup_gfx2hlsl_cndmask_neg_check.py: PASS. The abs test has a CPU reference plus a D3D12 WARP readback mode (draw).startup_gfx2hlsl_cndmask_abs_check.pyfail (exit 1).python3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py,git diff --check origin/main...HEAD: clean.Finding (overlap, design question): #2449 (
startup/cndmask-abs-operand) lowers the same|x|modifier onv_cndmask_b32_e64operands ingfx2hlsl. Two PRs for the same slice will conflict inStage.u_src/ the cndmask tests. The code here looks sound, so the question is only which one lands. Leaving the choice to @R0Y00; I am not merging while both are open.I did not run Win2025 and did not verify any game startup.
AI-assisted; commands listed were executed locally.