Commit Graph

5744 Commits

Author SHA1 Message Date
15c668fb64 PR #950: x64_recomp: find qemu through QEMU_AARCH64 or PATH, not a contributor's home folder
From https://github.com/ProjectLeonida/mandy/pull/950 (head 16452e785f), applied as a reviewed patch.

Co-authored-by: barkodr <barkodr@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:42:19 -05:00
249cc5b24f PR #904: docs/i18n/fr: the build needs 400 Go free, not 350 (I18N-FR-DISK-350GO)
From https://github.com/ProjectLeonida/mandy/pull/904 (head c09270d678), applied as a reviewed patch.

Co-authored-by: TuroYT <TuroYT@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:42:18 -05:00
29361079f6 rdna2spirv: --mesh-serial-waves under --mesh-compute too (SHADER-W64-MESH-SERIAL-COMPUTE)
GPUs without VK_EXT_mesh_shader (NVIDIA Pascal) translate mesh programs with --mesh-compute and are the ones that
need wave64 emulation most, but the switch was off there. The compute program now runs the same passes, and
mesh_compute_epilogue's slot writes go through ms_serial_epilogue: the header from index 0, which only pass 0's
lane 0 has, and each pass's vertices and primitives at the built-in index + 64 * pass, from that pass's copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 22:26:50 +02:00
f390e9b1b1 docs/running.md: regenerate the DirectStorage predictor profile after 2a491668a
A runtime built without make_game.py's runtime stage keeps an older
history.bcph, so 2a491668a's fix for the missing-endpoint BC7 tail requests
(#2019, #2396) does not apply until tools/build_dstorage_history.py runs
again. Add it to "Settings every platform needs" with the command, the
load line to check and a profile M report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:36:49 -06:00
5e8d3349c8 Merge origin/main into window-retire-on-1920
submit_write keeps main's second root UAV (va2) and our wait flag: (s, va, va2 = 0, wait = true); the two callers that only execute pass va2 = 0 explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwSKP7weM2P7sk5skto
2026-11-27 19:25:41 +01:00
28829e0aab gameinput: let go of the cursor clip while the window is dragged
The keyboard pad clips the cursor to the foreground window's client
area and re-applies the clip every 100 ms. A press on the title bar was
pulled into the client area, and during the modal move loop each re-clip
pulled the cursor, and the window with it, down the screen instead of
letting it be dragged.

The clip is now released while the window's thread is in a move/size or
menu loop (GetGUIThreadInfo: GUI_INMOVESIZE, GUI_INMENUMODE,
GUI_SYSTEMMENUMODE), and while a mouse press that began outside the
client area is held, including one that activated the window. A press
in the client area keeps the clip, so a click still cannot land on
another window. The decision is CursorClipGate (shims/gameinput_clip.h),
covered by the new gameinput_clip test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 12:13:35 -06:00
4b22da0877 Merge branch 'feat/game-actions' into port/d3d12-nvidia 2026-11-27 12:27:00 -05:00
68a13c4d5e Trainer menu: game actions through the title's own cheat system (LEONIDA_GAME_ACTIONS=1)
The title has a cheat system of its own: a table of sixteen handlers without
arguments, and the functions those call take plain arguments. Ten places in
its code are found by short byte signatures (each once in the executable),
which give the cheat dispatcher and table, the title's deferred call, the
player's ped, the functions that set a ped's wanted level, the time of day
and the forced weather type, and the globals they work on.

The title's once-a-frame call of its cheat input function becomes a call of
ours (a near stub, written before any title code runs); the menu only queues
a request, and the hook hands the title's own deferred-call queue (the one
its cheats go through) the work. Wanted level, clear, never wanted, hour,
clock paused, sync with system, weather by name, freeze weather, the health
cheat and the nine vehicle cheats are wired; the player's position and
heading come from the ped itself. Moving the player, god mode and the rest
still say why they are not there.

Off unless LEONIDA_GAME_ACTIONS=1: built and unit-tested, not yet run in the
title. LEONIDA_GAME_ACTIONS_RUN scripts commands for a test without the
keyboard and logs to %TEMP%\leonida-actions.

