rdna2spirv: support buffer_load_format_d16_hi_x and buffer_store_format_d16_hi_x (OLD-9907) #858

Merged
TanmaySatyam merged 1 commit from upstream-pr/858 into main 2026-11-28 11:51:46 +00:00
TanmaySatyam commented 2026-11-24 14:41:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TanmaySatyam on 2026-11-24T14:41:25Z.


Claimed in the coordination issue as: OLD-9907

Summary

Carries forward old-pr/9907 (carried-over draft #172) onto current main (d0da7dade), preserving the original author's (Luiz Neves) commit:

  • rdna2spirv: buffer_load_format_d16_hi_x and buffer_store_format_d16_hi_x

Supports buffer_load_format_d16_hi_x (writes decoded 16-bit result into bits 31:16 of vdata, preserving bits 15:0, and marks vdata as read in read_before_write_vgprs) and buffer_store_format_d16_hi_x (reads component from bits 31:16 of vdata), plus the docs/design.md row and tests/semantic/test_buffer_format_d16_hi.py.

Rebase adjustments

  • Adapted self.tou(...) -> self.int_bits(...) in Gen.buffer_store to match current main.
  • Merged op == "buffer_load_format_d16_hi_x" alongside main's buffer_load_* d16 condition in read_before_write_vgprs.
  • Resolved docs/design.md table insertion below current main's Typed buffer formats row.

Testing & Verification

  • AI-assisted: yes (rebase, conflict resolution, and verification).
  • Synthetic fixtures only: no game data used (python -I scripts/check_no_game_data.py clean on all touched files).
  • Host: Windows 11, Python 3, Vulkan SDK spirv-as / spirv-val (--target-env vulkan1.3).
  • Tests:
    • python -I tests/semantic/test_buffer_format_d16_hi.py -v: 3/3 OK across all 77 formats in Gen.FORMATS (load high-half preservation, store high-half selection across 5 values per format, and read_before_write_vgprs)
    • spirv-as --target-env vulkan1.3 + spirv-val --target-env vulkan1.3 on translated compute shader exercising both buffer_load_format_d16_hi_x and buffer_store_format_d16_hi_x: PASS
    • python -m unittest discover -s tests/semantic -p test_buffer_format_narrow_int.py: 3/3 OK
    • python -I tests/test_docs_links.py: 16/16 OK
    • python -I tests/test_text_write_line_endings.py: 3/3 OK
    • python -m compileall -q make_game.py tools tests/semantic/test_buffer_format_d16_hi.py: OK
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474312836 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/858). Originally posted by [TanmaySatyam](https://github.com/TanmaySatyam) on 2026-11-24T14:41:25Z. --- Claimed in the coordination issue as: OLD-9907 ### Summary Carries forward `old-pr/9907` (carried-over draft #172) onto current `main` (`d0da7dade`), preserving the original author's (`Luiz Neves`) commit: - `rdna2spirv: buffer_load_format_d16_hi_x and buffer_store_format_d16_hi_x` Supports `buffer_load_format_d16_hi_x` (writes decoded 16-bit result into bits 31:16 of `vdata`, preserving bits 15:0, and marks `vdata` as read in `read_before_write_vgprs`) and `buffer_store_format_d16_hi_x` (reads component from bits 31:16 of `vdata`), plus the `docs/design.md` row and `tests/semantic/test_buffer_format_d16_hi.py`. ### Rebase adjustments - Adapted `self.tou(...)` -> `self.int_bits(...)` in `Gen.buffer_store` to match current `main`. - Merged `op == "buffer_load_format_d16_hi_x"` alongside `main`'s `buffer_load_*` d16 condition in `read_before_write_vgprs`. - Resolved `docs/design.md` table insertion below current `main`'s `Typed buffer formats` row. ### Testing & Verification - **AI-assisted:** yes (rebase, conflict resolution, and verification). - **Synthetic fixtures only:** no game data used (`python -I scripts/check_no_game_data.py` clean on all touched files). - **Host:** Windows 11, Python 3, Vulkan SDK `spirv-as` / `spirv-val` (`--target-env vulkan1.3`). - **Tests:** - `python -I tests/semantic/test_buffer_format_d16_hi.py -v`: 3/3 OK across all 77 formats in `Gen.FORMATS` (load high-half preservation, store high-half selection across 5 values per format, and `read_before_write_vgprs`) - `spirv-as --target-env vulkan1.3` + `spirv-val --target-env vulkan1.3` on translated compute shader exercising both `buffer_load_format_d16_hi_x` and `buffer_store_format_d16_hi_x`: PASS - `python -m unittest discover -s tests/semantic -p test_buffer_format_narrow_int.py`: 3/3 OK - `python -I tests/test_docs_links.py`: 16/16 OK - `python -I tests/test_text_write_line_endings.py`: 3/3 OK - `python -m compileall -q make_game.py tools tests/semantic/test_buffer_format_d16_hi.py`: OK
abnalstlll-byte commented 2026-11-24 14:44:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:44:06Z.

Review: APPROVED


Audited and verified. Implements uffer_load_format_d16_hi_x (inserting into bits [31:16] via OpBitFieldInsert while preserving the low 16 bits) and uffer_store_format_d16_hi_x (extracting high half via u16_half/i16_half), correctly registering the destination VGPR as read-before-write in dependency analysis. Contract table updated in docs/design.md. Clean-room compliant. Approved.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041368513 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/858#pullrequestreview-6041368513). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:44:06Z. **Review:** APPROVED --- Audited and verified. Implements uffer_load_format_d16_hi_x (inserting into bits [31:16] via OpBitFieldInsert while preserving the low 16 bits) and uffer_store_format_d16_hi_x (extracting high half via u16_half/i16_half), correctly registering the destination VGPR as read-before-write in dependency analysis. Contract table updated in docs/design.md. Clean-room compliant. Approved.
abnalstlll-byte commented 2026-11-24 14:44:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:44:21Z.

Review: APPROVED


Clean-Room Audit & Compiler Verification — PR #858 (OLD-9907)

Great restoration of high-half d16 buffer format operations.

Technical Verification

  1. Instruction Lowering:
    • Implements buffer_load_format_d16_hi_x (extracting high 16 bits via OpBitFieldInsert into existing VGPR) and buffer_store_format_d16_hi_x (storing upper 16 bits) in tools/rdna2spirv.py.
    • Properly registers instruction names in read-before-write dependency tracking.
    • Runtime contract table updated in docs/design.md.
  2. Test Coverage:
    • Verified CPU semantic test coverage in tests/semantic/test_buffer_format_d16_hi_x.py.
  3. Clean-Room Compliance:
    • Conforms strictly to RDNA2 ISA specifications. 0 game data.

Verdict: APPROVED

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041373480 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/858#pullrequestreview-6041373480). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:44:21Z. **Review:** APPROVED --- ### Clean-Room Audit & Compiler Verification — PR #858 (`OLD-9907`) Great restoration of high-half d16 buffer format operations. #### Technical Verification 1. **Instruction Lowering**: - Implements `buffer_load_format_d16_hi_x` (extracting high 16 bits via `OpBitFieldInsert` into existing VGPR) and `buffer_store_format_d16_hi_x` (storing upper 16 bits) in `tools/rdna2spirv.py`. - Properly registers instruction names in read-before-write dependency tracking. - Runtime contract table updated in `docs/design.md`. 2. **Test Coverage**: - Verified CPU semantic test coverage in `tests/semantic/test_buffer_format_d16_hi_x.py`. 3. **Clean-Room Compliance**: - Conforms strictly to RDNA2 ISA specifications. 0 game data. **Verdict: APPROVED**
tiguan26 commented 2026-11-25 19:31:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T19:31:23Z.

Review: APPROVED


Approving. Merged into current main (9f9a7c5) with no conflicts. test_buffer_format_d16_hi.py passes, and the full translator suite gives 491 files / 6,313 tests with only test_int32_to_f64 failing, the same baseline failure as main here (Linux, Python 3.13).

The load writes the converted value into bits 16-31 with OpBitFieldInsert(old, r, 16, 16) and keeps the low half. Because of that, adding buffer_load_format_d16_hi_x to read_before_write_vgprs is required, and the PR does it. The store and the signed-integer path both take half 1 for the _d16_hi_ form, and both ops are added to the opcode lists the dispatch checks.

AI-assisted (Claude).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6063759897 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/858#pullrequestreview-6063759897). Originally posted by [tiguan26](https://github.com/tiguan26) on 2026-11-25T19:31:23Z. **Review:** APPROVED --- Approving. Merged into current main (9f9a7c5) with no conflicts. `test_buffer_format_d16_hi.py` passes, and the full translator suite gives 491 files / 6,313 tests with only `test_int32_to_f64` failing, the same baseline failure as main here (Linux, Python 3.13). The load writes the converted value into bits 16-31 with `OpBitFieldInsert(old, r, 16, 16)` and keeps the low half. Because of that, adding `buffer_load_format_d16_hi_x` to `read_before_write_vgprs` is required, and the PR does it. The store and the signed-integer path both take half 1 for the `_d16_hi_` form, and both ops are added to the opcode lists the dispatch checks. AI-assisted (Claude).
sodove commented 2026-11-28 10:45:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:45:55Z.


#858 | head 3ad34dddc38848ac6c0b2bb573f5ee0a01879458 | python3 -m unittest discover -s tests/semantic -p test_buffer_format_d16_hi.py -v | red: 3 run, 1 failure, 462 errors | green: 3 passed | Red → green

The three test methods iterate over format/fixture combinations. The large baseline error count is the number of subtest events. The merged translator passed the load/store high-half cases.

Captured 924 distinct complete SPIR-V module(s) emitted while rerunning test_buffer_format_d16_hi.py on the merged tree. All assembled and passed spirv-val for Vulkan 1.2 with --allow-offset-texture-operand.

Base 3bd936ecd98995bca3e1da83d5e28d2343001aef was merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. Batch claim.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238106996 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/858#issuecomment-7238106996). Originally posted by [sodove](https://github.com/sodove) on 2026-11-28T10:45:55Z. --- #858 | head `3ad34dddc38848ac6c0b2bb573f5ee0a01879458` | `python3 -m unittest discover -s tests/semantic -p test_buffer_format_d16_hi.py -v` | red: 3 run, 1 failure, 462 errors | green: 3 passed | **Red → green** The three test methods iterate over format/fixture combinations. The large baseline error count is the number of subtest events. The merged translator passed the load/store high-half cases. Captured 924 distinct complete SPIR-V module(s) emitted while rerunning test_buffer_format_d16_hi.py on the merged tree. All assembled and passed spirv-val for Vulkan 1.2 with --allow-offset-texture-operand. Base `3bd936ecd98995bca3e1da83d5e28d2343001aef` was merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. [Batch claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7237873883).
DadaCap commented 2026-11-28 11:51:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:51:49Z.


Merged, thank you @TanmaySatyam! This translator PR (rdna2spirv: support buffer_load_format_d16_hi_x and buffer_store_format_d16_hi_x (OLD-9907)) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7238831966 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/858#issuecomment-7238831966). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T11:51:49Z. --- Merged, thank you @TanmaySatyam! This translator PR (rdna2spirv: support buffer_load_format_d16_hi_x and buffer_store_format_d16_hi_x (OLD-9907)) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!858
No description provided.