Skip to content

[integration] RT-BOOT-COMBINED: translator fixes + null-barrier fix on main; scripted pad past legal terms to the story load - #2138

Merged
aslan2142 merged 26 commits into
mainfrom
integration/boot-combined
Nov 26, 2026
Merged

aslan2142 merged 26 commits into
mainfrom
integration/boot-combined

Conversation

@ubiquitarianism

Copy link
Copy Markdown
Collaborator

Claimed in the coordination issue as: RT-BOOT-COMBINED (#1608 (comment))

Depends on: #1495, #1504, #674, #583, #1281, #1317, #998

What this is

One integration branch on current main (ae1b48288):

How far it boots

Native Windows 11, retail 1.0.2.1, scripts/windows-boot/boot.ps1, the same translated shader set for every run, no device faults in any run:

  • main alone, default input: reaches the first-run "navigation experience" page.
  • This branch, default input: reaches the same page at the same time. Neither the null-barrier nor the null-RTV path fired on this route, so the runtime fix is not what moves it.
  • This branch, scripted pad: gets through navigation experience, brightness, legal notices and legal terms. Confirm then shows the story-load loading screen, whose spinner was still turning when the 400 s run ended, about 100 s after Confirm.

Getting through needed no code change, only input. The legal-terms page keeps Confirm greyed out until both boxes are ticked, and down stops at Confirm, so an a/down-only script sits there looking stuck. The doc records the page order and the up / a / down / a retry that confirmed.

Tested

  • GPU: AMD Radeon RX 6800, driver 32.0.21030.2001, Windows 11 Pro 26200.
  • Python: python -m compileall -q make_game.py tools tests and python -I make_game.py --help pass. tests/test_fspx_unpack.py, tests/test_rdna2spirv_decode.py, tests/test_shader_library.py and tests/test_text_write_line_endings.py pass.
  • Translator suite: python -I scripts/run_semantic_tests.py tests/semantic reports 493 files, 6328 tests, 0 files failed.
  • Runtime: configured with -DLEONIDA_VULKAN_HEADERS_FETCH=ON -DLEONIDA_REQUIRE_VULKAN=ON, built RelWithDebInfo with MSVC 19.50. CTest passes except four tests that fail the same way on main on this machine:
    • d3d12_texture_tiles, pipeline_cache_seed and d3d12_clear fail on both. d3d12_clear fails because a NaN depth clear reads back 1, apparently an AMD driver behaviour.
    • vk_null_descriptor does not compile without glslangValidator.
    • Under ctest -j 8 about 30 loader and file tests collide on shared temp folders; they pass when run one at a time.
  • No game data: python -I scripts/check_no_game_data.py over every changed file passes. No captures, logs or addresses are in the branch or this description.

Not done

  • No world frame. The loading screen was still up at the end of the run, so whether the load finishes on this machine is the next thing to measure.
  • tools/stage_timeline.py on main still carries title addresses. It is not touched here and is left for its own finding.

Tyrannys and others added 20 commits November 24, 2026 03:08
…ibrary programs

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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
…alid words

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 <noreply@anthropic.com>
…rds llvm-mc rejects, so the FSR4 FSPX programs translate

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.
…hash (TOOLS-LIBRARY-COMPUTE-BY-HASH)

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 <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts:
#	tools/fspx_unpack.py
#	tools/shader_library.py
# Conflicts:
#	docs/fspx.md
#	tests/semantic/test_alu_dot4_i8.py
# Conflicts:
#	tests/semantic/test_salu_flbit_64.py
#	tests/test_fspx_unpack.py
#	tools/fspx_unpack.py
#	tools/rdna2_decode.py
#	tools/rdna2spirv.py
#	tools/shader_library.py
…fer store through a vcc resource

restore_vcc_tuples (#674) already decodes these words from the blob (the console's 112-SGPR file
is wider than llvm-mc's 106); 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.
The forms come from luizwidmer/palmetto (GPL-3.0).
…the console list

List slot 146 (Barrier -> GCL7 80): a texture barrier with no resource, which
the console takes as a global barrier, is forwarded as a D3D12_GLOBAL_BARRIER
with the same sync and access; a mixed texture group is split into runs in
order, in storage that lives for the call. Calls with nothing to convert keep
the title's pointer. A group array that cannot be read safely (null with a
nonzero count, an unknown group type, absurd counts) is refused whole and
logged once per reason.

List slot 52 (ClearRenderTargetView -> PC 48): the device proxy marks the real
handle when CreateRenderTargetView gets no resource (moved by RTV descriptor
copies, cleared by a view made with a resource), and the clear of a marked view
is skipped, as on the console. Other views keep today's path.

Before this, both calls put the PC list in its error state, so Close failed and
ExecuteCommandLists dropped the submission. xs_proxy_mock_test models that
error state in its mock list and covers both paths; the two old slot-146 cases
that passed garbage words now pass valid ones.

The null-resource barrier and null-view clear behaviour were first reported by luizwidmer/palmetto.
…red fields

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.

This replaces #984's restore_dot4_inline_sel, which took one case of the same form (op_sel_hi
[1,0,1] with an inline integer S1); that case is covered by the general check. The words llvm-mc
rejects (op_sel 2 / op_sel_hi 5) are printed by shader_disasm.py (#1317) and recovered from the
blob by skipped_form. The approach comes from luizwidmer/palmetto (GPL-3.0).

Test: tests/semantic/test_dot4_printed_op_sel.py, hand-built words; design.md contract row and
docs/fspx.md updated.
…ct-table sentence

#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, and
that a VCC destination stays wave64-only (#984's rule).
… with clamp set

The two boundary tests need a v_dot4_i32_i8 word that no pass recovers. The measured op_sel 2 /
op_sel_hi 5 word is now decoded (skipped_form); the same word with clamp set stays a gap
(llvm-mc rejects it, and shader_disasm.py and skipped_form take only the unclamped form), so the
tests do not depend on which other op_sel values are measured later.
…om the environment

#984 (273b3bd) put RVAs and file offsets of the retail executable into code, docs and scripts.
The code paths that need one now read it from an environment variable and are off when it is
unset; the docs and examples say the location is measured locally.

- runtime/src/main.cpp: the hang-watchdog kick takes its trap and kick RVAs from
  LEONIDA_TITLE_WATCHDOG_KICK="<trap RVA>,<kick RVA>" (hex), still only when the trap
  instruction is at the first one. Unset, the watchdog stays armed, as before by default;
  LEONIDA_TITLE_WATCHDOG=1 keeps it armed, and LEONIDA_TITLE_WATCHDOG=0 without the RVAs says
  once that it needs them. The LEONIDA_PEEK example uses placeholders.
- runtime/shims/startup_trace.h: the transient-pool dump fires at the int3 that
  LEONIDA_POOL_DIAG_AT names (`<module>+0x<offset>`, as the trace prints it), off when unset.
- scripts/windows-boot/boot.ps1: LEONIDA_PEEK's default comes from LEONIDA_GAME_STATE_RVA and
  LEONIDA_SESSION_STATE_RVA (no peek when unset), and the RESULT digest matches those values;
  the examples and README use placeholders.
- runtime/README.md documents LEONIDA_TITLE_WATCHDOG_KICK and LEONIDA_POOL_DIAG_AT.
- docs/fspx.md, docs/d3d12_vulkan.md, docs/movies.md, docs/embedded_shaders.md and a comment in
  runtime/shims/d3d12_xs_alloc_size.h drop the addresses and offsets.

This follows the same change on the earlier integration branch (#1495).
# Conflicts:
#	runtime/shims/d3d12_xs_device.cpp
… load (RT-BOOT-COMBINED)

The legal-terms page keeps Confirm greyed out until both boxes are ticked, and
down stops at Confirm, so an a/down-only script sits there. Record the page
order, what each page needs and the retry block that reached the loading
screen on native Windows; one README status sentence links it.
@ecox982745

Copy link
Copy Markdown

Both null-resource paths preserved a real GPU submission on the RTX 4090. I compared the integration head 6c8a89dea with ae1b48288, its mainline base before the integration merges. Windows 11, NVIDIA 616.64, MSVC 19.44, Release.

Operation inserted before the fixture's compute work Base Integration head
No extra operation Passed Passed
Console list slot 52, clear a null-resource RTV List failed at Close Skipped the clear, submitted the list and matched readback
Console list slot 146, texture barrier with no resource List failed at Close Recorded a global barrier, submitted the list and matched readback

I used the synthetic read-write case from d3d12_title_va_test, with the device proxy's console-list mode enabled. For the RTV case I allocated an RTV heap, created an explicit RGBA8 texture2D view with a null resource, and cleared its handle. For the barrier case I supplied one texture barrier from render-target write to pixel-shader read. Each probe recorded only that additional console call before the existing compute dispatches and copies on the same underlying list. The fenced readback checked 64/64 descriptor reads and 64/64 root-view results on the head, and 0/64 matched the other buffer. Both rows and the control gave the same result with Khronos validation enabled and disabled.

I also ran the four CTests called out in the PR description on both revisions, serially, with glslang available. d3d12_texture_tiles, pipeline_cache_seed, d3d12_clear and vk_null_descriptor passed in both validation modes. In particular the NaN depth clear matched the WARP reference for all 15 texels, and the runtime reported a pipeline-cache hit on the RTX 4090. The separate CPU mock test xs_proxy_mock passed on both revisions.

These results cover the two command-list operations and synthetic readback. The retail boot milestone is still covered by the author's RX 6800 report. AI-assisted with OpenAI Codex (gpt-6.2-astra).

aslan2142 and others added 5 commits November 25, 2026 21:49
Conflict in runtime/shims/d3d12_xs_device.cpp, proxy_copy_descriptors_simple:
keep this branch's copy_null_rtv_marks call and main's fsdraw::enabled()
gate for the descriptor-copy diagnostic.

tools/rdna2spirv.py merged without a textual conflict, but #1662 on main
calls restore_dot4_inline_sel in the exact re-anchoring path, which this
branch had deleted. The merge puts main's function back so that call
resolves; the next commits reconcile it with the dot4 op_sel rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ead)

The copy of #1317 in this branch called with_dot4_op_sel(code, mcpu, bad,
err) and run_mc(bytes(patched), mcpu) without wave32, so a wave64 program
whose v_dot4_i32_i8 op_sel 2 / op_sel_hi 5 word was re-decoded printed its
lane masks as vcc_lo. Take #1317's current head (62237d0, by tedin7):
with_dot4_op_sel takes wave32 and hands it to run_mc. Also its newline="\n"
on the test's JSON write, and the two blank lines before MAX_DATA_DWORDS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…583 head)

The copy of #583 in this branch replaced main's check that both short
prologue words are literal-bearing VOP3 opcode-0x180 words
(words[k+1] & 0xFFFE0100 == 0x03FE0100, the shape fspx_prologue_probe.py
checks) with a looser SRC2 == 0xff test. Keep main's check, as #583's head
(3af97a1, by Tyrannys) does, with this branch's named constants, and take
that head's test_short_prologue (the stricter check refuses 0x03FF0000)
and its docs/fspx.md paragraph.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re_dot4_inline_sel

The general rule from #1495 (dot4_op_sel_fields / restore_dot4_op_sel,
ported from luizwidmer/palmetto) took the stored op_sel/op_sel_hi of any
v_dot4_i32_i8 that llvm-mc printed with the defaults. That translated
op_sel 0 / op_sel_hi 5 with a VGPR second source, a word #1317's
test_fspx_dot4_op_sel_disasm.py (case (0, 5)) requires to stay refused:
only op_sel 2 / op_sel_hi 5 was measured on gfx1036. The translator suite
failed there.