docs/mod-menu.md: how it was found, with counts; the 6,811 script command
wrappers (each carries its own 64-bit hash) and what was tried to find the
table that binds them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 12:17:56 -05:00
5fd6cb82d6 Ultrawide windows: the 16:9 picture with bars or stretched, and an output-size lever
The title outputs 16:9 whatever its window is, and the swap chain was stretched
over the window.

LEONIDA_ASPECT=21:9|32:9|W:H|auto makes the title's window in that shape (at the
height it asks for, then fitted to the screen as before). LEONIDA_PRESENT_SCALE
=fit keeps the picture's shape in a window of another one: the swap chain
becomes a frame of the window's shape at the picture's height, cleared to
black, with the picture copied unscaled into its middle; =stretch is the
present as it was. Unset: fit with LEONIDA_ASPECT, else stretch, so nothing
changes without them (a 16:9 window's frame is the picture and the copy is the
same CopyResource). With bars, frame generation is told where the picture is
in the back buffer.

This is the fallback, not a wider view. For the real thing the title has to
output a wide size: LEONIDA_OUTPUT=WIDTHxHEIGHT (experimental) changes the
3840x2160 row of its mode table together with the scanout reservation that
has to fit it (the check LEONIDA_OUTPUT_1440 tripped, at rva 0x247af2d, wants
under 2 MiB of the reservation left) and the Settings viewport, after VIctory's
native 1440p profile as runtime/src/display_profile.h records it.
docs/ultrawide.md lists what the executable shows of the output size, the
render size and the shapes it knows, and what a run has to answer before this
can be called ultrawide (whether a wide row is taken, the projection, the HUD).

Unit tests: the frames and shapes (aspect.rs), the reservation sum and the
three places against the 1.0.2.1 executable (hooks.rs). Not run in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 12:12:14 -05:00
c400d773a7 Game patches after VI-Patch: 60 fps always on, no vignette by LEONIDA_VIPATCH_NO_VIGNETTE
ZiZc3's VI-Patch (github.com/ZiZc3/VI-Patch) is a patch set for the PS5 build of the title. It has no licence,
so nothing of it is copied: its lines are new bytes at PS5 addresses. What each patch does is taken, the places
were found in the Xbox executable, and the bytes written are our own (docs/vi_patch.md).

- 60 fps, no switch: the two places that turn the video settings' frame limit into the frame interval load 60
  (RVA 0x224359a, 0x1e0fc62 in 1.0.2.1), so the title asks SetFrameIntervalX for 16 667 microseconds in place
  of 33 333 and its own limiter follows.
- No vignette, LEONIDA_VIPATCH_NO_VIGNETTE=1: the jumps over the spotmeter_aiming and spotmeter_fast exposure
  profiles are made unconditional (RVA 0x496ab6, 0x496b51).
- Skip intro logos, weather fix, first person, no clothing, Mandy replaces Lucia, no depth of field: not found
  or not ported, each with its reason in the doc.

A place is a pattern of its bytes (?? for displacements), taken at the offset known for 1.0.2.1 or found by a
search of the image's code that must find it once; a patch is written only if all its places are found
(vipatch.rs, hooks::game_patches). Unit tests for the search, the plan, the table and the write into a made-up
image; with LEONIDA_GAME_DIR set the same run finds each pattern once in the retail executable.

Not run in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 11:07:54 -05:00
b25f39e67e docs: correct linux_proton.md status line for verified world frame 2026-11-27 10:54:02 -05:00
4392670a76 d3d12: a freed window's last bytes reach the live copies too (RT-TITLE-WINDOW-RETIRE)
retire_orphan_windows frees the retired windows whose submissions have
completed after this submission's refresh_shadows, and freeing writes
the window's copy back to the title's pages once more
(free_retired_shadow). The refresh had already copied those pages to
the live copies, so the slot-133 buffer that replaced the window read
the older bytes until the next submission.

Moving the free ahead of the refresh, as suggested, is not enough on
its own: the write-back opens the pages it writes, and the refresh's own
copy back of the live copies' batches (write_back_titles) then takes
those pages for ones the title wrote and drops the buffer's GPU results
there (measured with this test: with the free moved first, the words
written through the buffer did not all reach the pages). So the free stays after the refresh, and a
retired copy's bytes that go back are written into every other copy over
them that still held the title's older bytes, as the next refresh would;
a copy that changed a byte keeps its own. Under lock_, in place, no
allocation. The epoch/ticket gating (src/command_list_epochs.h,
stamp_retired_windows) is untouched.

