shader: map inline binary16 float constants in v_floor/ceil/trunc/rndne_f16 #3324
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3324
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3322"
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?
@R0D4X on GitHub · 2026-11-28 09:32 UTC · original
R0D4X:fix/native-round-f16-inline→main· +85 −39 · 4 files · 3 commits · merged 2026-11-28 11:14 UTCFixes #3320. Refs #2935.
What this changes
src0in240..248) throughinline_half_words[r - 240]in thev_floor_f16,v_ceil_f16,v_trunc_f16, andv_rndne_f16lowering insrc/gfx1013_direct_compute.inl(matchingv_frexp_mant_f16/v_frexp_exp_i16_f16), instead of truncating the f32 bit pattern.if (graphics_input) return false;to the binary16 rounding block and tightenstests/cmake/native_round_f16.cmaketoTARGET compile_dxil AND TARGET native_store_replay.Tests & docs updated
tests/native_round_f16_check.py: adds an inline-constant batch (0.5,-0.5,1.0,-1.0,2.0,-2.0,4.0,1/(2*pi)=0x3118) across all four opcodes, DXIL constant checks (14336,12568), and aninline_as_zeronegative control.docs/experiments/native-round-f16.md: documents inline binary16 float constant coverage.Verification
13059b7910.0.26300.9974), MSVC19.44.35230, Windows SDK / DXC10.0.26100.0, NVIDIA GeForce RTX 5080 (10de:2c02, driver32.0.16.2140).ctest --preset dev --no-tests=error -R '^native_round_f16_|^native_frexp_f16_' -V: 5/5 passed (0 skipped).ctest --preset release --no-tests=error -R '^native_round_f16_|^native_frexp_f16_': 5/5 passed (0 skipped).tests/docs_links_check.py&tests/bidi_controls_check.py: passed.Scope: covers synthetic direct-DXIL compute fixtures for
v_floor_f16,v_ceil_f16,v_trunc_f16, andv_rndne_f16only; does not establish full-game execution.@Leyukaka on GitHub · 2026-11-28 09:57 UTC · original
Is excluding graphics stages here intentional?
if (graphics_input) return false;removes the only direct DXIL lowering ofv_floor_f16,v_ceil_f16,v_trunc_f16andv_rndne_f16(src/gfx1013_direct_compute.inl1506 onmain). The direct graphics path setsgraphics_input(src/gfx1013_direct_graphics.inl1309) and callsalu.arithmetic(1989), so vertex and pixel stages that lower these ops onmainwould getdirect DXIL lowering for v_floor_f16(line 4021).v_frexp_*_f16,v_fract_f16andv_cvt_norm_*_f16have no such guard, andtests/native_fract_f16_check.pycompilesv_fract_f16throughgfx1013-container-ps. If the exclusion is intended, please give the reason and say that graphics stages now refuse these ops, both in the PR text and in the experiment note, and add a graphics-stage refusal control.@R0D4X on GitHub · 2026-11-28 10:02 UTC · original
Good catch @Leyukaka — excluding graphics stages was unintentional. These four ops use pure integer bit manipulation with no FP16 mode dependence and already lower in direct graphics stages on
main.Removed
if (graphics_input) return false;inf5cbd971so this PR stays strictly scoped to mapping inline binary16 float constants240..248for both compute and graphics stages.Re-verified on NVIDIA GeForce RTX 5080 (
10de:2c02, driver32.0.16.2140), Windows 11 (10.0.26300.9974), MSVC19.44.35230, SDK DXC10.0.26100.0:ctest --preset dev --no-tests=error -R '^native_round_f16_' -V: 2/2 passed (0 skipped).ctest --preset release --no-tests=error -R '^native_round_f16_' -V: 2/2 passed (0 skipped).@tedin7 on GitHub · 2026-11-28 11:13 UTC · original · reviewed
Review of head
3df02e65(the PR's own change is unchanged; the new head only merges currentmain).What I checked:
src/gfx1013_direct_compute.inl: in thev_floor_f16/v_ceil_f16/v_trunc_f16/v_rndne_f16lowering, source operands 240..248 now read their binary16 pattern frominline_half_words[r - 240], the same table the neighbouringv_frexp_*_f16lowering already uses. Before, the f32 bit pattern of the inline constant was truncated to 16 bits. Abs/neg modifiers are applied after the lookup, as before.native_round_f16_controls(the DXIL must contain the inline 0.5 and 1/(2*pi) f16 words) andnative_round_f16_hardware(real D3D12 readback on WARP against a plain Python binary16 reference for the new inline-constant program as well as the main one; it ran and did not skip).Commands run:
git diff --check origin/main...HEADclean,python3 -m py_compile tests/native_round_f16_check.pyok.-R '^native_round_f16_(controls|hardware)$': dev 2/2 passed, release 2/2 passed.native_round_f16_hardwarefails at inline word 9 (got beef0000, expected beef3c00).No blocking findings. The receipt follows in a separate comment.
AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-28 11:13 UTC · original
Win2025 WARP receipt for head
3df02e65after updating with main.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
3df02e65781142875f836fb03d6fc6050ddf6ee7:--preset dev):cmake --build --preset dev --target compile_dxil native_store_replay -- -j 6):5.65s(configure1.67s)ctest --preset dev -R '^native_round_f16_(controls|hardware)$' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (0.75s:native_round_f16_controls0.37s,native_round_f16_hardware0.38s)/O2(--preset release):cmake --build --preset release --target compile_dxil native_store_replay -- -j 6):31.91s(configure1.59s)ctest --preset release -R '^native_round_f16_(controls|hardware)$' --parallel 6 --no-tests=error --output-on-failure): 2/2 passed (0.67s:native_round_f16_controls0.30s,native_round_f16_hardware0.30s)sccache: 14/18 hits; wall38.9sAI-assisted; commands listed were executed locally.