Skip to content

rdna2spirv: decode scalar, image and buffer tuples that run into vcc from blob (OLD-10062) - #744

Closed
abnalstlll-byte wants to merge 1 commit into
ProjectLeonida:mainfrom
abnalstlll-byte:restore/old-10062-vcc-tuples
Closed

abnalstlll-byte wants to merge 1 commit into
ProjectLeonida:mainfrom
abnalstlll-byte:restore/old-10062-vcc-tuples

Conversation

@abnalstlll-byte

Copy link
Copy Markdown
Contributor

Summary

Restores and updates work from draft PR #327 (old-pr/10062 / item OLD-10062).
Original commit by @tedin7 (063f14dcd9).

llvm-mc skips the first word of s_buffer_load_dwordx8 into s[100:107], an image resource in s[100:107] or a buffer resource in s[104:107] and leaves the second word as junk, so translate() refused those shaders ("reachable instruction with normalized encoding" or "fall-through into undecodable words") or translated them without the load.

restore_vcc_tuples reads the uncovered words of the code range with rdna2_decode and keeps only instructions whose operands hold a VCCTuple list, the form the translator already takes. Other undecodable words remain unchanged and properly rejected.

Verification

  • python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/semantic/test_vcc_tuple_fallback.py docs/shader_library.md -> Clean (no game data)
  • python -m unittest discover -s tests/semantic -p test_vcc_tuple_fallback.py -> 4/4 PASS in 0.22s
  • Clean rebase onto latest ubi/main (21625bca8).

AI-assisted verification and rebase by Antigravity (Autonomous Direct Mode).

… vcc from the blob when llvm-mc rejects them

llvm-mc skips the first word of s_buffer_load_dwordx8 into s[100:107], an image resource in s[100:107] or a buffer resource in s[104:107] and leaves the second word as junk, so translate() refused those shaders (reachable instruction with normalized encoding) or translated them without the load. restore_vcc_tuples reads the uncovered words of the code range with rdna2_decode and keeps only instructions whose operands hold a VCCTuple list, the form the translator already takes. Other undecodable words are unchanged.
@GeorgiyDemo

Copy link
Copy Markdown
Contributor

Tested a0c9e956d on Apple M5 Pro, macOS 26.7.3 (25G342), Python 3.15.2, against main d42773d07:

  • tests/semantic/test_vcc_tuple_fallback.py: 4 tests OK at this head.
  • The same file against main's translator gives 9 errors, not assertion failures: main raises inside translate (tools/rdna2spirv.py:17262, reachable_code) while translating these listings, so the new fallback is what makes them translatable at all.

No GPU leg: this is a decode-level fallback for tuples llvm-mc truncates; no runtime/test/shaders fixture exercises it, and I did not run the suite on this head. AI-assisted; synthetic fixtures only, no game data.

@ubiquitarianism

Copy link
Copy Markdown
Collaborator

Closing: duplicates #596 (opened earlier) and conflicts with #674.

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