d3d12_title_va_test --window-orphans: the submission that frees the
window reads the held words through the buffer placed over the ring.
With LEONIDA_TITLE_WRITEBACK=0 (d3d12_title_window_orphans_free) it read
0 of 64 before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwNPurxyJ9LAfUbNiYr
2026-11-27 16:38:53 +01:00
7afb87266f d3d12: a retired window's copy goes back byte by byte (RT-TITLE-WINDOW-RETIRE)
ShadowPages::write_back compared the copies in 256-byte pieces and kept
one flag per piece: once a live copy had changed any byte of it, a
retired window's copy was left out of the whole piece. A retired window
and the slot-133 buffer that replaced it can have written disjoint
bytes of one piece (the window [384, 512), the buffer [256, 384)), so
the window's bytes were dropped. The batch path (`only` null) had the
same flag (`live = live || pass == 0`).

The piece now keeps a fixed 256-entry mask on the stack (no heap under
lock_) of the bytes a live copy changed, set in the first pass; a
retired copy goes back on every byte it changed that no live copy did,
in runs. Copies are still compared against the title's bytes as they
were before any copy went back, and a live copy now writes only the
bytes it changed, so one live copy no longer writes the title's older
bytes over another's result in the same piece.

d3d12_title_va_test --window-orphans: the held submission writes through
the window from ring + 384, a later one through the buffer placed over
the ring from ring + 128, and all the held words must reach the title's
pages (32 of 64 did before). The ring is write-combined so the buffer is
a copy on every driver. New ctest entry d3d12_title_window_orphans_free
runs it with LEONIDA_TITLE_WRITEBACK=0, where the window's free is the
only way back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwNPurxyJ9LAfUbNiYr
2026-11-27 16:38:40 +01:00
e1f82510a0 d3d12: a pool cover replaces only the windows it planned to (RT-TITLE-WINDOW-RETIRE)
cover_pool_request planned its cover (title_pool_cover) under short
shared locks of the alias table, then made the mapping and entered it
with replace_twin, which erased every range in the span unconditionally.
A slot-133 buffer is entered (Resource::alias_title_va) without
title_window_mutex, so one placed in either view of the span in between
was erased with the windows. And replace_twin's result was ignored: the
cover was recorded in pool_spans and returned as made either way.

replace_twin now takes the caller's predicate and, under the same
unique lock as the replacement, refuses with nothing changed when a
range it would erase is not one the caller planned to replace. The
cover passes the windows its plan found. On refusal the window it made
is dropped at once (drop_title_window: nothing answered from it, so no
submission names it) and the request falls back to the zero-size view
as before. The same drop now follows add_twin's refusal in
resolve_pool_memory, which left its new window charged to the budget
and refreshed with nothing answering from it.

title_window_plan_test: a non-window range entered in the cover's span
(CPU view, then twin view) between title_pool_cover and replace_twin is
refused and left intact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwNPurxyJ9LAfUbNiYr
2026-11-27 16:38:40 +01:00
b8754f630f title_window_plan: bound the twin view without modular arithmetic (RT-TITLE-WINDOW-RETIRE)
title_pool_cover translated a mapping found in the pool's other view back
with `x - (twin - va)` modulo 2^64. A window that starts below the twin
view (m.title_va < twin - va) wrapped to near UINT64_MAX, passed the
pool bounds check, and replace_twin then erased it whole, leaving the
part of it outside the cover unanswered. A twin view that does not fit
in 64 bits (twin < va - pool_lo, or pool_hi - va > UINT64_MAX - twin)
made the twin-view query wrap into an empty range, so a range in the way
was not seen at all.

The twin view's bounds [twin_lo, twin_hi) are now checked up front,
queried in non-wrapping coordinates, and a hit outside the view it was
found in refuses the cover like one outside the pool.

