Repository navigation
shader: map inline binary16 float constants in v_floor/ceil/trunc/rndne_f16 - #3322
Conversation
|
Is excluding graphics stages here intentional?
|
|
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 Removed Re-verified on NVIDIA GeForce RTX 5080 (
|
tedin7
left a comment
There was a problem hiding this comment.
Review of head 3df02e65 (the PR's own change is unchanged; the new head only merges current main).
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.- The 240..248 range matches the table size; other sources still use the masked operand.
- Tests:
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). - #3135 added the rounding lowering; no other open PR covers this slice.
Commands run:
- Linux:
git diff --check origin/main...HEADclean,python3 -m py_compile tests/native_round_f16_check.pyok. - Windows Server 2025, D3D12 WARP 1.0.22,
-R '^native_round_f16_(controls|hardware)$': dev 2/2 passed, release 2/2 passed. - Mutation 1 (the inline range starts at 241):
native_round_f16_hardwarefails at inline word 9 (got beef0000, expected beef3c00). - Mutation 2 (inline word sign flipped): both tests fail (DXIL check, and readback at inline word 8).
No blocking findings. The receipt follows in a separate comment.
AI-assisted; commands listed were executed locally.
|
Win2025 WARP receipt for head 3df02e6 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
AI-assisted; commands listed were executed locally. |
Fixes #3318. 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.