Skip to content

docs/design.md: one copy of each rule in the 16-bit interpolation without PerVertexKHR row - #4903

Open
LouisRiverstone wants to merge 1 commit into
ItsNotRexed:mainfrom
LouisRiverstone:docs-f16-interp-row
Open

LouisRiverstone wants to merge 1 commit into
ItsNotRexed:mainfrom
LouisRiverstone:docs-f16-interp-row

Conversation

@LouisRiverstone

Copy link
Copy Markdown
Contributor

The row I left out of #4899 because its copies disagree on a number. The code settles it.

"16-bit interpolation without PerVertexKHR (--f16-interp-fallback)" (8,031 → 5,960 characters) had four versions of its location rule:

  • Before SHADER-291: halves at 29 − 2N / 30 − 2N, "below MoltenVK's 31 locations".
  • SHADER-291: halves at 28 − 2N / 29 − 2N, "so nothing goes above location 29".
  • Two "producer leaves out" sentences: one says params 0..(28 − P) / 2, the other 0..(29 − P) / 2. One says a colliding PS is rejected (Unsupported); the newer one says it is packed into free locations (SHADER-378).

The code decides it: F16_HALF_TOP = 29, f16_half_location(n, h) = 29 − 2n − 1 + h (= 28 − 2n / 29 − 2n), and the comment next to it: "a producer with params 0..P-1 has room for the halves of params 0..(28 - P) / 2". assign_f16_half_locations packs collisions instead of refusing them. So the row keeps the SHADER-291 sentence, the (28 − P) / 2 + dynamic-packing sentence, and drops the other two.

Also fixed:

  • The SHADER-378 sentence was split at an unescaped |F|. Its second half (mesh_compute_vs.py's pair_f16_halves, the runtime's spirv_f16_halves.h relocation and synthesis) had been spliced after "Not combined with --bary-fallback's geometry shader.", and its first half appeared twice. It's whole again, with the pipe escaped.
  • Four "Unverified" notes became one. It holds every item they named: the over-full producer, the native MoltenVK validation and corpus recount, native MeshEXT PSOs, and devices with fewer than 124 output components. "Fewer than 31 output locations" is dropped, since it's the same bound as 124 components.

All measurements, attributions and test lists stay.

Checked:

  • the kept location rules against tools/rdna2spirv.py (F16_HALF_TOP, f16_half_location, assign_f16_half_locations)
  • same column count as the neighbouring rows, and no unescaped | inside the cell
  • the tests/test_docs_*.py checks pass

Docs only, no game files. Claimed on #4816 (with the #4899 claim, which named this row as needing the code).

AI-assisted (Claude Code): I reviewed and ran the checks.

…hout PerVertexKHR row

The row held four versions of its location rule: the pre-SHADER-291 one (halves
at 29 - 2N / 30 - 2N), the SHADER-291 one (28 - 2N / 29 - 2N), and two
producer-room sentences disagreeing on (28 - P) / 2 vs (29 - P) / 2, one of them
saying a colliding PS is rejected where the newer one (and the code) packs it.
The SHADER-378 dynamic-packing sentence was split at an unescaped |F|, its
second half spliced into 'Not combined with --bary-fallback'. The code fixes
the numbers: F16_HALF_TOP = 29, f16_half_location(n, h) = 28 - 2n + h, and its
comment's room for params 0..(28 - P) / 2; assign_f16_half_locations packs
collisions. The row now keeps the SHADER-291 / (28 - P) / dynamic-packing
versions, the SHADER-378 sentence whole, and one Unverified list with every
item the copies named. No behaviour change.

@whattheflop whattheflop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent CPU check of the edited contract, AI-assisted, with uv CPython 3.12.13. Ten synthetic producer counts (including odd/even boundaries at 27, 28 and 29) agreed with the floor of (28 − P)/2 for the highest reserved pair. Eight fragment allocation cases covered canonical pairs, raw-output collisions, the negative canonical location for parameter 15, and the full budget boundary. With exactly two free locations the remaining pair fit; with only one free it returned Unsupported. Repacked locations were distinct and within 0–29.

The revised row retains the barycentric-GS limitation and distinguishes the location window checked here from the device's output-component limit. This checks allocator behavior and the documentation, with no GPU or game inputs. Whitespace check passed.

@LouisRiverstone

Copy link
Copy Markdown
Contributor Author

Thanks @whattheflop for exercising the allocator itself: the ten producer counts agreeing with (28 − P) / 2 at the 27/28/29 boundaries, the repacking cases, and the one-free-location Unsupported. That's the check the kept sentences needed. Nothing is pending.

@kapitche

Copy link
Copy Markdown
Contributor

Tested eb16962 merged with main 3faac55 on Linux, Python 3.12.16: pass

All 10 tests/test_docs_*.py pass (exit 0). Docs-only (one line of docs/design.md, the "16-bit interpolation without PerVertexKHR" row); no code, so no new test and no negative control applies.

Content check, comparing every sentence of the old row with the new one: nothing lost that is still true. Dropped only (a) the stale 29 - 2N / 30 - 2N half-location sentence, superseded by the 28 - 2N / 29 - 2N rule (SHADER-291) that the PR keeps and that matches assign_f16_half_locations in tools/rdna2spirv.py, (b) the stale "a PS whose decoded-half location collides is rejected (Unsupported)" sentence, superseded by the dynamic packing text that stays, (c) the duplicate "fewer than 31 output locations" Unverified items (the 124-components one stays), (d) the duplicated SHADER-378 paragraph, which had a broken mid-sentence splice ("2· ... | F | <= 29 - max"); the kept copy has the correct escaped 2·|F|. All other Unverified items are still listed once (producer with too many params, MoltenVK validation run, MeshEXT, 124 components, geometry shader note). No issues found.

@tupacfan04

Copy link
Copy Markdown
Contributor

APPROVE. One line at docs/design.md:431, 8,031 -> 5,960 chars.

Claim-level diff: the only token lost is 31 (31 locations = 124 components, same bound). The new wording matches the code: tools/rdna2spirv.py:98 F16_HALF_TOP=29, :111-113 29-2n-1+h, :116-137 packs, and Unsupported only when the free range in 0..29 is < 2*len. The SHADER-378 sentence appears once, the pipe is escaped, and the row has the same three structural pipes as its neighbours.

Docs tests 30 passed, but main also gives 30, so test_docs_design_rows.py is a non-discriminating control here (it only checks duplicate first cells and cell shape). compileall and diff-check clean. Pre-existing, not this PR: the row says > 30 location budget overflows while the code's budget is 0..29.

Approve. AI-assisted review, docs only.

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.

4 participants