Skip to content

docs: pin the 8/16-bit global store and d16 load row to measured gfx1100 - #4161

Closed
bobcatchris wants to merge 3 commits into
ItsNotRexed:mainfrom
bobcatchris:docs/subdword-global-hw2
Closed

bobcatchris wants to merge 3 commits into
ItsNotRexed:mainfrom
bobcatchris:docs/subdword-global-hw2

Conversation

@bobcatchris

Copy link
Copy Markdown
Contributor

Row 8/16-bit global stores and d16 loads was CPU-checked only (not GPU-verified).

Measured natively on an RX 7900 XTX (gfx1100, driver 26.10.1) through tools/hw_oracle, 16 cases, using the oracle's own output buffer as the scratch memory: each kernel seeds four dwords, runs one op, and the runner reads six dwords back (a load's vdst is parked at offset 16). The expected words are the documented rule written out by hand, not the translator's output.

All 16 match:

  • global_store_b8 writes only the low byte of the data VGPR (0x1234ffab stores 0xab) and global_store_b16 only the low half; the rest of the buffer is untouched.
  • global_store_d16_hi_b16 stores the data VGPR's high half (0x12340000 at offset 0 turns 0x11223344 into 0x11221234; 0x5678ffff at offset 2 gives 0x56783344, so the low half is ignored).
  • A 16-bit store at offset 3 splits across the dword boundary exactly: 0x11223344/0x55667788 become 0xfe223344/0x556677ca.
  • global_load_ubyte_d16 / _sbyte_d16 fill the low 16 bits of vdst and keep the other half: from a 0xbeef0000 vdst, byte 0x85 gives 0xbeefff85 (sign-extended to 16 bits) and 0x7f gives 0xbeef007f; from 0xbeffffff, byte 0x00 gives 0xbeff0000.
  • global_load_short_d16 / _hi fill the low/high 16 bits and keep the rest (0xbeef1122, 0x1122beef), and both crossing loads at offset 3 are exact (0xbeef8811, and 0x8811 into the high half with the low half kept).

Three of my first-pass expectations were wrong about byte order and about which half of vdst survives; the hardware corrected them, and the numbers above are the measured ones. Not measured here: an inactive lane and lane merging inside one dword (this probe runs one lane).

Docs-only: one row of docs/design.md (1 insertion, 1 deletion). tests/test_docs_design_rows.py, test_docs_links.py, test_docs_list_items.py, test_docs_repo_paths.py, test_docs_table_rows.py: 14 passed. No game data, synthetic operands only. AI-assisted.

@sds-228 sds-228 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.

Code review of 7260590: no issues found. The unverified note is replaced by a consistent measured paragraph with no table or encoding damage.

AI-assisted (OpenCode).

@memorypressure

Copy link
Copy Markdown

Reviewed on Linux: docs-only hardware pin — the row moves to the gfx1100 measurement consistently with the other hw_oracle-pinned rows, tools/hw_oracle is present in the tree, and the case counts and bit patterns are internally consistent with the model the row already documented. The native measurements stand on the author's bench (no AMD hardware on this side). AI-assisted: yes.

…1100

16 cases on gfx1100 use the output buffer as scratch memory: byte and short stores change only the addressed
bytes, the d16_hi forms take the data VGPR's high half, both dword-crossing accesses are exact, and the d16
loads fill one half of vdst and keep the other, with ubyte zero-extending and sbyte sign-extending.
@kapitche

Copy link
Copy Markdown
Contributor

Tested 6b5fc7f merged with main 98fa503 on Linux (WSL2), Python 3.12.16: pass, one concern

  • tests/test_docs_*.py: 10/10 OK. Docs-only change (one table row in docs/design.md), so there is no negative control.
  • Verified: the new text leaves **Not GPU-verified.** in front of the new "Hardware-measured natively on gfx1100**" sentence, which contradicts it, and there is a stray unmatched ** after gfx1100 so the bold markup is unbalanced. The 16 cases (7 stores + 9 d16 loads) add up.
  • rdna2spirv: sub-dword global stores take VDATA first, with a GPU fixture #4160 rewrites the same table row (different text), so whichever lands second needs a rebase.

@bobcatchris

Copy link
Copy Markdown
Contributor Author

@kapitche fixed at acf06739: the stale **Not GPU-verified.** is gone and the sentence now opens **Hardware-measured natively on gfx1100**, so the bold is balanced. All 10 tests/test_docs_*.py pass.

