shader: lower binary32 subrev, sqrt, rsq, floor, trunc, fract and clamp in the dispatch translator #1216
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1223"
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 tedin7 on 2026-11-24T04:22:17Z.
Change
Adds
v_subrev_f32,v_sqrt_f32,v_rsq_f32,v_floor_f32,v_trunc_f32andv_fract_f32to the float table oftools/ffx_dispatch_aot.py, and accepts the VOP3clampoutput modifier on every operation in that table (lowered tosaturate). The e32 encoding,clampcombined withmul:2, integer operations and a wrong source count on the six new operations are still refused. The previous test that expectedv_add_f32_e64 ... clampto be refused is replaced by an acceptance check, because that behavior is what changes here; the other rejection cases are kept. No CPU target is touched. AI-assisted.Verification
python3 -B tests/ffx_dispatch_aot_check.py llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM.so.19.1: exit 0.llvm-mc,llvm-objcopy,libLLVM-15.so.1extracted from the Debian packages into a temporary folder): exit 0. LLVM 15 and 19 print identical spellings for all new forms.python3 -B tests/rdna2_tools_check.py: exit 0.origin/mainthe new test fails (Unsupported float modifier for v_add_f32_e64: clamp); with the change it passes.x - trunc(x)for fract, dropped clamp, upper-only and lower-only clamp) each disagree on a fixed set of rows.ffx_float_math_warp(--readback-float-math). It mirrorsffx_float_to_int_warp; no Windows adapter,dxcor host executable was available here.Evidence and follow-up
Fixtures are synthetic one-line assembly programs written for this test; the expected words are tabulated constants. sqrt and rsq lower to the HLSL intrinsics and no bit-exact claim is made (readback allows one ulp for those two). NaN, signed zero, subnormal and infinite inputs, and how clamp treats NaN, are not covered. A clamp on fract is indistinguishable from none (the result is already below 1). Documented in
docs/experiments.mdunder "Float math and clamp in translated dispatches".Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T04:29:22Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
1d90a8cf5dℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:34:23Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:34:26Z.
AI-assisted update:
v_fract_f32in the dispatch translator is now capped at0x3f7fffff(same bound as the pixel translator), with a -2^-30 row in both fract tables and a mutation that drops the cap. The new row fails on the previous commit and passes now. docs/experiments.md updated.@codex review
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T04:38:25Z.
Codex Review: Didn't find any major issues. 🎉
Reviewed commit:
02b2b2ed2dℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:57:01Z.
Windows Server 2025 verification (
02b2b2ed) — PASS (Debug + Release/O2, WARP)--preset dev) (16.11s build+test):cmake --build --preset dev -j 6 --target offscreen_check ffx_pass26_ldsctest --test-dir out\build\dev -R "^ffx_.*_warp$" --output-on-failure-> 7/7 passed (0 skipped, 2.80s;ffx_float_math_warp0.99s)/O2(--preset release) (18.39s configure+build+test):cmake --preset release && cmake --build --preset release -j 6 --target offscreen_check ffx_pass26_ldsctest --test-dir out\build\release -R "^ffx_.*_warp$" --output-on-failure-> 7/7 passed (0 skipped, 2.47s;ffx_float_math_warp0.84s)Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:27:38Z.
AI-assisted. Fixed in
8b5a7124: the dispatchv_fract_f32cap is now a comparison (frac(x) >= 1.0f ? asfloat(0x3f7fffffu) : frac(x)) instead ofmin, so a NaN input stays a NaN (D3Dminreturns its other operand for a NaN). The check now covers a NaN input and the oldminform as a control.@codex review
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:31:34Z.
Codex Review: Didn't find any major issues. Keep them coming!
Reviewed commit:
8b5a7124c1ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T04:24:21Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
8b5a712ℹ️ 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-24T06:14:07Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP) at
8b5a7124:--preset dev): 27/27 PASS (13.60s), includingffx_float_math_warp(1.01s),ffx_float_to_int_warp(0.53s),ffx_immediate_float_to_int_warp(0.57s),ffx_pass26_lds_warp(0.33s)/O2(--preset release): 27/27 PASS (12.96s), includingffx_float_math_warp(0.91s),ffx_float_to_int_warp(0.51s),ffx_immediate_float_to_int_warp(0.50s),ffx_pass26_lds_warp(0.31s)Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T04:29:22Z.
Code review location:
tools/ffx_dispatch_aot.py; line 86For small negative normal inputs such as −2⁻³⁰ (
0xb0800000), D3Dfraccan return1.0(0x3f800000), whereas RDNAv_fract_f32must cap the result at0x3f7fffff. This exact adapter-dependent discrepancy is already handled byfract32intools/pixel_aot.py:319-321and documented indocs/experiments.md:4257. The new mapping omits that bound, and the e64 outputsaturatestill leaves1.0unchanged, so translated dispatches produce incorrect register words on affected adapters. Apply the same upper-bound correction here and add the existing small-negative regression input toFLOAT_MATH.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:34:23Z.
Code review location:
tools/ffx_dispatch_aot.py; line 86Fixed in
02b2b2ed.