shader: lower v_cvt_f16_u16, v_cvt_f16_i16, v_cvt_u16_f16 and v_cvt_i16_f16 in the direct compute path #3159
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3159"
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-27T19:09:19Z.
Lowers
v_cvt_f16_u16,v_cvt_f16_i16,v_cvt_u16_f16, andv_cvt_i16_f16(VOP1 and VOP3A) in the direct C++ compute path (src/gfx1013_direct_compute.inl), preservingD[31:16]and enforcing the binary16 MODE contract viahalf_binary.Verification
Measured on Windows 10.0.26100 (
devpreset) atupstream/main429f11d5+6772a597:ctest --preset dev --no-tests=error -R '^native_cvt_f16_i16_' -V:native_cvt_f16_i16_ir(passed,1.09s): evaluates DXIL IR vianative_compute_ir_dumpacross 82 conversion cases (VGPR, SGPR, literal, inline ints/floats, VOP3clamp/abs/neg/-|x|, RNE ties, saturation, subnormals, infinities, NaNs, non-zero upper halves) and 38 refusals (DPP, SDWA,omod,op_sel, illegalabs/neg/clamp,src1, and MODE writes).native_cvt_f16_i16_controls(passed,3.84s): compiles all 82 conversions to DXIL viacompile_dxiland verifies all 38 refusals.native_cvt_f16_i16_hardware(skipped, exit77): Quadro M1000M does not support shader model 6.6 with wave32, so GPU readback is not measured.ctest --preset dev --no-tests=error -R '^native_.*_(controls|ir)$' --output-on-failure: 47/47 passed (54.43s).python -B tests/docs_links_check.py: passed (101 Markdown files, 589 links).zero_high_half,drop_ordered_nan,swap_signed,drop_clamp,wrong_inline_float) each failednative_cvt_f16_i16_ir(exit1).Fixes #3148
Refs #2935
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T20:42:48Z.
Review: COMMENTED
Review of
7adec5b78f(updated with main). Comment only.The four conversions read inline float sources 240-248 as their binary16 values (the same nine constants as
inline_half_words, which #3147 just made a shared member; the localhalves[]copy here could use it in a follow-up), and literal and inline integer sources as their low 16 bits.f16 -> i16/u16truncates throughfptosi/fptouionly on an in-range value, saturates out-of-range values to the type bounds and maps NaN to 0;i16/u16 -> f16goes through f32 andpacked_half_rne, which is exact because every 16-bit integer is exact in f32. Unsupported forms (DPP, SDWA, omod, op_sel high half, modifiers on the integer source, an unknown rounding or denormal mode) are refused.native_cvt_f16_i16_irchecks 82 cases at the IR level without a GPU, so the semantics are covered on WARP hosts and in CI even though the_hardwareleg skips.src/gfx1013_direct_compute.inlis also changed oncpp-migration; this merges cleanly there and the native sweep passes on that merge (comment below).Commands:
git diff origin/main...pull/3159/head(read),git merge-tree --write-tree origin/cpp-migration pull/3159/head, plus the Windows commands in the comment below.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T20:42:49Z.
Windows Server 2025 verification of
7adec5b78f8c0467765ef7857bb4db10be3ed5f5(D3D12 WARP, MSVC 14.44.35207):cmake --build --preset dev --target compile_dxil native_store_replay native_compute_ir_dump;ctest --preset dev -R <native sweep>: 100% tests passed out of 143 (84 passed, 59 hardware legs skipped), includingnative_cvt_f16_i16_irandnative_cvt_f16_i16_controls--preset release;ctest --preset release -R <native sweep>: 100% tests passed out of 143 (84 passed, 59 skipped)cpp-migration(a0f67731): 100% tests passed out of 143 in both presets<native sweep>= everynative_*test exceptnative_startup_request_cache_hardware, which fails on WARP-only hosts with or without this PR.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by xiaoqi72665 on 2026-11-27T21:35:23Z.
@legacy-code-archaeologist Thanks for #3159. During #3185's rebase regression on
5b145ca, the stock conversion hardware fixture reached its last guard assertion and raisedAttributeError: module 'native_f16_alu_check' has no attribute 'SENTINEL'(tests/native_cvt_f16_i16_check.py). The preceding 82 conversion comparisons across both groups passed. With an ignored local diagnostic copy comparing the entire 2064-DWORD buffer to the expected conversion positions plus 0x69696969 guards, RX 7900 XT and app-local WARP passed in both Debug and Release on Win10. Suggested minimal fix: construct the full expected buffer (including zeros in the actual guard check), rather than filtering zero words. IR and compile controls also passed. No changes to your files in #3185. AI-assisted, tested locally by Buhe.