Resolve it on the measured side:
- drop dot4_op_sel_fields and restore_dot4_op_sel;
- keep main's restore_dot4_inline_sel (#984) and its three call sites:
  the clean-listing check, the forward re-anchor search, and the exact
  re-anchor window #1662 added today. The general rule does not cover
  only those cases, so it cannot replace them;
- tests/semantic/test_dot4_printed_op_sel.py now checks that the
  inline-integer form is restored in a clean listing and on re-anchoring,
  and that op_sel_hi 5 with a VGPR S1, op_sel 1 / op_sel_hi 6,
  op_sel_hi 4 and a non-default S2 half stay refused;
- docs/design.md "Signed-byte dot products" states how each form was
  confirmed (hardware for op_sel 2 / op_sel_hi 5, a corpus count for the
  inline-integer form, refused otherwise); docs/fspx.md follows.

This also settles the #1662 / #1862 overlap: #1662's call site stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f0611b7 took the executable's addresses out of the code. Two behaviours
changed with it; the removal stays, the changes are now explicit:

- runtime/src/main.cpp: the watchdog kick runs again only with
  LEONIDA_TITLE_WATCHDOG=0, as on main; LEONIDA_TITLE_WATCHDOG_KICK only
  supplies the two RVAs it needs. Either variable alone leaves the
  watchdog armed and the loader says so once (before this commit the kick
  ran whenever LEONIDA_TITLE_WATCHDOG_KICK was set).
