Repository navigation
rdna2spirv: support VOP3 clamp on v_sad_* ops (SHADER-845) - #5620
kotekompotek wants to merge 2 commits into
Conversation
|
AI-assisted review. Two existing tests fail on c1067ad. Both tests expect the translator to reject the clamp modifier. This change makes the translator accept it. Run these commands on Windows: py -3.14 -I tests/semantic/test_alu_sad.py
py -3.14 -I tests/semantic/test_alu_sad_u32.pyOn parent 3faac55, all 40 tests pass. On the PR head, 38 pass. Please update both tests to check the output of the translator. Use one input that causes overflow and one that stays in range. The overflow case should distinguish saturation from unsigned wraparound. |
|
Tested
No GPU, no game data. AI-assisted. |
Kam471
left a comment
There was a problem hiding this comment.
Reviewed c1067ad0f07127ec9734cf48278356d38204e167 on Windows 11 / Python 3.13.15.
python tests/semantic/test_sad_clamp.py -q-> 2 tests OK (also with-I)- Manual run of all five ops through
support.translate_lines/mrt0_words:v_sad_u8,v_sad_hi_u8,v_sad_u16,v_sad_u32,v_msad_u8clamp ->0xffffffffon overflow; without clamp they wrap; maskedv_msad_u8->0x10. - Negative control on the
3faac557btranslator: new test -> 3 errors (Unsupported: v_sad_* clamp) git diff --check 3faac557b..HEAD-> clean
Blocker: this PR leaves existing tests red.
python tests/semantic/test_alu_sad.py -q-> 5 tests, 1 failure (test_clamp_is_rejected_not_guessed)python tests/semantic/test_alu_sad_u32.py -q-> 35 tests, 1 failure (test_clamp_modifier_rejected)
Update those two stale rejection assertions to the new saturation behavior. Also consider adding v_sad_u32 / v_msad_u8 cases: the new test covers only 3 of the 5 ops. Request changes.
|
Tested
Verdict: needs changes. The two existing tests need updating as shdann described, and AI-assisted. |
|
Thanks @shdann, @Kam471, and @sovljanskii! Updated in
|
|
Still FAIL as it stands, though the shape changed since first review: your new head 9357d1c renames the two pinned rejection tests to saturation tests, so the merged tree is now green (re-run: test_alu_sad 5/5, test_alu_sad_u32 35/35) — but that removed the symptom, not the objection. docs/design.md's SAD row still says verbatim " |
|
Tested
AI-assisted (Claude Code). |
|
Tested 9357d1c (merged onto main 86a7807) on NVIDIA GeForce RTX 2060 (Turing), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 (10.0.26300), subgroup size 32: pass (no regression) What I ran:
No GPU test changed status against main. This PR adds no GPU fixture of its own, so the run checks that the translator change breaks none of the existing GPU tests; it does not exercise the new rule directly. Unit tests changed by the PR: The one failure on both sides is AI-assisted run (Claude Code); the numbers are from my machine. |
|
Tested
No GPU fixture in the suite exercises |
|
checked: |
Implements SHADER-845 (claimed in #4933):
clamprejection onv_sad_u8,v_sad_hi_u8,v_sad_u16,v_sad_u32,v_msad_u8intools/rdna2spirv.pyand emits unsigned 32-bit saturating addition (OpULessThan %bool+OpSelect %uint ... 0xFFFFFFFF) when"clamp" in mods.tests/semantic/test_sad_clamp.py(2/2 OK).python -I tests/semantic/test_sad_clamp.py -v(2/2 OK)git diff --check(clean)