Repository navigation
Conversation
…v_pk_max/min_u16/i16
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 610d5148 on Windows 11:
python tests/semantic/test_pk_int16_clamp.py-> 5 tests, OK (translator-driven cases for all five ops, clamp on/off, overflow wrapping and signed/unsigned semantics).python -I tests/test_pk_int16_clamp_probe.py-> 7 tests, OK (1 skipped).compileallandgit diff --checkclean.
The translator now follows the measured RDNA2 rule that VOP3P clamp is a no-op on these five operations, including the overflowing v_pk_mul_lo_u16 wrap rather than saturation; the CPU tests would fail if clamp were applied. I cannot reproduce the gfx1036 measurement on this NVIDIA host, but the probe/test structure and the existing test_alu_pk_int16.py coverage are consistent. No blocking issue.
|
Tested 610d514 on a non-AMD GPU: NVIDIA GeForce RTX 3070 (Ampere, wave32), driver 617.42, Windows 11 24H2 (26100). The translated How: from this branch's own
So the "clamp is a no-op on these five" rule measured on gfx1036 holds through Vulkan on NVIDIA, and the No game files. AI-assisted (Claude). |
|
Automated test:
Same machine and setup as my earlier manual reports. AI-assisted (Claude Code). |
|
Added RTX 3080 full-wave coverage at the same head: 1,024/1,024 words matched across two dispatches, including lane IDs and untouched guards. Zero core or synchronization validation diagnostics. AI-assisted. |
|
Tested 610d514 on AMD Radeon RX 9070 XT (RADV GFX1201) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
Claim: #3918 (comment)
AI-assisted
Summary
Measures and supports RDNA2 VOP3P
clamponv_pk_mul_lo_u16,v_pk_max_u16,v_pk_min_u16,v_pk_max_i16, andv_pk_min_i16intools/rdna2spirv.py(previously rejected withUnsupported).Native measurement on RDNA2 (
gfx1036, wave32 & wave64) establishes that VOP3Pclampis a hardware no-op on all five operations — notably overflowingv_pk_mul_lo_u16 clampwraps modulo 2^16 rather than saturating to0xFFFF, andv_pk_{max,min}_{u16,i16} clampleaves results unchanged — whilev_pk_add_u16 clampsaturates to0xFFFFas a positive control.Changes
tools/rdna2spirv.py: Treat VOP3Pclampas a no-op onmul_lo,max, andmin(clamp = "clamp" in mods and kind in ("add", "sub", "mad")), tighten the modifier guard to reject any unknown modifier alongsideop_sel/op_sel_hi/neg_lo/neg_hi, and document the measured hardware rule.tools/pk_int16_clamp_probe.py: Standalone hardware oracle probe covering all five target ops plusv_pk_add_u16control acrossplainandclamp, overflowing products, signed/unsigned boundaries,op_sel/op_sel_hipermutations, inline/literal constants (-1,-16,5,64,0x02000400,0x80017fff), SGPR operands, and destination aliasing across wave32 and wave64.tests/test_pk_int16_clamp_probe.py: Offline unit tests, mocked-oracle success/mismatch/error/CLI tests, and gated livegfx1036oracle execution.tests/semantic/test_pk_int16_clamp.py&tests/semantic/test_alu_pk_int16.py: Semantic interpreter tests over all 26 probe cases, SPIR-V non-saturation assertion (UMin/SClampomitted on target ops withclamp,UMinemitted onv_pk_add_u16 clamp), inactiveEXECpreservation,spirv-as/spirv-val --target-env vulkan1.2validation, and invalid-modifier rejection tests (neg_lo,neg_hi,mul:2,div:2, mismatchedop_sel).docs/design.md: Update thePacked 16-bit integer opsrow with the measuredclamprule and hardware/semantic/Vulkan verification details.Verification
AMD Radeon(TM) Graphics,gfx1036, Windows 11, driver32.0.21045.29003, wave32 & wave64 viapython -I tools/pk_int16_clamp_probe.py --hw-arch gfx1036):624evaluations across 2 waves × 6 ops × 2 clamp modes —mismatches=0, wave_diffs=0, target_clamp_diffs=0, control_clamp_diffs=34.vk_compute_test.exe,VKC_SUBGROUP_SIZE=32,VK_LAYER_KHRONOS_validation 1.4.363,spirv-val --target-env vulkan1.2):96words compared,mismatches=0, target_clamp_diffs=0, control_clamp_diffs=5,0validation errors on both:AMD Radeon RX 9070 XT(Vulkan driver26.11.2 (LLPC))AMD Radeon(TM) Graphics(gfx1036, Vulkan driver26.11.2)python -I tools/pk_int16_clamp_probe.py --self-test→ exit0(26 cases, 312 checks/wave)python -I tests/test_pk_int16_clamp_probe.py -v→7 OKwithLEONIDA_AMD_CLANGlive oracle;7 OK (skipped=1)without oraclepython -I tests/semantic/test_pk_int16_clamp.py -v→5 OKpython -I tests/semantic/test_alu_pk_int16.py -v→7 OKpython -I tools/pk16_diff.py --self-test→match True, hand values True, unsupported form skipped Truetest_text_write_line_endings.py(3 OK),test_resource_hygiene.py(2 OK),test_ci_registration.py(8 OK),test_docs_links.py(6 OK),test_docs_repo_paths.py(2 OK),test_docs_list_items.py(2 OK).python -I -m unittest discover -s tests/semantic(7,461tests): all packed-int16 and ALU tests passed;7failures and2errors observed strictly in 3 unrelated pre-existing upstream files onaa2988cc(test_loop_ballot_barrier.py,test_cmp_class_f64.py,test_mutations.py).All inputs are synthetic; zero game files were read or modified.