Skip to content

docs: correct v_pack_b32_f16 modifier status - #7382

Open
Hugo9985 wants to merge 1 commit into
ItsNotRexed:mainfrom
Hugo9985:codex/docs-vpack-input-mods-5517-20261123
Open

Hugo9985 wants to merge 1 commit into
ItsNotRexed:mainfrom
Hugo9985:codex/docs-vpack-input-mods-5517-20261123

Conversation

@Hugo9985

@Hugo9985 Hugo9985 commented Nov 23, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as:

Depends on:

What and why

Tested

AI-assisted:

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

@wavehs

wavehs commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 5040b5938c merged onto main dde82f27e on macOS arm64 (Apple M3 Pro, Python 3.15.2, CPU only, no game files): the facts are right, but the row shape is not. Please do not land it as written.

What checks out

  • tools/rdna2spirv.py:7326-7360 does exactly the new sentence: abs is OpBitwiseAnd … 0x7FFF, then neg is OpBitwiseXor … 0x8000, on the selected half.
  • tests/semantic/test_pack_b32_f16_mods.py exists and covers abs and neg_abs (6 tests, OK).
  • The hardware numbers (1,088 raw kernels, SHADER-260, gfx1036) match the existing "source modifiers" row and the code comment.

The problem: this makes a second row for one topic. docs/design.md:304 ("input neg") and :307 ("source modifiers") already describe the same v_pack_b32_f16 modifiers. Row 307 is the superset: it has abs before neg, neg_abs, the 1,088-kernel gfx1036 run, the gfx1035 check, the IEEE-0/1 sNaN behaviour, @Sanonymous01's measurement, and the same test list. Rewriting row 304 to restate all of that leaves two rows with the same rule, which is what the table's "one row per topic" cleanup (2e52b2f) is meant to prevent — and tests/test_docs_design_rows.py cannot see it because the first cells differ.

The change that keeps every fact and removes the duplication is to delete row 304 (nothing unique is lost: its 192-kernel mode-0/mode-1 neg measurement and the @Sanonymous01 credit are both in row 307). If you would rather keep a short row there, make it one sentence pointing at the source-modifiers row, as #5574 does.

Please also coordinate with the open work on these exact rows: #5574 rewrites row 304, #5297 and #5402 rewrite row 307, and #5775/#7978 touch the same facts. As written this conflicts with whichever lands first; Depends on: should name the one you build on.

Two more things

Tests on the merge: python -I tests/semantic/test_pack_b32_f16_mods.py 6 OK; python -I tests/test_docs_*.py 9 files OK and the same two failures as main (docs/embedded_shaders.md LLVM opt flags, #7476; the docs/dev-tools.md anchor and docs/gpu_test_results.md link, #7217/#7351 and #7531/#7532). python -m compileall -q make_game.py tools tests: OK.

AI-assisted (an agent session).

@sovljanskii

Copy link
Copy Markdown
Contributor

Tested 5040b59 merged onto main dde82f2 on Apple M4, macOS 27.2.1, Python 3.15.2 and 3.12.16: needs changes. The new sentence matches the code. This adds two points the earlier check of this head doesn't cover.

  • Ran on both Pythons: tests/semantic/test_pack_b32_f16_mods.py (6 OK), test_valu_pack_b32_f16.py (10 OK), test_vop3_const_mods.py (12 OK). All tests/test_docs_*.py plus test_i18n_index.py show the same two failures as main (test_docs_cli_flags, test_docs_links), with identical output. git diff --check and compileall are clean.
  • Mutation: I made the abs lowering a no-op (tools/rdna2spirv.py:7343, OpBitwiseAnd … 0x7FFF). Three tests in test_pack_b32_f16_mods.py then fail, so the row's "covers abs and neg_abs" holds.
  • The stale status is still in the table. docs/design.md:307 (the "source modifiers" row) still says "abs rests on the ISA's definition of ABS on a float operand … no hardware run of this instruction with abs exists yet". The new row 304 says both modifiers are hardware-measured. Deleting row 304 as suggested would leave the stale sentence as the only statement. Whichever row survives, that sentence has to go, along with the truncated bold fragments just before it. docs: clean up the v_pack_b32_f16 source modifiers row and record its GPU-verified result #5297 removes it; docs(design): drop duplicated sentences in the v_pack_b32_f16 modifiers row #5402 removes it and adds it back.
  • clamp is neither handled nor refused. I ran a hand-written probe through rdna2spirv.translate and the semantic interpreter on main. v_pack_b32_f16 v0, v1, v2 gives the same word with clamp as without, and also with op_sel:[0,0,1]. llvm-mc -mcpu=gfx1030 encodes both forms (clamp sets bit 15 of the first dword). The branch at tools/rdna2spirv.py:7326-7356 reads only op_sel[0..1] and abs/neg, so clamp and the destination op_sel bit are silently dropped. Neither row says so. Either add a sentence ("clamp and the destination op_sel bit are accepted and ignored; their effect is unmeasured"), or have the translator raise Unsupported on clamp, as it does for other unmeasured clamps (tools/rdna2spirv.py:7213-7214, 8101-8102). mul:, div: and op_sel_hi can't be encoded on this opcode, so they can't occur.

AI-assisted.

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.

3 participants