title_window_plan_test: check_pool_cover_bounds with the review's
example (pool [0x100000, 0x500000), va 0x120000, twin 0x420000, window
[0x200000, 0x440000)) and the two overflow cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwNPurxyJ9LAfUbNiYr
2026-11-27 16:38:40 +01:00
312c2dd4b2 docs: the PS5 package is encrypted; its glyphs are not read
The user's PS5 copy is one .pkg (magic 7F 46 49 48); 64 KiB samples across it measure
7.85-8.00 bits/byte. Under the ground rules nothing is decrypted, so the PlayStation prompts stay
the replacement set built by tools/ps_prompt_glyphs.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 10:12:20 -05:00
b54cd98cf7 history: a portable, hashed manifest of the old-pr tips and the old issue index (#563) 2026-11-27 11:58:33 -03:00
920173613c heaps in place: the title's bytes at the title's address, a filtered copy of each page at the table address
The title keeps plain data inline in its descriptor heap pages and points V#s at it. With one filtered home bound
at both addresses, the filter's output reached those V#s: four words a compute program reads as sizes looked like
a V# with a base nothing holds, three of them were nulled, the program read [0 0 0 720] and spun until the ring
timeout.

title_mirror.h: alias(lo, hi, buffer, offset) gives each page of the range a second home, the filtered copy, bound
at the alias in the same batches as the mirror's binds and filled by hooks.filter whenever the title's bytes change
(a piece's sum, or write-back); the page's own home is always the title's bytes. filter_range, unfilter_range and
filtered_at are gone; copy_bytes(va) is the copy the filter's caller writes slots into; unalias takes the ticket its
copies are freed after; write_back and homes_in take every home again.

The device writes slots into the copy (apply_in_place_changes, finish_in_place). An unreachable V# half is null
whole, all four words, in the filter and in fix_vsharp.

d3d12_heap_in_place_test: inline data after a table, a V# of the title pointing at it, and a rewrite on the same
page: the V# reads the title's four words, the table the filtered entries ([0 0 0 0] for the data), the title's
bytes unchanged; on the previous commit it read [0 0 0 720] at both addresses. A GPU store into the heap's page
now goes back to the title's bytes. title_mirror_hooks_test covers the alias's own homes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:43:30 -05:00
5f33b4ff30 docs: the ctest host page re-measured on main d1dff794 (#1150)
Five rows of the previous tables re-run three times each on the same
GTX 1050 Ti / Windows 10 19045 host: d3d12_subresource_copy and
d3d12_r9g9b9e5_uav now pass, d3d12_existing_heap needs #1894, and both
remaining heap rows (d3d12_heap_properties ALLOW_ALL and the
d3d12_vulkan_device HARDWARE_PROTECTED row) are the tier-1 host gate
that #1389 covers.

AI-assisted (OpenCode, DeepSeek).
2026-11-27 10:42:15 -03:00
d42c37335b d3d12: LEONIDA_ASYNC_MIN_BYTES_GRAPHICS, a separate async threshold for graphics (RT-ASYNC-MIN-BYTES-GRAPHICS)
With LEONIDA_ASYNC_PIPELINES=1, graphics and mesh pipelines (all their stages) now take
LEONIDA_ASYNC_MIN_BYTES_GRAPHICS when it is set, and LEONIDA_ASYNC_MIN_BYTES otherwise, so
nothing changes while it is unset. Compute keeps LEONIDA_ASYNC_MIN_BYTES. 0 makes every graphics
pipeline asynchronous. One startup line states both thresholds; text that is not a number is
ignored with a log line.

Thread dumps from a retail run showed the draw thread building lazy graphics variants under the
1 MiB threshold in place, 2.5-11 s each, back to back, with no present for about 100 s. A skipped
draw costs one draw. The image needs the small lighting and post compute programs, and those
are still built in place.

Tests: async_pipeline_size_test covers the per-kind decision and the unset fallback;
d3d12_pipeline_workers_test --async-graphics-zero / --async-graphics-unset (new ctests) hold
the compile worker with compute over its threshold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:24:29 +01:00
d483077913 Merge main into claude/pipeline-prewarm-order
Resolve runtime/README.md conflict after #2220 and #2233 landed on main.
2026-11-27 08:11:54 -05:00
17d3af0b65 Merge pull request #2462 from OreoFR/rt-compile-gate-auto
compile gate: `auto` default, calibrated per driver at device creation (RT-COMPILE-GATE-AUTO)
2026-11-27 14:08:00 +01:00
8bab5f2811 Merge main into claude/rt-async-compile-pool and refresh compile-gate doc note
Resolve runtime/README.md conflict with #2220 (LEONIDA_PIPELINE_ORDER_LOG)
and note in docs/d3d12_vulkan.md that LEONIDA_COMPILE_GATE=adaptive and 1
gate graphics creates as well (#2412).
2026-11-27 07:50:01 -05:00
e31f50bbcc compile gate calibration: keep no unclear verdict, drain a timed-out fence
Review of #2462:
- An unclear calibration (a slow submission the create does not explain) is no
  longer written to compile_gate_calibration.txt, and an unclear line an
  earlier build wrote is not read as a cached verdict: the next launch measures
  again instead of staying classic until the driver changes
  (compile_gate_policy::cache_verdict, tested in compile_gate_policy_test).
- After a fence wait that fails, the fence and command pool are destroyed only
  once the pending submission's fence signals (up to 60 s); on a lost device or
  if it still has not, they are left alive. The verdict stays classic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:49:07 +01:00
6af3b1dac6 Merge remote-tracking branch 'origin/main' into rt-compile-gate-auto 2026-11-27 13:43:49 +01:00
690dea5193 Merge pull request #2220 from MoonEyes/feat/pipeline-order-recorder
runtime: record the order of first pipeline requests (LEONIDA_PIPELINE_ORDER_LOG=1, RT-PIPELINE-PREWARM-ORDER phase 1)
2026-11-27 13:43:04 +01:00
a78040bb13 Wave64 one-lane fold: loop a one-block self-loop, half EXEC writes, implicit carry VCC
Three soundness gaps the review reproduced against the round emulation:

- A region that is one block branching back to itself was emitted straight,
  so it ran once. It now gets a sub-CFG like a multi-block region and is
  emitted as a loop through cfg_structure.structure. This also covers the
  read-only self-loop that was already folded before the one-lane rule.
- A write of one half of EXEC (v_cmp_eq_u32_e64 exec_lo, 0, v0) marked EXEC
  at most one lane, though the emitter keeps the other half's lanes. A half
  write now keeps the fact only when EXEC already had it and the half
  written is within it (a compare).
- The short form v_add_co_ci_u32 vD, src0, src1 (also sub, subrev) wrote VCC
  only in the emitter. explicit_carry_vcc now gives it its VCC carry-out and
  carry-in operands when the listing is read, so every analysis sees the
  write, and the emitter's special case is removed.

tests/semantic/test_wave64_one_lane_fold.py adds each case (8 subtests fail
before) and picks in lanes 32-63 of both waves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwNPurxyJ9LAfUbNiYr
2026-11-27 13:39:13 +01:00
1d7c662b4b compile gate: auto default, calibrated at device creation
With LEONIDA_COMPILE_GATE unset or `auto`, the device measures the driver once
before the VulkanContext exists: a worker creates a synthetic compute pipeline
(SPIR-V written in code, new specialization seed each run, no pipeline cache)
while the queue gets empty submissions waited on a fence. Quick submissions with
the create still in the driver give the adaptive gate; a held one, a create too
fast to tell, an unexplained slow submission or any failure give classic. The
verdict is cached per vendor/device/driver/pipelineCacheUUID in
compile_gate_calibration.txt beside the pipeline cache;
LEONIDA_COMPILE_GATE_RECALIBRATE=1 measures again. Only the title process
calibrates; build hosts and tests keep classic. `classic`, `adaptive`, `1`, `0`
still force a mode.

Tests: compile_gate_policy_test (no GPU: settings, NVIDIA version decode,
verdicts, cache file, SPIR-V shape) and vk_compile_gate_calibration_test (GPU:
a verdict within 20 s, adaptive on NVIDIA 621.40).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:24:49 +01:00
ad1789d7e9 Merge main into mesh-serial-waves
docs/design.md: keep the new row and take main's text of the row below it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 20:11:21 +08:00
3d6050b96a Merge pull request #2397 from DadaCap/mesh-prim-index-clamp
rdna2spirv: keep mesh primitive indices below the vertex count (SHADER-MESH-PRIM-INDEX-CLAMP)
2026-11-27 13:10:09 +01:00
f75b2b4258 Merge pull request #2412 from OreoFR/fix/compile-gate-bounded
compile gate: adaptive per kind of create, re-armed by a held submission (RT-COMPILE-GATE-ADAPTIVE)
2026-11-27 13:02:22 +01:00
ebdc991627 compile gate: the held check on every pass of the wait, and presents never use the probe budget
Second review on #2412:
- enter_submit no longer switches to the held limit for good once it sees a create of a kind that holds
  submissions: each pass checks held_blocking(). With one in the driver the held limit applies on its own (also when
  it is under the plain limit) and the budget is off; without, the plain limit and budget apply, so a submission
  goes ahead at the plain limit once the holding create left while a create of a kind with no verdict stays. The
  "reached the limit, but ..." notice comes once per wait, and the wait wakes when a holding create leaves.
- SubmitTurn passes `probe` into enter_submit: a present or wait never goes ahead at the probe budget, only at the
  limit.
- VulkanPresenter::submit's turn does not probe (it covers the startup frame's fence wait and the present); the
  nested queue_submit turn still probes the vkQueueSubmit alone.
- submit_mutex_test: gate_second_review covers the four cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 12:46:36 +01:00
8f59df0fb0 Merge remote-tracking branch 'upstream/main' into claude/rt-async-compile-pool
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-27 05:46:06 -06:00
b0712ff2ce Merge test/round2 into heaps-in-place: per-piece sums and the T# index word for heaps read in place
title_mirror.h: a filtered page's sums per 256-byte piece are of the title's bytes (title compared with title); the
filter runs after that compare, only when a piece changed or the home is fresh, and writes the home. write_back skips
a filtered home, so page_mirror_write_back takes TitleMirror::write_back as is. A home leaving its filter is copied
whole once.

The T# index word (tsharp_index_word) is written by finish_in_place into the home's dword 6 once the T# is bound; the
filter leaves 0 (the fallback) there meanwhile, so the title's own dword 6 is never read as an index. Copy-path heaps
keep fix_console_slot's write. d3d12_heap_in_place_test checks a T# slot reads the tag and index while the title's
bytes keep their dword 6; title_mirror_hooks_test checks write-back skips filtered homes and the filter is not called
again for unchanged title bytes. set_tsharp_index_words_for_test for the test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 06:39:35 -05:00
23c3341196 Merge branch 'test/round2' into heaps-in-place: heaps read in place under the mirror's B and C steps
With the mirror's steps B and C (title memory resolved to heap_base + its address, ordinary memory mirrored when a
reader names it, the write-back of GPU stores from the homes, a separate bind flush), the in-place filter changes:

- Lock order console_heap_mutex, then page_mirror.mutex, then slot_change_mutex. vsharp_address's mirror path takes
  the mirror's lock under console_heap_mutex now, so the filter, which runs inside the mirror's fills, takes no other
  lock of ours: the in-place heaps' filter state is under the mirror's lock (page_mirror.in_place), and the mirror's
  refresh no longer takes console_heap_mutex. Under the lock the filter does only reachability (arena, a buffer of
  ours, or the mirror through page_mirror_resolve_locked, which names ordinary memory as any reader does), nulls and
  the list of what is left: a V# the mirror does not hold and a T# to bind are finished in the heap's refresh
  (finish_in_place), outside the mirror's lock, and written into the home unless the title rewrote the slot since.
  The change list is taken under the mirror's lock when a heap is read in place, so the entries it has not read stay.
- No write-back from a heap read in place: page_mirror_write_back skips filtered pages (TitleMirror::filtered_at), as
  their homes hold the filtered slots, not the title's bytes.
- The heap's pages are named to the mirror when the heap is made (ordinary memory is mirrored then), after its
  filter range and its second binding are set. The binds go in flush_page_mirror's batch.

d3d12_heap_in_place_test also checks that a GPU store into the heap's pages is not copied back over the title's
bytes; title_mirror_hooks_test checks filtered_at.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 06:21:29 -05:00
be3e9c1424 descriptors: the T# index word in the contract table, README and translator source lists
docs/design.md states what the pack and the runtime agree on (the tag 0xA << 28, index 0, how an older pack is
recognised) with the counts; runtime/README.md says what LEONIDA_CONSOLE_HEAP_GPU does with an index-word pack;
make_game.py and runtime/cmake/translator_deps.cmake list the translator's new imports (descriptor_sources.py,
heap_index_census.py), so a pack and the test shaders are made again when they change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 06:20:53 -05:00
16245b98b2 Merge remote-tracking branch 'upstream/main' into claude/pipeline-prewarm-order
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-27 05:20:16 -06:00
ee81c0e4a0 compile gate: builds outside MSVC, and the classic gate stays the default
- CreateKind, CreateInfo and GateAhead move out of SubmitMutex to namespace scope (CompileGateKind,
  CompileGateCreate, CompileGateAhead), with using aliases so SubmitMutex::CreateInfo and the rest still work:
  clang and GCC reject a `= {}` default argument of a nested class with default member initializers inside the
  enclosing class (review on #2412).
- LEONIDA_COMPILE_GATE unset is the classic gate again, as on main: compute creates only, no limit, no probes;
  graphics creates do not pass it. The adaptive gate is LEONIDA_COMPILE_GATE=adaptive: on a driver that holds
  submissions (630.20) its first probe of a kind enters the driver after the 2.5 s probe budget and loses the
  device if that create stays 10 s more, which the classic gate waits out. `1` and `0` are unchanged.
- submit_mutex_test: a classic-gate case (a graphics create holds nothing back, a 3 s compute create is waited out
  with no verdict), the adaptive cases opt into graphics gating; passes unset, with `adaptive` and with `1`.
- README rows and docs/d3d12_vulkan.md say so; the "held verdict 2 s into the probe" wording is corrected (it comes
  when the probe returns, and the probe holds the submit lock until then).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 12:20:11 +01:00
74bfb7d070 Merge branch 'test/round2' into tsharp-index 2026-11-27 06:17:53 -05:00
916868ebe0 Merge remote-tracking branch 'origin/main' into window-retire-on-1920
# Conflicts:
#	runtime/CMakeLists.txt
#	runtime/test/d3d12_title_va_test.cpp
2026-11-27 12:11:50 +01:00
c4261506b3 Merge remote-tracking branch 'upstream/pr2220' into claude/pipeline-prewarm-order
# Conflicts:
#	runtime/CMakeLists.txt
2026-11-27 05:11:17 -06:00
ba32cd6acf d3d12: a console resource heap the page mirror holds is read in place: no copy, its pages filtered as they are filled
When every page of a console CBV/SRV/UAV heap lies in the page mirror (a reservation xmem placed in its range),
add_heap_in_place gives it no copy and no page tracker of its own. 25,865 of the corpus's 26,503 shaders keep 32 bits
of a descriptor-table pointer, so the heap's pages are bound a second time into the arena below 4 GiB
(TitleMirror::alias, same bind batches and wait as the mirror's), at a range of whole arena blocks with no arena
memory behind it (arena_reserve_unbacked); the null slots after the heap are that range's rest, unbound, reading
zero. Table pointers go there as before (console_heap_ranges).

The mirror fills the pages' home through filter_heap_page (TitleMirror::filter_range): the title's page is only
read; a slot whose bytes changed since it was last filtered, or that a change touched (the records' change list,
applied at the mirror's refresh before the written pages are filled, filtered straight into the home), is fixed as a
copied slot was, into the home: a V# whose base lies in the arena, the mirror or a buffer of ours stays as the title
wrote it (reachable_as_written, no record); another V# is resolved as before (an interim until every title allocation
is in the mirror) or written with no base and no records and waits; a T# is bound as before [TSHARP-INDEX: its
bindless index in the entry]; other words are null. A GPU write-back is never taken from these pages: the mirror has
none, and no window is made for them.

A heap the mirror does not hold (a device without the mirror, memory outside its range) is copied as before. New
log line per in-place heap: pages filtered and slots changed per submission and per frame, the ms, and the V#
halves read as the title wrote them. arena_gpu_read reads the arena with the GPU after the mirror's last bind
(tests).

Test: d3d12_heap_in_place_test (Wine, iGPU): a heap in physical pages of an XMemVirtualAlloc reservation; the GPU
reads, below 4 GiB, a V# into nobody's memory and a data word null and V#s into the arena and the mirror as written,
while the title's bytes stay as written byte for byte; a rewrite through the title's own view reaches the GPU at the
next refresh, filtered, and the title keeps what it wrote; the null slots read zero. It fails on the copy path. Linux
ctest 123/123.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 06:05:33 -05:00
4aca5032f8 Merge branch 'claude/rt-async-compile-pool' into claude/pipeline-prewarm-order
# Conflicts:
#	runtime/CMakeLists.txt
#	runtime/README.md
2026-11-27 05:05:06 -06:00
4b1cf4f0fb Merge remote-tracking branch 'origin/main' into feat/picture-metrics 2026-11-27 12:00:58 +01:00
4ad8c85d07 docs: the PICTURE block names two more limits of picture_metrics.py (TOOLS-PICTURE-REPORT)
A lattice that repeats fewer than three times is not reported, and a 1280x720 frame takes a few seconds; both
were in the tool's docstring only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 12:00:19 +01:00
08647217ea Merge origin/main into fix/compile-gate-bounded
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 11:55:03 +01:00
20e63e70eb Merge remote-tracking branch 'origin/main' into shader-format-decode-one 2026-11-27 11:54:40 +01:00
334859c3c9 tools: picture_metrics.py stops reading sparse dark pixels as a lattice (TOOLS-PICTURE-REPORT)
The lattice minimum counted marked tiles over the whole frame, so a corner
diagonal of one or two tiles covered fully at a large period and won: a
grey 256x256 frame with 15 random dark pixels read as LATTICE 20 times out
of 20. A class now counts only with 8 marked tiles on 3 diagonals that are
each half marked or more, and with marks off it under a quarter of its
cover. BLOCKS needs 3 edge lines on each axis (one sharp rectangle has two)
and a share of half or less (a checkerboard has no picture around it); the
docstring and docs/agent_collaboration.md say what it still misreads:
several sharp rectangles, and blocks off the frame's origin.

Tests: sparse random dark pixels at 256x256, 320x180, 640x360 and
1280x720, Gaussian noise, marks along rows, a lattice through noise, a
checkerboard and one rectangle (24 tests, 58 failures before the fix).

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 11:51:32 +01:00
2e54980149 rdna2spirv: multi-dword scalar loads as wide loads with one bound check
s_load_dwordx2/4/8/16 and s_buffer_load_dwordx2/4/8/16 read their dwords as
uvec4 / uvec2 loads instead of one uint each. An s_buffer_load with a
run-time bound checks its last dword once and takes the wide loads; a load
that is partly out of range keeps the per-dword path, so out-of-range dwords
are still 0 and not read. The vectors go through a NonWritable block (SMEM
on RADV) only in modules that write no memory: with the decoration in a
module that stores, RADV ordered the load before the store and
valu_fuzz --family mem read old words in 18 of 600 programs.

Tested: tests/semantic/test_wide_scalar_load.py (new fixture),
SmemHardwareRuleTests, the translator suite, valu_fuzz --family mem on the
Radeon iGPU (600/600, wave32 and wave64), scripts/run_gpu_tests.py on the
iGPU (same results as before), a synthetic GPU program on the RX 7900 XTX
(docs/design.md row).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 05:48:40 -05:00
0513e00b07 rdna2spirv: the 4x8-bit dot products as SPV_KHR_integer_dot_product
v_dot4_i32_i8, v_dot4c_i32_i8, v_dot4_u32_u8 and v_dot4c_u32_u8 become one
OpSDot / OpUDot on the packed bytes plus OpIAdd for the addend, and
OpSDotAccSat / OpUDotAccSat under clamp (both saturate the addend plus the
exact sum, as the hardware does). op_sel halves are put together into one
dword first. RADV did not re-form v_dot4 from the old expansion (four
extracts, multiplies and adds each), which made the FidelityFX upscaler
passes ALU bound.

--integer-dot-fallback keeps the expansion for a device without
shaderIntegerDotProduct (required by Vulkan 1.3): vk_subgroup_info.py
reports integer_dot_product and make_game.py turns the flag on where it is
false. The runtime and vk_pipeline_check enable the feature where the
device has it; the interpreters of the semantic tests run the new ops.

Tested: tests/semantic/test_packed_dot4.py (new fixtures), the translator
suite, tools/dot_diff.py on the four ops, a wave32 GPU program on the
Radeon iGPU (gfx1036) and the RX 7900 XTX against the gfx1036-measured
words, RADV statistics of the upscaler passes (docs/design.md row).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 05:48:33 -05:00