Skip to content

docs(design): v_pack_b32_f16 abs is measured and translated, not refused - #6156

Closed
vA7md wants to merge 1 commit into
ItsNotRexed:mainfrom
vA7md:docs/design-pack-b32-f16-abs
Closed

vA7md wants to merge 1 commit into
ItsNotRexed:mainfrom
vA7md:docs/design-pack-b32-f16-abs

Conversation

@vA7md

@vA7md vA7md commented Nov 23, 2026

Copy link
Copy Markdown

Fixes #5517.

What

docs/design.md row | `v_pack_b32_f16` input `neg` | said "abs is still refused, because its rule on this instruction is unmeasured (SHADER-260)". The translator accepts abs and the rule is measured.

tools/rdna2spirv.py handles both modifiers in the v_pack_b32_f16 case: abs clears bit 15 of the selected 16-bit half, then neg XORs 0x8000 into it. The inline comment there cites the gfx1036 measurement (1,088 raw kernels, -v0, |v0| and -|v0|, 0 mismatches, #1548 / SHADER-260).

The row now says abs is measured, keeps what is still not modelled (the mode-1 quieting of a signalling-NaN half, SHADER-190), and names the semantic test that pins abs: tests/semantic/test_pack_b32_f16_mods.py, which translates v_pack_b32_f16 v0, |v1|, v1 and v_pack_b32_f16 v0, -|v1|, v1.

The table also contradicted itself: the row further down for source modifiers already lists neg, abs and neg_abs as hardware-verified for this instruction family.

Nothing else in the row changed; the neg behaviour it documents is still correct.

How I checked

On main 561b65a8:

python -m unittest discover -s tests/semantic -p 'test_pack_b32_f16_mods.py'
# Ran 6 tests ... OK

and tools/rdna2spirv.py, v_pack_b32_f16: src.get("abs") emits OpBitwiseAnd %uint <half> 0x7FFF before the src.get("neg") OpBitwiseXor %uint <half> 0x8000, so abs is not refused.

I did not re-run the gfx1036 measurement; the row still attributes it to @Sanonymous01, as before.

Tested

Docs only, no GPU, no game files. On the branch, python -I tests/test_docs_links.py -b, python -I tests/test_docs_repo_paths.py -b and python -I tests/test_docs_design_rows.py -b all pass. test_docs_design_rows.py is what caught my first attempt: writing |v0| unescaped split the row into 11 cells instead of 3, so the pipes are \| as the table needs. Worth knowing for anyone editing these rows.

AI-assisted.

@Coderlord

Copy link
Copy Markdown

Code read at 7e54b80 (no build or run). Correct. The v_pack_b32_f16 branch in tools/rdna2spirv.py (line 6975 on) applies abs (clear bit 15) before neg (flip bit 15), and its comment cites the same gfx1036 run (1,088 raw kernels, 0 mismatches, SHADER-260). tests/semantic/test_pack_b32_f16_mods.py is on main and covers the abs forms, so "still refused" was stale.

AI-assisted review.

@vA7md

vA7md commented Nov 23, 2026

Copy link
Copy Markdown
Author

Closing as a duplicate of #5574, opened first, which fixes the same v_pack_b32_f16 row for #5517. My verification agreed with it (abs clears bit 15 before neg XORs 0x8000, and tests/semantic/test_pack_b32_f16_mods.py covers the abs forms), so there is nothing here #5574 does not already do.

@vA7md vA7md closed this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs/design.md: the v_pack_b32_f16 "input neg" row says abs is still refused, but the translator implements and tests it

2 participants