AI-assisted.

@abilliontokens

Copy link
Copy Markdown
Contributor

Code read of acf06739 on Windows 11 (26200), Python 3.12.10: one wording defect; the rest checks out. AI-assisted (omp orchestrator). No GPU run: this is a gfx1100 measurement and I have no gfx1100.

  • Merged onto main d974c88a5 (clean): python -I tests/test_docs_links.py, test_docs_design_rows.py, test_docs_table_rows.py, test_design_contract_rows.py, test_docs_list_items.py and test_docs_repo_paths.py all OK. tools/hw_oracle/ and tests/semantic/test_global_sub_dword.py exist.
  • I redid the row's example words by hand from little-endian byte layout, and they are consistent:
    • 0xbeef at offset 2 of 0x11223344 gives 0xbeef3344;
    • _d16_hi of 0x12340000 at offset 0 gives 0x11221234;
    • the offset-3 split store gives 0xfe223344 / 0x556677ca;
    • the offset-3 loads from 0x11223344 / 0x55667788 give 0xbeef8811 / 0x88110000.

Defect, docs/design.md, "8/16-bit global stores and d16 loads" row (the gfx1100 sentence). It says "ubyte/sbyte d16 loads fill the low 16 bits of vdst and keep the other half (0x85 gives 0xbeefff85 from a 0xbeef0000 vdst, 0x7f gives 0xbeef007f)". 0xff85 is the sign extension, so that example is sbyte only. The same row says "ubyte zero-extends", and for ubyte the byte 0x85 gives 0xbeef0085. Read as written, the example covers both ops and contradicts that rule. Your description says the same thing ("0x85 gives 0xbeefff85 (sign-extended to 16 bits)").

Suggested fix: name the op in the example, "sbyte: 0x85 gives 0xbeefff85". Add the ubyte word for 0x85 if one of the 16 cases measured it; if none did, add "ubyte measured with 0x7f/0x00 only".

@bobcatchris

Copy link
Copy Markdown
Contributor Author

@abilliontokens fixed at c2b78a31: the example now names sbyte for 0x85 → 0xbeefff85, keeps 0x7f → 0xbeef007f, and says no measured word distinguishes ubyte from sbyte. test_docs_design_rows.py, test_docs_table_rows.py and test_docs_links.py all OK.

AI-assisted.

@kapitche

Copy link
Copy Markdown
Contributor

Re-check of my earlier comment #4161 (comment) (tested 6b5fc7f).

Tested c2b78a3 merged with main 3faac55 on Linux (WSL2), Python 3.12.16: pass

  • tests/test_docs_*.py (10 files) and test_design_contract_rows.py: 11/11 OK. Docs-only (one table row), so no negative control.
  • Resolved: **Not GPU-verified.** is gone from the row, and the row now has 2 ** (balanced). The merge with current main is clean.
  • The ubyte/sbyte example now names sbyte for 0x85 -> 0xbeefff85 and says no measured word distinguishes the two, which removes the contradiction with "ubyte zero-extends". Case count is still 7 stores + 9 d16 loads = 16. The gfx1100 numbers themselves were not re-measured here (no gfx1100).

@kapitche

Copy link
Copy Markdown
Contributor

Tested c2b78a3 merged with main 3faac55 on Linux (WSL2), Python 3.12.16: pass.
Docs-only change, so no PR tests; ran tests/test_docs_*.py (10 files, all OK) on the merged tree. Negative control not applicable (no code or tests in the diff). Also ran tests/semantic/test_global_sub_dword.py (12 OK), the nearest CPU test for the row.
The 16 hw_oracle gfx1100 cases are not reproducible here and were taken as stated; the row keeps "Not measured: an inactive lane".

@bobcatchris

Copy link
Copy Markdown
Contributor Author

Closing as superseded. origin/main at 1cc6e3c1 already carries the native gfx1100 (RX 7900 XTX, driver 26.10.1, tools/hw_oracle, 16 cases) measurement for the 8/16-bit global stores and d16 loads: b8/b16 touching only the addressed bytes, _d16_hi stores taking the data VGPR's high half, the byte-3 split across dwords, the zero/sign-extended ubyte/sbyte d16 loads keeping the other half, and both dword-crossing loads at offset 3.

That row has been edited since my base, so re-anchoring my copy would drop the newer text for a cosmetic dedupe. Nothing to merge. 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.

5 participants