- scripts/windows-boot/boot.ps1 no longer has the game- and
  session-state RVAs built in, so LEONIDA_PEEK has no default and the
  RESULT states read "?" unless LEONIDA_GAME_STATE_RVA and
  LEONIDA_SESSION_STATE_RVA are set. The script now warns when they are
  not, and runtime/README.md (LEONIDA_PEEK, LEONIDA_TITLE_WATCHDOG and
  _KICK rows), scripts/windows-boot/README.md and docs/first_run_ui.md
  say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eased

The null-view marks (#1504, by ubiquitarianism) are kept by the real CPU
handle. They were moved by descriptor copies and cleared by a view made
with a resource, but never dropped when the heap went away, so an RTV heap
made later at the same address inherited stale marks and its clears were
skipped. The heap proxy now records an RTV heap's real CPU range and
heap_release drops the marks in it. The barrier conversion keeps no state
across calls, so it needs nothing here.

xs_proxy_mock_test: an RTV heap's marked view is skipped while the heap
lives and cleared after it is released; a mark outside it stays; a second
heap at the same address starts unmarked and marks again. docs/d3d12_vulkan.md
says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aslan2142
aslan2142 merged commit 0b11d86 into main Nov 26, 2026
2 of 5 checks passed
@aslan2142

Copy link
Copy Markdown
Collaborator

Merged. We merged today's main in and fixed the review points, still as one PR:

This includes #1281, #998, #1504, #1317 and #583 (closed as included) and supersedes #1495.

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

@aslan2142
aslan2142 deleted the integration/boot-combined branch November 26, 2026 03:18
Kokonotcu added a commit to Kokonotcu/leonida that referenced this pull request Nov 26, 2026
37 upstream commits after 86dc3d8: ProjectLeonida#2138 (integration/boot-combined), ProjectLeonida#2094 (geometry-view eviction on range
release, reaped after the replays that may name them), ProjectLeonida#998/ProjectLeonida#1317/ProjectLeonida#1281/ProjectLeonida#583 heads (pipeline-library compute
programs by code hash, shader_disasm prints the dot4 op_sel words llvm-mc rejects, FSPX short prologue with the
literal-form check), null-resource texture barriers and null-view RTV clears on the console list, and the removal
of the title's executable addresses from code (read from the environment).

