Skip to content

rdna2spirv: VCCTuple scalar lists, src_scc, and image_atomic a16 (FSPX) - #2000

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
SweatierKey:fspx-translator-rules
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
SweatierKey:fspx-translator-rules

Conversation

@SweatierKey

Copy link
Copy Markdown
Contributor

Follow-up to #1754 / docs/fspx.md unblocking 8 more FidelityFX FSR4 (FSPX) compute shaders (claim: #1902 (comment)).

Changes

  • LLVM VCCTuple scalar register lists (tools/shader_ir.py, tools/lane_masks.py, tools/shader_meta.py, tools/rdna2spirv.py):
    • Parse bracketed scalar register lists ending in vcc_lo,vcc_hi (matching LLVM SIRegisterInfo.td VCCTuple, e.g. [s100,s101,s102,s103,s104,s105,vcc_lo,vcc_hi] and [s92,...,s105,vcc_lo,vcc_hi], with or without spaces) as slist operands in shader_ir.py.
    • Clear both SGPR slots and vcc from lane-mask tracking in lane_masks.put(), and track SGPR members in shader_meta._sgpr_regs().
    • Support slist destinations and bases in s_load_dword* / s_buffer_load_dword*, plus slist descriptors in desc_lookup_sgpr, sgpr_words/sgpr_word (T#/S#), buffer_address (V#), and global_address (saddr), routing sN to %sgpr and vcc_lo/vcc_hi to %vcc/%vcc_hi. Unblocks 6 FSPX shaders.
  • src_scc source operand (tools/rdna2spirv.py, Gen.src_u): read %scc (0 or 1, RDNA2 inline constant 253) the same as scc. Unblocks 1 FSPX shader.
  • image_atomic_* / image_atomic_cmpswap with a16 (tools/rdna2spirv.py, Gen.image_misc): unpack 16-bit unsigned packed coordinates (two per VGPR, low half first, matching image_store) for both 2D and 3D storage-image atomics. Unblocks 1 FSPX shader.
  • Tests & docs: added tests/semantic/test_fspx_rules.py and updated docs/design.md.

Testing (CPU / synthetic only, no game files, no GPU)

  • python3 -m compileall -q make_game.py tools tests: OK
  • tests/semantic/test_fspx_rules.py: 9/9 OK (shader_ir parsing, lane_masks/shader_meta, s_buffer_load_dwordx8/x16 into VCCTuple, slist V#/T#, src_scc, 2D/3D image_atomic_add ... a16)
  • tests/semantic/test_scalar_mem_smem.py (39/39), tests/test_shader_ir.py (35/35), tests/test_lane_masks.py, tests/test_shader_meta.py (15/15), tests/test_docs_links.py (5/5): all OK
  • spirv-as --target-env vulkan1.2 + spirv-val --target-env vulkan1.2 --allow-offset-texture-operand (SPIRV-Tools v2025.5): all 6 synthetic fixtures pass (including --wave64-emulate).

AI-assisted.

@tylerstraub

Copy link
Copy Markdown
Contributor

Tested bda17759e412a1154f330e12a633a51c79380bbf on NVIDIA GeForce RTX 5090, 595.99.02 (Linux).

Independent Vulkan check of bda17759e412a1154f330e12a633a51c79380bbf on NVIDIA GeForce RTX 5090 (driver 595.99.02, Linux 7.0.0-43-generic, LLVM 21.1.8, SPIRV-Tools v2026.1). AI-assisted. Synthetic input only.

I built a wave32 compute fixture based on the PR's src_scc semantic case. It sets SCC to 1, uses it in a vector add, copies it with s_mov_b32, then uses it in a scalar add that clears SCC through the carry result. A second vector add reads the cleared SCC. LLVM assembly, translation and SPIR-V validation passed. The RTX 5090 read back 21 20 1 11, and all 60 sentinel words stayed intact.

All nine test_fspx_rules.py CPU tests passed. The GPU result covers src_scc; the register-tuple and packed image-atomic changes received CPU coverage in this run.

AI-assisted verification.

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