[integration] RT-PALMETTO-PARITY: #984 story-load boot on current main, plus the pipeline-library translator fixes #1495

Closed
github-bot wants to merge 31 commits from gh-pr/1495/head into gh-pr/1495/base
Owner

@⁠ubiquitarianism on GitHub · 2026-11-25 01:56 UTC · original
ubiquitarianism:integration/palmetto-parity → main · +37958 −2463 · 298 files · 30 commits · closed without merging

Claimed in the coordination issue as: RT-PALMETTO-PARITY (#14)

Depends on: #984, #674, #593, #583, #1281, #1317, #998

What this is

This is one branch that moves the retail boot forward on current main. It is the furthest-along boot integration open here (#984), merged onto main with its conflicts resolved, plus the open translator decode fixes that the title's pipeline-library compute programs need. Each merged PR keeps its own commits and author.

The claim also named a port of measurement notes and a boot-report tool. Those are left out: they do not move the boot.

1. #984 (RT-PROTON-STORY-LOAD, Moriz82), merged onto current main

#984 boots the package through:

  • the launch movie;
  • the first-run pages;
  • the landing prompt;
  • the story load, to its end.

It conflicted with main in 41 files, because main has since merged reviewed versions of many slots it carried (#391, #727, #383, #385, #377, #375). In each conflict I kept main's version and added only what #984 brings on top.

Decisions to check in review:

  • Slots and present routing in d3d12_xs_device.cpp, kept from main:

    • Slot 81 stays GetFrameStatisticsX with the presenter, and the presenter routing still runs before #984's built-in PresentX.
    • Slots 25, 26, 108 and 127 follow main.
    • Slot 127 gets #984's null-heap check, but not its tight-alignment flag.
    • Slots 61 and 74 keep main's check on who is calling.
    • Slot 73 answers the console list IID as ID3D12GraphicsCommandList, so #984's d3d12_xs_command_list_iid.h is dropped.
  • Taken from #984 in d3d12_xs_device.cpp: the console list proxy, queue layout detection, the slot 9 allocator callback, slots 55, 57, 70, 71, 86 and 133, Vulkan-backed CPU heaps and the frame token source.

  • d3d12_vulkan_device.cpp: #984's staged and deferred title images, inside main's create_image and its NVIDIA host-transfer retry.

  • file_system.cpp / dstorage.cpp: #984's kernel_writes reads, with main's touch_pages retry as the fallback.

  • rdna2_decode.py: main's version is kept, because #984's f32-only DPP block ran first and broke main's decode.

  • Hard-coded game addresses: three #984 code paths now read the location from an environment variable and are off when it is unset:

    • the hang-watchdog kick reads LEONIDA_TITLE_WATCHDOG_KICK;
    • the transient-pool dump reads LEONIDA_POOL_DIAG_AT;
    • the boot script reads LEONIDA_GAME_STATE_RVA and LEONIDA_SESSION_STATE_RVA.

    This changes #984's behaviour: on an unconfigured machine the title's hang watchdog stays armed.

  • Docs and scripts: executable addresses and offsets are removed from #984's doc and script text.

2. Translator fixes for the pipeline-library programs

Merged, each with its author kept: #674, #593, #583, #1281 (resolved against #583), #1317 and #998 (resolved against main, #583 and #593).

Not merged:

Where #984 and these PRs implement the same rule, one implementation is kept:

  • Skipped words: restore_vcc_tuples (#674) is the one restore pass, because it follows only reachable code and protects branch targets. #984's restore_skipped_instructions is removed. #984's two extra forms (DPP f32 compares, and the dot4 op_sel 2 / op_sel_hi 5 word) are accepted inside restore_vcc_tuples.
  • dot4 fields: a v_dot4_i32_i8 that llvm-mc prints with default op_sel now takes op_sel/op_sel_hi from the stored words, but only when those two fields are the whole difference. This replaces #984's single-case restore_dot4_inline_sel. It has a sentence in the design.md contract table and a hand-built test (test_dot4_printed_op_sel.py). The approach comes from luizwidmer/palmetto (GPL-3.0).
  • VCC in wave32: #984's wave64-only rule is kept for a VCC destination of s_bitreplicate_b64_b32 and for s_flbit_i32_b64 of a lane mask, because in wave32 vcc_hi holds data. #593's wave32 VCC test now expects a refusal.
  • Lane-mask source into scalar data (#998): the s_bitreplicate_b64_b32 rule now has a semantic test and a contract-table sentence. It is checked by the CPU interpreter only.
  • Changed tests: two cases in tests/test_rdna2spirv_decode.py used the dot4 word as their "undecodable" input. That word now decodes, so they use the same word with clamp set, which is still refused.

Not included, because they are claimed in #14

Each has a finding: there for its owner:

  • slot-57 record to graphics PSO (RT-SLOT57-NATIVE-GRAPHICS-PSO)
  • rebasing title VAs into the arena (RT-TITLE-RESERVATION-ARENA / RT-TITLE-HOST-REGION)
  • crash unwinding (RT-CRASH-STACK, #994)
  • the startup-trace additions (RT-STARTUP-TRACE)

Tested

Windows 11, VS 2026. There is no retail run with this branch, because no game package is on the test machine.

  • compileall and make_game.py --help pass.
  • Runtime build: builds clean. There is no Vulkan SDK on the machine, so it was configured with -DLEONIDA_VULKAN_HEADERS_FETCH=ON.
  • ctest: 305 passed, 2 failed, the rest skipped (game files, validation layers) or disabled. The failures are d3d12_texture_tiles and d3d12_clear, and both fail the same way on plain main. xmem_no_write_watch failed once under -j 8 in an earlier run, then passed when run alone and in a serial run.
  • Translator suite (run_semantic_tests.py): 486 files, 6,292 tests, 0 failed, in 423 s on 12 jobs.
  • Other tests: test_shader_library.py, test_fspx_unpack.py, test_shader_disasm.py and test_rdna2spirv_decode.py pass.
  • python -I scripts/check_no_game_data.py is clean on every file #984 adds.
  • Not measured: translated and spirv-val counts over the corpus, because there is no work folder on the test machine.
**@⁠ubiquitarianism** on GitHub · 2026-11-25 01:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1495) `ubiquitarianism:integration/palmetto-parity` → `main` · +37958 −2463 · 298 files · 30 commits · closed without merging Claimed in the coordination issue as: RT-PALMETTO-PARITY (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) Depends on: #984, #674, #593, #583, #1281, #1317, #998 ## What this is This is one branch that moves the retail boot forward on current `main`. It is the furthest-along boot integration open here (#984), merged onto `main` with its conflicts resolved, plus the open translator decode fixes that the title's pipeline-library compute programs need. Each merged PR keeps its own commits and author. The claim also named a port of measurement notes and a boot-report tool. Those are left out: they do not move the boot. ### 1. #984 (RT-PROTON-STORY-LOAD, Moriz82), merged onto current `main` #984 boots the package through: - the launch movie; - the first-run pages; - the landing prompt; - the story load, to its end. It conflicted with `main` in 41 files, because `main` has since merged reviewed versions of many slots it carried (#391, #727, #383, #385, #377, #375). In each conflict I kept `main`'s version and added only what #984 brings on top. Decisions to check in review: - **Slots and present routing in `d3d12_xs_device.cpp`, kept from `main`:** - Slot 81 stays `GetFrameStatisticsX` with the presenter, and the presenter routing still runs before #984's built-in PresentX. - Slots 25, 26, 108 and 127 follow `main`. - Slot 127 gets #984's null-heap check, but not its tight-alignment flag. - Slots 61 and 74 keep `main`'s check on who is calling. - Slot 73 answers the console list IID as `ID3D12GraphicsCommandList`, so #984's `d3d12_xs_command_list_iid.h` is dropped. - **Taken from #984 in `d3d12_xs_device.cpp`:** the console list proxy, queue layout detection, the slot 9 allocator callback, slots 55, 57, 70, 71, 86 and 133, Vulkan-backed CPU heaps and the frame token source. - **`d3d12_vulkan_device.cpp`:** #984's staged and deferred title images, inside `main`'s `create_image` and its NVIDIA host-transfer retry. - **`file_system.cpp` / `dstorage.cpp`:** #984's `kernel_writes` reads, with `main`'s `touch_pages` retry as the fallback. - **`rdna2_decode.py`:** `main`'s version is kept, because #984's f32-only DPP block ran first and broke `main`'s decode. - **Hard-coded game addresses:** three #984 code paths now read the location from an environment variable and are off when it is unset: - the hang-watchdog kick reads `LEONIDA_TITLE_WATCHDOG_KICK`; - the transient-pool dump reads `LEONIDA_POOL_DIAG_AT`; - the boot script reads `LEONIDA_GAME_STATE_RVA` and `LEONIDA_SESSION_STATE_RVA`. **This changes #984's behaviour:** on an unconfigured machine the title's hang watchdog stays armed. - **Docs and scripts:** executable addresses and offsets are removed from #984's doc and script text. ### 2. Translator fixes for the pipeline-library programs Merged, each with its author kept: #674, #593, #583, #1281 (resolved against #583), #1317 and #998 (resolved against `main`, #583 and #593). Not merged: - #596: all of its commits are inside #674. - #281: it is the same fix as #1317. Where #984 and these PRs implement the same rule, one implementation is kept: - **Skipped words:** `restore_vcc_tuples` (#674) is the one restore pass, because it follows only reachable code and protects branch targets. #984's `restore_skipped_instructions` is removed. #984's two extra forms (DPP f32 compares, and the dot4 op_sel 2 / op_sel_hi 5 word) are accepted inside `restore_vcc_tuples`. - **dot4 fields:** a `v_dot4_i32_i8` that llvm-mc prints with default op_sel now takes op_sel/op_sel_hi from the stored words, but only when those two fields are the whole difference. This replaces #984's single-case `restore_dot4_inline_sel`. It has a sentence in the design.md contract table and a hand-built test (`test_dot4_printed_op_sel.py`). The approach comes from luizwidmer/palmetto (GPL-3.0). - **VCC in wave32:** #984's wave64-only rule is kept for a VCC destination of `s_bitreplicate_b64_b32` and for `s_flbit_i32_b64` of a lane mask, because in wave32 `vcc_hi` holds data. #593's wave32 VCC test now expects a refusal. - **Lane-mask source into scalar data (#998):** the `s_bitreplicate_b64_b32` rule now has a semantic test and a contract-table sentence. It is checked by the CPU interpreter only. - **Changed tests:** two cases in `tests/test_rdna2spirv_decode.py` used the dot4 word as their "undecodable" input. That word now decodes, so they use the same word with clamp set, which is still refused. ## Not included, because they are claimed in #14 Each has a `finding:` there for its owner: - slot-57 record to graphics PSO (RT-SLOT57-NATIVE-GRAPHICS-PSO) - rebasing title VAs into the arena (RT-TITLE-RESERVATION-ARENA / RT-TITLE-HOST-REGION) - crash unwinding (RT-CRASH-STACK, #994) - the startup-trace additions (RT-STARTUP-TRACE) ## Tested Windows 11, VS 2026. There is no retail run with this branch, because no game package is on the test machine. - `compileall` and `make_game.py --help` pass. - **Runtime build:** builds clean. There is no Vulkan SDK on the machine, so it was configured with `-DLEONIDA_VULKAN_HEADERS_FETCH=ON`. - **ctest:** 305 passed, 2 failed, the rest skipped (game files, validation layers) or disabled. The failures are `d3d12_texture_tiles` and `d3d12_clear`, and both fail the same way on plain `main`. `xmem_no_write_watch` failed once under `-j 8` in an earlier run, then passed when run alone and in a serial run. - **Translator suite** (`run_semantic_tests.py`): 486 files, 6,292 tests, 0 failed, in 423 s on 12 jobs. - **Other tests:** `test_shader_library.py`, `test_fspx_unpack.py`, `test_shader_disasm.py` and `test_rdna2spirv_decode.py` pass. - `python -I scripts/check_no_game_data.py` is clean on every file #984 adds. - **Not measured:** translated and `spirv-val` counts over the corpus, because there is no work folder on the test machine.
50 of the 2,684 library programs in shaders.rpf (1.0.2.1) start with two VOP3
opcode-0x180 words (words 0 and 3) instead of three, and their code starts at
word 6. code_range only knew the 36-byte form, so it disassembled them from
word 0 and they never decoded: 1 of the 50 translated. With the 24-byte form
all 50 disassemble with 0 invalid words and 49 translate and pass spirv-val.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- s_bitreplicate_b64_b32 with a VCC destination: lane L gets S0 bit L // 2,
  stored as mov64 stores a mask into VCC (EXEC already took this path).
- s_flbit_i32_b64 of a lane mask reads the wave's whole mask (wave_mask), as
  s_ff1_i32_b64 does; s_flbit_i32_i64 of a mask stays Unsupported.

Both occur in pipeline-library compute programs that the retail boot creates.
Tests: tests/semantic/test_lane_mask_bitreplicate_flbit.py runs both on every
lane of a wave64 (run_workgroup); docs/design.md contract rows updated.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Clamp blob[at:at + 20] to min(at + 20, stop) and check at + nbytes <= stop so multi-dword NSA MIMG instructions starting near code_end cannot read trailing bytes past code_end. Adds synthetic 12-byte NSA1 regression test.
llvm-mc rejects a scalar tuple that runs into vcc and prints the second word as
junk. That junk is often longer than the word, so it also covers the instruction
after the tuple, which stayed missing and refused the program with
'fall-through into undecodable words'. The words after a restored tuple are now
decoded from the blob until the stream is back at a printed instruction.

Pipeline library of 1.0.2.1, 2,684 compute programs: 1,816 -> 2,567 translate
and pass spirv-val; the 1,816 modules are byte-identical.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
llvm-mc 21 cannot decode SMEM loads whose SOFFSET is null (0x7D), so whole
pipeline-library compute programs of 1.0.2.1 came out with invalid words
and failed to translate. For compute programs, shader_disasm now falls back
to rdna2_decode when that decodes more of the program, and rdna2_decode
reads VOPC with DPP16/DPP8 as the 8-byte form it is.

rdna2spirv:
- SMEM with vcc as its base reads the vcc_lo/vcc_hi pair.
- s_flbit_i32_b64 of a lane mask reads the wave's 64-bit mask (18 library
  programs), as s_ff1_i32_b64 already does.
- s_bitreplicate_b64_b32 of a lane mask into plain scalar data replicates
  the wave's mask word (6 library programs); into exec/vcc it stays
  Unsupported.

test_salu_flbit_64: the lane-mask case now translates (the subgroup op is
outside the single-invocation interpreter), so the test checks that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The retail boot reached 50 pipeline-library compute programs that had no
translation. Dumped from the running game, they all translate and pass
spirv-val after these changes:

- fspx_unpack.code_range: some programs carry a 24-byte hash prologue
  (two VOP3 words, then s_inst_prefetch) instead of 36 bytes; two or three
  hash words now count (shader_library uses the same range).
- fspx_unpack --last-endpgm: early exits branch past the first s_endpgm,
  and data after the code can hold s_endpgm words, so a program ends at
  the first s_endpgm whose listing keeps every branch inside the code.
- rdna2spirv: v_cmp_*_dpp into vcc (12 compares in reductions), taken when
  every lane writes (full row/bank masks with bound_ctrl:1, or DPP8).
- rdna2spirv: s_bitreplicate_b64_b32 of a constant into vcc (6 programs),
  as the exec form does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.

Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.

Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.

Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.

No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.

Co-authored-by: Plaaasma <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Do not scan unreachable embedded data words skipped by s_branch or after s_endpgm / s_setpc_b64 in restore_vcc_tuples. Walk only offsets reachable from code_start via matched instructions, fall-through, and direct/folded far branches, and discard any restored instruction whose interior dwords are targeted by a reachable branch.

Fixes the synthetic edge case reported on #596 / #674 by @Snooozs where an unreachable data word equal to the first dword of an 8-byte vcc-tuple load right before a branch target caused restore_vcc_tuples to swallow the target instruction and fail with 'branch into data'.

Adds regression tests covering: skipped data word before a matched branch target, skipped data word before a vcc-tuple load at the branch target, data word after s_endpgm before a branch target, and fall-through into a data word directly before a branch target.
#596 walks only reachable offsets. The resync after a restored tuple now runs inside that walk, follows swallowed
branches, and drops the rest of a run when a branch targets an instruction's interior. decode_bytes gets the
program's wave size, so a swallowed VOP3 compare writes an SGPR pair in wave64 (reported on #674).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The run time finds a pipeline-library compute program by the SHA-256 of
its code and of its record's state blob. shader_library.py kept one
state per program, the last record's, so when two compute records used
one program with different state blobs only one of the two pairs got an
entry and a .state file.

Each distinct state of a program is now written: the first under the
program's name, each further one as <name>_state_<blob index>, with its
own .code, .json, .state, listing and index entry. library.json names
the entry of each record. A program with one state, the case of every
program in the measured 1.0.2.1 library, is written exactly as before.

--compute-hashes FILE writes only the compute programs whose code has
one of the SHA-256 digests listed in FILE, with every state they are
used with. It cannot be combined with --stages, and a digest no compute
program has is an error before anything is written.

tests/test_shader_library.py gets three tests on a synthetic library;
all three fail on the base. The standard-library tests and the
translator suite add no failing file. No retail library was read for
this change.

AI-assisted (Claude Code).

Co-authored-by: Plaaasma <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The FidelityFX upscaler programs hold 89 such words in 8 programs (docs/fspx.md); the translator already models the form but the listing could not carry it, so the programs were refused as a fall-through into undecodable words.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflict with #583 in tools/shader_library.py: kept #1281's per-state loop and #583's
prologue test (start > 0, so the 24-byte prologue counts too).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts resolved toward what main and #583/#593 already have: the 24-byte prologue
(#583's code_range), VOPC DPP decode and translation (main's 'DPP on a VOPC compare'),
s_bitreplicate_b64_b32 into VCC and s_flbit_i32_b64 of a lane mask (#593). Kept from
#998: code_range_last / branch_targets_inside / --last-endpgm in fspx_unpack, the
compute fallback to tools/rdna2_decode.py in shader_disasm, and s_bitreplicate_b64_b32
of a lane-mask source into scalar data.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
luizwidmer/palmetto repairs these words outside the translator with tools/widen_smem_decode.py
(the console's 112-SGPR file is wider than llvm-mc's 106). Here restore_vcc_tuples (#674)
already decodes them from the blob; these cases pin the two forms its tests did not cover:
s_buffer_load_dwordx8 into s[100:107] with an SGPR soffset and an immediate offset, and
buffer_store_dword with its resource in s[104:107]. Encodings built from the field layout.

Ported from luizwidmer/palmetto (GPL-3.0): the forms, from its docs/boot_frontier.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
llvm-mc decodes a VOP3P v_dot4_i32_i8 whose op_sel_hi is not [1,1,1] (op_sel bit 1 clear) but
prints and re-encodes it with op_sel 0 / op_sel_hi 7, so translate() refused it as a dropped
field. When those two fields are the only difference between the stored and the printed bytes,
they are now read from the blob, in check_printed_encodings and in both re-anchoring paths, and
the v_dot4_i32_i8 rule applies them as measured on gfx1036 (a non-default S2 half stays
refused). Any other difference is still refused.

Ported from luizwidmer/palmetto (GPL-3.0): its restore_vop3p_dot4. Its console_dot4_word (the
op_sel 2 / op_sel_hi 5 words llvm-mc rejects) is not ported: #1317 prints those in
shader_disasm.py. Test: tests/semantic/test_dot4_printed_op_sel.py, hand-built words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#998 added the rule (a 32-bit EXEC/VCC half as S0, read through Gen.wave_mask) without a test
or a design.md entry. test_lane_mask_bitreplicate_flbit.py now runs it on every lane of a
wave64 in the CPU interpreter, from exec_lo/exec_hi and from a compare's vcc_lo/vcc_hi, against
the ISA pseudocode. design.md says it is interpreter-checked only, not measured on hardware.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
41 files conflicted (about 200 hunks). Where main already had a reviewed
version of the same feature, main's was kept and only what #984 adds on
top was re-applied; what #984 adds that main lacks was taken.

- d3d12_xs_device: slot 81 stays main's GetFrameStatisticsX with the
  presentation handler (#984's frame-events slot not taken); the
  presenter routing runs before #984's internal PresentX. Slots 25/26/127
  and route_xbox_device_slot are main's (#984's null-heap check on 127
  re-applied); slots 61/74 keep main's console-caller gating; slot 73 is
  main's (console list IID answered as ID3D12GraphicsCommandList, so
  #984's d3d12_xs_command_list_iid.h is dropped). Taken from #984: the
  console list proxy (slot 12 path, upload arena, tail names), queue
  layout detection, slot 9 allocator callback, slots 55/57/70/71/86/133,
  Vulkan-backed CPU heaps, the frame token source and the lease bias.
  The lease section both sides moved is kept once.
- d3d12_vulkan_device: #984's staged/deferred title images and pool with
  main's create_image lambda and NVIDIA host-transfer retry around the
  final bind; main's B4G4R4A4 and stencil masks.
- vulkan_backend.h / vulkan_replay.h: main's structure (device-lost flag,
  mark_device_lost outside the lock) with #984's observe_result and
  unsupported_at(__LINE__).
- file_system / dstorage: #984's kernel_writes reads, main's touch_pages
  retry kept as the fallback.
- rdna2spirv / shader_disasm / shader_ir: main's DPP compares, s_load VCC
  base and widen_wave64_masks, plus #984's skipped-instruction restore and
  per-line invalid-word offsets. rdna2_decode is main's: #984's f32-only
  DPP-compare block ran before main's general one and broke its decode.
- xgameruntime_offline, d3d12_xs.cpp: main's.
- Tests: main's and #984's checks both kept, adapted to the merged
  behaviour (queue tail S_OK, fence slot 12, slot 127 mask).

Policy: executable-relative addresses that #984 quoted were removed
(docs/fspx.md, docs/movies.md, docs/embedded_shaders.md, d3d12_vulkan.md,
d3d12_xs_alloc_size.h, windows-boot scripts). The hang-watchdog kick in
main.cpp and the transient-pool dump in startup_trace.h now take their
locations from LEONIDA_TITLE_WATCHDOG_KICK / LEONIDA_POOL_DIAG_AT instead
of hard-coded RVAs; the boot script's state peeks come from
LEONIDA_GAME_STATE_RVA / LEONIDA_SESSION_STATE_RVA.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dxgi_swapchain_count_test: main's failed-resize case passes the
diagnostics argument #984 added to VulkanSwapchain. xs_proxy_mock_test
follows the merge's choices: slot 81 is GetFrameStatisticsX (no frame
events slot 102 in the env mode), slot 73 refuses an IID it does not know
as main's did, and console queue slots the presenter does not route stay
with the queue proxy (S_OK tail) instead of E_NOTIMPL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The merge kept main's widen_wave64_masks for wave64 lane masks; #984's
variant had no caller left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
These failed on #984's head as well. The loop guard (spirv_loop_guard.py)
puts OpPhi into every loop, which the branch interpreter of
test_control_flow_branches did not model; it now evaluates a block's phis
together from the predecessor. spirv_mini_interp now models OpSwitch, so
it runs the emulated wave64 scheduler that the ds_swizzle and permlane16
tests expected it to reject: they now compare the 64 lanes with their
reference models.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	docs/design.md
#	docs/fspx.md
#	tests/semantic/test_alu_dot4_i8.py
#	tests/semantic/test_salu_flbit_64.py
#	tests/semantic/test_vcc_tuple_fallback.py
#	tools/fspx_unpack.py
#	tools/rdna2spirv.py
#	tools/shader_library.py
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:54:08 +00:00
github-bot closed this pull request 2026-11-26 09:54:08 +00:00
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 03:21 UTC · original · edited 2026-11-25 04:27 UTC

Real-data check on Windows 11 with an: main 3ff2a2adc translates the FidelityFX upscaler DLL's programs 27 of 29. Programs 03 and 18 are refused with "reachable instruction with normalized encoding". The same disassembly through this PR's tools/rdna2spirv.py gives 29 of 29 translated, all 29 passing spirv-val. So this fixes a real gap on main (#984's testers had 29/29 on their branch). Counts only.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-25 03:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1495#issuecomment-7151837075) · edited 2026-11-25 04:27 UTC Real-data check on Windows 11 with an: main 3ff2a2adc translates the FidelityFX upscaler DLL's programs **27 of 29**. Programs 03 and 18 are refused with "reachable instruction with normalized encoding". The same disassembly through this PR's `tools/rdna2spirv.py` gives **29 of 29 translated, all 29 passing spirv-val**. So this fixes a real gap on main (#984's testers had 29/29 on their branch). Counts only. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠akimfomin on GitHub · 2026-11-25 03:52 UTC · original · edited 2026-11-25 04:19 UTC

For the #984 staged-image review, PortBridge transferred the dirty-region copy test from VIctory #1135 to Moriz82's warm staged-image case. On an RTX 4070 Ti SUPER, one Vulkan update with two regions submitted 128 KiB versus 1 MiB for a whole-texture update. Both initialized images matched all 1,048,576 bytes, with zero Khronos synchronization-validation errors in either worker.

Source, exact XG header pins and raw results. This is a standalone synthetic follow-up to the staged image path in #1495. A warm, private slot-70 image is the candidate for later integration. It needs a known prior layout and a confirmed authoritative snapshot, with whole uploads for first use or unclear write coverage. The 18-case CPU contract found the integration boundary: the current helper can fail after primary queue acceptance. Keep the image and staging until completion is known and preserve the dirty state until publication. The existing callback cannot report an incomplete publication to the caller. I have no boot or frame-time measurement. AI-assisted PortBridge verification (OpenAI Codex).

A follow-up source-extracted fake-driver test exercised the staging lifetime. If primary submission succeeds but its host wait returns an error while still pending, the pinned helper admits another mapped write and frees the old staging allocation on growth. A localized reference gate denies reuse until that exact timeline value completes. It tracks primary completion separately from visibility on other queues and adds no counter query to the ordinary successful path. Patch and fail-before/pass-after logs. These are simulated error paths. Real device loss and the destination image's own lifetime still need integration coverage.

**@⁠akimfomin** on GitHub · 2026-11-25 03:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1495#issuecomment-7152325718) · edited 2026-11-25 04:19 UTC For the #984 staged-image review, [PortBridge](https://github.com/akimfomin/PortBridge) transferred the dirty-region copy test from [VIctory #1135](https://github.com/Marvisak/VIctory/pull/1135) to Moriz82's warm staged-image case. On an RTX 4070 Ti SUPER, one Vulkan update with two regions submitted 128 KiB versus 1 MiB for a whole-texture update. Both initialized images matched all 1,048,576 bytes, with zero Khronos synchronization-validation errors in either worker. [Source, exact XG header pins and raw results](https://github.com/akimfomin/PortBridge/blob/c4dc7e8f8ae6b2652714c4d2f45182f524610db4/research/rendering-night/continued-regional-upload/README.md). This is a standalone synthetic follow-up to the staged image path in #1495. A warm, private slot-70 image is the candidate for later integration. It needs a known prior layout and a confirmed authoritative snapshot, with whole uploads for first use or unclear write coverage. The [18-case CPU contract](https://github.com/akimfomin/PortBridge/blob/ec0bb3f53f2373567ac6d7027b87e11dd857ec48/research/rendering-night/continued-upload-contract/README.md) found the integration boundary: the current helper can fail after primary queue acceptance. Keep the image and staging until completion is known and preserve the dirty state until publication. The existing callback cannot report an incomplete publication to the caller. I have no boot or frame-time measurement. AI-assisted PortBridge verification (OpenAI Codex). A follow-up source-extracted fake-driver test exercised the staging lifetime. If primary submission succeeds but its host wait returns an error while still pending, the pinned helper admits another mapped write and frees the old staging allocation on growth. A localized reference gate denies reuse until that exact timeline value completes. It tracks primary completion separately from visibility on other queues and adds no counter query to the ordinary successful path. [Patch and fail-before/pass-after logs](https://github.com/akimfomin/PortBridge/blob/36163aad4dcc320eb46910fc923e8492d127ac94/research/rendering-night/continued-upload-lifetime/README.md). These are simulated error paths. Real device loss and the destination image's own lifetime still need integration coverage.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 06:32 UTC · original

Real-boot evidence that this PR is on the critical path (Windows 11, RTX 4070 SUPER, NVIDIA 621.24; main c7e82e26e + #1558 + LEONIDA_TITLE_WINDOWS_MB=1024 for #1537). On main, the two FSPX programs main can't translate show up as "no translated compute shader for FSPX kind-6 and kind-0" at world start, and about 219 s in the process dies on a null pointer inside the upscaler library. With those two programs present, taken from a translation made with this PR's tools (29/29), both log lines are gone and the null-pointer crash no longer happens; the boot goes on about 30 s further. That's one run each way with the same build and settings.

To be clear, this was a local experiment rather than a clean build of this PR: the two missing modules came from this PR's translator, while the other 27 came from main's (22 of the 27 common modules are byte-identical between the two translations, and 5 differ).

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠QemmHD** on GitHub · 2026-11-25 06:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1495#issuecomment-7154898510) Real-boot evidence that this PR is on the critical path (Windows 11, RTX 4070 SUPER, NVIDIA 621.24; main c7e82e26e + #1558 + `LEONIDA_TITLE_WINDOWS_MB=1024` for #1537). On main, the two FSPX programs main can't translate show up as "no translated compute shader for FSPX kind-6 and kind-0" at world start, and about 219 s in the process dies on a null pointer inside the upscaler library. With those two programs present, taken from a translation made with this PR's tools (29/29), both log lines are gone and the null-pointer crash no longer happens; the boot goes on about 30 s further. That's one run each way with the same build and settings. To be clear, this was a local experiment rather than a clean build of this PR: the two missing modules came from this PR's translator, while the other 27 came from main's (22 of the 27 common modules are byte-identical between the two translations, and 5 differ). AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠djrolfes on GitHub · 2026-11-25 07:00 UTC · original

Independent corpus confirmation for the owned packed-dot fixes on Linux / llvm-mc 23.1.5 / SPIRV-Tools: main 42537e7b6 produces 27/29 FSPX modules (two refusals: reachable instruction with normalized encoding). In a separate local validation tree, applying #1317 (4e1ca11a6) and this PR’s d4b2afe0e stored-selector fix restores 29/29 translated modules; all 29 independently pass spirv-val --target-env vulkan1.3. No refusal was skipped and no stale modules copied into the output.

Integration-test caveat: #1317’s test_fspx_dot4_op_sel_disasm.py still expects Unsupported for decoded op_sel=0/op_sel_hi=5. That expectation conflicts with the deliberate stored-selector recovery here. Locally I retained every still-undecodable case and converted that one into a positive asymmetric-value control (recovered output 6 versus the adjacent default-selector output 5), rather than dropping coverage. The four focused files now pass 34 tests with real llvm-mc; full semantic validation is running.

The runtime test branch also includes the separately owned #1558, but it does not affect translation. Runtime assertion/watchdog bypasses remain off. No retail run with the fixed FSPX set yet; no world/frame claim. Raw corpus and diagnostics stay local. AI-assisted.

**@⁠djrolfes** on GitHub · 2026-11-25 07:00 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1495#issuecomment-7155383309) Independent corpus confirmation for the owned packed-dot fixes on Linux / llvm-mc 23.1.5 / SPIRV-Tools: main 42537e7b6 produces 27/29 FSPX modules (two refusals: reachable instruction with normalized encoding). In a separate local validation tree, applying #1317 (4e1ca11a6) and this PR’s d4b2afe0e stored-selector fix restores 29/29 translated modules; all 29 independently pass spirv-val --target-env vulkan1.3. No refusal was skipped and no stale modules copied into the output. Integration-test caveat: #1317’s test_fspx_dot4_op_sel_disasm.py still expects Unsupported for decoded op_sel=0/op_sel_hi=5. That expectation conflicts with the deliberate stored-selector recovery here. Locally I retained every still-undecodable case and converted that one into a positive asymmetric-value control (recovered output 6 versus the adjacent default-selector output 5), rather than dropping coverage. The four focused files now pass 34 tests with real llvm-mc; full semantic validation is running. The runtime test branch also includes the separately owned #1558, but it does not affect translation. Runtime assertion/watchdog bypasses remain off. No retail run with the fixed FSPX set yet; no world/frame claim. Raw corpus and diagnostics stay local. AI-assisted.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-26 03:09 UTC · original

Closing as superseded by #2138, merged as 0b11d86bc.

  • Included: its three commits (dot4 op_sel, bitreplicate, the vcc test).
  • Dropped on purpose: the general dot4 op_sel rule, because it also translated a form that was never measured (op_sel 0 / op_sel_hi 5). Only measured forms translate now; the design.md row says how each was confirmed.
  • Already on main: the older merge of #984 it carries.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-26 03:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1495#issuecomment-7181442542) Closing as superseded by #2138, merged as `0b11d86bc`. - **Included:** its three commits (dot4 `op_sel`, `bitreplicate`, the vcc test). - **Dropped on purpose:** the general dot4 op_sel rule, because it also translated a form that was never measured (op_sel 0 / op_sel_hi 5). Only measured forms translate now; the `design.md` row says how each was confirmed. - **Already on `main`:** the older merge of #984 it carries. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.