shader: lower v_ldexp_f32 in the direct compute path #3057
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3057"
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 legacy-code-archaeologist on 2026-11-27T12:48:48Z.
Change
src/gfx1013_direct_compute.inllowersv_ldexp_f32in the direct C++ compute path using integer bit operations only, matchingtools/pixel_aot.py'sldexp32. Fixes #3013.2^S1; zero, Inf and NaN (with payload) pass unchanged; denormalS0normalized via five conditional shifts (16, 8, 4, 2, 1);S1clamped to[-512, 512]; overflow to signed Inf; subnormal results rounded to nearest even;clampsaturates with integer comparisons (NaN/ negative /-0->+0,>= 1.0->1.0, denormals preserved).abs/negonS0handled via bit operations;abs/negonS1/S2, nonzerosrc2,omod,op_sel, SDWA and DPP are refused.tests/native_ldexp_check.py,tests/cmake/native_ldexp.cmake,docs/experiments/native-direct-ldexp.md.Verification
Commit
60c05adfonupstream/cpp-migrationa0f67731, Windows 10.0.26100,devpreset:cmake --build --preset dev --target compile_dxil native_store_replay: ok.ctest --preset dev --no-tests=error -R '^native_ldexp_' -V:native_ldexp_controlspassed (1.13 s);native_ldexp_hardwareskipped (exit 77 — default adapter does not report shader model 6.6 with wave32, so readback is unmeasured).python -B tests/docs_links_check.py: passed (66 Markdown files and 581 links).AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T13:07:47Z.
Thanks for adding the
v_ldexp_f32coverage. New shader-lowering PRs targetmain. Retargeting this branch as it stands would also bring in thecpp-migrationcopies of #3034 and #3042. I checked that the single60c05adfcommit applies cleanly onmain801f4c3b. Could you replay just that commit onto currentmainand let us know when the PR is ready to retarget? If either heap change is needed for this fixture, please point to the dependency so we can order the reviews.Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-27T13:31:31Z.
I tested the single
60c05adf00d4d04fce727b486e8ecdfa87ff3992patch cherry-picked ontomainff04a75e58b5fb63e8638fa8cbdae8d98b06f48a(locala9b053f317dd38b144033c8395b4df6709b3bf0a). The four-file change applied cleanly. Neither of the two migration-only heap commits was needed for these fixtures.Windows 11
26300.10075, MSVC 19.52, SDK 10.0.26100, DXC 1.9.2602.17, GeForce RTX 4070 (32.0.16.2124, default adapter, SM 6.6 / wave32, debug layer off for native replay).Both presets passed 8/8 without skips.
native_ldexp_hardwarematched all 2,064 words per preset. The integer DXIL and operand-refusal controls passed.As an independent Release check, I replayed 192 input/exponent pairs across 24 dispatches and compared all 49,536 readback words against
math.ldexpin binary64, rounded once withstruct.pack('<f', ...). This scaling is exact in binary64 for finite binary32 inputs in the allowed exponent range. The sweep included signed zero, adjacent subnormal/normal values, underflow ties, overflow, infinities, NaN payloads and bothINT32exponent extremes. All matched. The local WARP adapter advertises 4-lane waves, so the native replay does not apply to it.Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-27T13:52:26Z.
@R0Y00 Replayed just the single
v_ldexp_f32commit ontomain(36d2cbeb->35b43fac, updating the base SHA indocs/experiments/native-direct-ldexp.md) and retargeted PR #3057 tomain. Confirmed neither #3034 nor #3042 is needed for this change or its fixtures.Thanks @RonLogic for the independent RTX 4070 and 192-case
math.ldexpverification.Re-verified locally on
35b43fac(devpreset):cmake --build --preset dev --target compile_dxil native_store_replay: okctest --preset dev --no-tests=error -R '^native_ldexp_' -V:native_ldexp_controlspassed (1.03 s);native_ldexp_hardwareskipped (77, Quadro M1000M does not support shader model 6.6 with wave32 — readback unmeasured locally)python -B tests/docs_links_check.py: passed (75 Markdown files and 585 links)AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T14:37:51Z.
Review: APPROVED
Reviewed
35b43facintegrated withmain2a4bbff5(tree2974b781d9a265c74a68df1d282c5053456a5b5d). The retargeted diff contains only the fourv_ldexp_f32files. The lowering bounds shifts even on discarded lanes, retains special values without clamp, and rounds subnormal results using the retained significand bit. Builtcompile_dxil native_store_replayand ranctest --test-dir <build> --no-tests=error -j 1 -V -R '^native_(ldexp|absdiff|perm_lerp|cvt_pk16)_(controls|hardware)$'in Debug and Release/O2. Both passed 8/8 with zero skips, andv_ldexp_f32matched all 2,064 words on RTX. The compile and incorrect-reference controls passed. Windows 11 build 26200.9974, RTX 4060 Laptop driver 32.0.16.1656, SDK DXC 10.0.26100, native replay debug layer off. The native fixture requires wave32 and has no local WARP coverage.