Conflicts, on merit:
- d3d12_xs_device.cpp: both. Our title heap sync (LEONIDA_TITLE_HEAP_SYNC) and upstream's null-RTV marks sit side
  by side; heap_release unregisters the sync or the range as before and also drops the heap's null-RTV marks;
  CreateDescriptorHeap keeps our desc argument and takes upstream's RTV real range. Our value-op/upload-ring
  slots and upstream's slot 146 barrier conversion both stay.
- startup_trace.h: our thread and watchdog-table logging stays, and follows upstream's rule: the watchdog table's
  store and table RVAs come from LEONIDA_WATCHDOG_TABLE (off when unset, documented in runtime/README.md);
  upstream's environment-driven pool diagnostic replaces the fixed address.
- fspx_unpack.py: ours (the code end is found from one rdna2_decode pass, not an llvm-mc run per s_endpgm: the
  OOM and 15-minute fix). Its test takes upstream's short-prologue case, which checks the literal form our code
  also requires.
- rdna2spirv.py: ours (s_bitreplicate_b64_b32 into VCC in wave32 stays translated: 6 pipeline-library programs),
  plus the point behind upstream's refusal: in wave32 VCC's high word is data, so it is now written to vcc_hi as
  source bits 16..31 replicated (replicate_bits16, shared with the scalar form). Tests: ours kept, one added for
  the vcc_hi word; test_salu_flbit_64 keeps ours (this tree translates i64 of a lane mask).
- xs_proxy_mock_test.cpp: upstream's empty Barrier call, our chained-submission reference count.

Every line the merge removes from our side is upstream's own or one of the resolutions above (checked against the
merge base, D:\GTA6\analysis\lostlines.sh). The touched Python suites pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

8 participants