docs(shader): cut the f16 SDWA clamp entry to its NaN test gap #17974
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17974"
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 boykopovar/AnyPS5. Originally posted by Nawid3333 on 2026-11-10T02:05:33Z.
What
Cuts the "f16 VOP2 SDWA clamp with byte selectors" entry in
docs/dev/debt/shader.mdto what is still open. It changes no code.The entry said the order of clamp and destination select was not measured on hardware. The order is: the f16 result is clamped as without SDWA, then written into
DST_SELasDST_Usays. The RDNA2 ISA doesn't state it; ACO and LLVM assume it.The order is now measured on RDNA2 for every selector triple that has a byte selector, NaN results included. The entry's closing condition was "measured with clamp on RDNA2 or a PS5", so that part is closed.
What stays open is that the tests pin no NaN result. The entry now leads with that and closes when a measured NaN row is pinned in
SdwaFloatSelectors.cpp.Tested
All runs were on an AMD Ryzen 5 7600X iGPU (RDNA2, gfx1036), AMD Windows driver 32.0.21045.16010, Windows 11 Pro build 26200. They went through
tools/hw-oraclewith the HIP runtime, in wave32.The existing test's kernel on hardware. The 17 instruction words of
ClampCodeinSdwaFloatSelectors.cppran natively with the test's 32Rows. All 183 checked values equalClampExpected, under all four combinations of IEEE 0/1 and DX10_CLAMP 0/1.The order itself. Each kernel holds 8 cases. For each case it computes:
UNUSED_PRESERVE);v_bfe_u32(v_mov_b32for a DWORD selector).The VOP3 result, inserted into the
DST_SELfield asDST_UNUSEDsays, is the expected value.v_add_f16,v_sub_f16,v_subrev_f16,v_mul_f16,v_max_f16,v_min_f16andv_ldexp_f16.SRC0_SELxSRC1_SELxDST_SELtriple that holds a byte selector, 2,212 cases in all. Each case got oneDST_UNUSEDmode, chosen at random.Result: 141,568 of 141,568 lane results match.
DST_SELandDST_UNUSEDsay.The scripts and per-lane results: anyps5-sdwa-f16-clamp-rdna2-evidence.zip.
python3 tools/check_conventions.py --base origin/main: all conventions checks passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-10T17:49:57Z.
Review: COMMENTED
Read
8d145ef744againstmain.Correctness. The entry on main says the clamp and
DST_SELorder is "not measured on hardware" and closes "when measured with clamp on RDNA2 or a PS5"; the PR records the measurement on gfx1036 and narrows the open part to NaN results.docs/dev/HW_ORACLE.mdandcore/libs/prx/libSceAgcDriver/tests/execution/SdwaFloatSelectors.cppexist on main, and the test pins its clamp results throughClampExpectedwith a per-rowClampCheckedmask (SdwaFloatSelectors.cpp:131-175,:236-241), so "the tests pin no NaN result" is plausible; I did not decode every masked cell to prove it. The measurement itself cannot be checked from the code. The other shader.md PRs (#17807, #18026) edit different entries.Not run here; this is from reading the code.
AI-assisted: yes.