Commit Graph

5744 Commits

Author SHA1 Message Date
109828e081 victory/README: Leonida's install folder in the NVIDIA example; plan notes VIctory's NVIDIA settings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:24:53 -05:00
f0b84e01f2 docs: title memory merged; the pool check and why it fails
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:20:14 -05:00
7f672dd30c Merge port/title-memory: title GPU memory imported at its own addresses on Vulkan; slots 70/71, 133; list 62/71/72/100/148
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:10:38 -05:00
d5095f59d1 runtime: title memory as GPU memory; console device slots 70/71 and list slots on title addresses
A GPU address is now the title's CPU address on a capture-replay device
(src/title_memory.h has the design and the RTX 4060 Ti / 616.64
measurements behind it):

- The arena's memory asks for the device address heap_base = 512 GiB
  (bufferDeviceAddressCaptureReplay, enabled on the standalone device), and
  every range of the title's graphics memory is imported with
  VK_EXT_external_memory_host at heap_base + its address (Resource::
  create_host_buffer) and registered as a buffer at VA = that address, so
  heap_base + VA in shaders and buffer_at in the replay both reach the
  title's own bytes, with no copy. LEONIDA_TITLE_MEMORY=0 turns it off.
- xmem places 32-bit graphics memory in [1 GiB, 4 GiB) and the rest in
  [64 GiB, 448 GiB) (VIctory xmem.rs:63-88), drops write-combining as VIctory
  does (xmem.rs:60-64), and tells the layer what becomes GPU-visible (commits
  of graphics memory, mapped physical pages, committed then) and what is
  about to go (VirtualFree, unmaps, remaps): rt::xmem::set_graphics_listener,
  connected in gta6rt.
- Driver behaviour the imports work around, each measured: imported memory
  cannot be sparse-bound (no 2^40 mirror); every import but the first also
  takes an ordinary device range right after the arena, so the windows'
  device addresses are held by sparse buffers at them and an import takes
  its part; imports get addresses 2 MiB at a time, so imports in one 2 MiB
  block are merged.
- Device slot 133 binds its buffer to the import that holds its pages.
- Device slots 70/71 (V device.rs:443-444, descriptor.rs:795-818,
  resource.rs:2383-2448): buffer views are V#s at the title address; texture
  views get a texture keyed by (address, description with words 1 and 13
  zeroed), filled from title memory and detiled (gfx10_tiling.h) for one 2D
  level of SW_4KB_S or SW_64KB_D; other layouts start zeroed, logged.
- List slots (V list.rs:1294-1431, 1596-1613, 1891-1983): 62
  CopyMemoryToMemoryX as copies between the buffers at those addresses,
  71/72 Write32/64 as WriteBufferImmediate MARKER_OUT (timestamps: the CPU
  clock at recording), 100 DispatchMeshX as DispatchMesh(x, 1, 1) (indirect
  dropped, as V does), 148 AllocateUploadMemory from the device's imported
  upload blocks, given back at reset; 73/74 WaitValue recorded and waited
  for at ExecuteX up to LEONIDA_VALUE_WAIT_MS (100), not held as V holds
  them.

d3d12_title_memory_test (RTX 4060 Ti): a compute shader written to the
translator's contract reads title memory through a slot-70 V# in a console
descriptor heap in 32-bit title memory and writes it back through a root UAV
at a title address; a slot-70 SW_64KB_D texture reads back as its texels;
slot 71 V#/T#; list slots 62/71/72/73/148; slot 133 on mapped physical pages;
unmapping and the title's VirtualFree release the imports.

Retail title: every import succeeds (4.5 GB of pools, the 32-bit windows,
slot 133's 174 MB buffer); slot 70 now writes its view. The title still stops
at its breakpoint game_scarlett_master.exe+0x247af2d after its back buffers:
a pool check that slot 70 does not reach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:09:59 -05:00
eb464f2fcb docs/design.md: the 27.0 M3 checked the draw probe; the LOD 1 control and the clamp order (#1774 review)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 02:09:32 +01:00
7e4eeb97b7 docs: what VIctory ab34a8b21 offers Leonida (1440p/FSR, FidelityFX, texture streaming)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 20:09:28 -05:00
15350f6da6 rdna2spirv: seed the POPS collision word so the wait loop ends (SHADER-POPS-COLLISION-SEED)
A pixel shader with an ordered section (POPS) reads the hardware's collision word, which sits in the SGPR after the
user SGPRs and the primitive mask: collision wave id in bits 0-9, this wave's id in bits 16-25, overlap in bit 31.
The program waits until wave_id + ~collision_id is below src_pops_exiting_wave_id + ~collision_id (unsigned). The
translator orders the section with fragment-shader interlock and reads the exiting id as 0, and the word was
whatever the push constants held at that dword, usually 0. With wave id == collision id the test is
0xffffffff < 0xffffffff, never true, so a wave that reached the loop ran it until the loop guard (65,536 rounds).
The overlap test before the loop skips it whenever a lane is on in EXEC, so it is a wave (a host subgroup) with EXEC
all off there; on 32-wide subgroups that is either half of a wave64 program whose lanes are all off.

The SGPR is now the source of the program's wave-id extract (s_bfe_u32 with field 0x000a0010) when the program reads
that SGPR's entry value (shader_meta's user_sgpr_reads), and it is set at entry to 0x00010000 (no overlap, wave id 1,
collision id 0): the loop leaves after one round. A program without that extract keeps the old behaviour.

- tools/rdna2spirv.py: pops_collision_sgpr and the entry store.
- tests/semantic/test_pops_collision_seed.py: subgroups of 64 and 32 lanes, with and without the seed, and the SGPR
  search; the GPU fixture runtime/test/shaders/ps_pops_wait_loop.asm (check.py, run_gpu_tests.py) and its llvm-mc
  listing.
- tests/semantic/spirv_wave_interp.py: the interlock instructions run as no-ops (a run has no other primitive).
- runtime/test/vk_harness.cpp: a fragment shader that needs pixel interlock on a device without it is unsupported
  (77), as for barycentrics.
- docs/design.md, docs/d3d12_vulkan.md: the POPS rows.

GPU: on an RTX 4070 SUPER the fixture gives 4096 of 4096 pixels as expected; with the seed taken out every pixel's
round count is 0x00010000.

Idea from Marvisak/VIctory 7ac1f54, written anew.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
2026-11-25 19:45:31 -05:00
4a1c850a7a x64_recomp: treat a shift by cl as a writer that may leave the flags alone (#2150 review)
x86 changes no flag for a shift or rotate whose masked count is 0. The
first version patched ARM's carry when cl is 0, taking CF from ctx when no
carry writer came before the shift in its block. But flag liveness treated
the shift as always writing, so a writer in an earlier block never stored
its word, and ctx held a stale CF: cmp r8d, 2 (r8d = 1); jmp; mov cl, 0;
shl eax, cl; setc read 0 instead of 1.

_flag_analysis now treats a shift by cl as a conditional writer: liveness
does not kill the flags it writes, the writer before it stores its word as
well, and a consumer behind it reads the ctx word. With cl = 0 the shift
is skipped whole, its flag store included, so ctx keeps the earlier word.
The ARM-carry patching and shift_prev_c go; the immediate-count-0 change
stays.

Tests: the analysis checks of the patching are replaced by checks of the
new rule, and three execution cases are added (a carry from an earlier
block with cl = 0 and cl = 1, and one a logic op cleared). The first one
fails on the previous head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 19:37:25 -05:00
bbc7506559 d3d12: stub draws only for this device's mesh stubs; =color stubs override the state that hides them
Review follow-up for #1549:
- record_draw no longer skips a draw with an unregistered PSO: graphics stubs are registered now, so a draw with a PSO from another implementation fails the list again (Close: E_INVALIDARG), as on main. A stub records its kind (none, compute, mesh) when stub_or creates it; stub_pipeline_kind(pso, device) gives it only for the list's own device, and DispatchMesh skips only that mesh stub's draws. A mesh draw with another device's stub fails the list. record_dispatch keeps main's bypass.
- LEONIDA_STUB_PIPELINES=color turns off the title's culling, wireframe fill, sample mask, alpha to coverage, depth and stencil tests, blending and logic op for the stub, keeping the write mask. The B4G4R4A4 fallback's refusal of blending and logic ops now waits until it is known whether the pipeline is such a stub.
- docs/boot.md: the cover needs a triangle topology and stays inside the scissor; what is turned off; which draws stay recording errors.

d3d12_stub_draw_test: =color with CULL_MODE_BACK, FILL_MODE_WIREFRAME, SampleMask 0 and a reverse-Z GREATER test against a depth target cleared to 0; a draw with another implementation's PSO (switch off); DispatchMesh with a mesh stub on its own device's list (closes) and on another device's (fails). Each fails on fa223d8 or on the first version of this fix; every case is reported. The B4G4R4A4 path has no test (the GPUs here render A4R4G4B4).
2026-11-25 21:35:42 -03:00
78159b8865 d3d12: LEONIDA_STUB_PIPELINES builds a real graphics pipeline from built-in stages (MVP-GPU-04)
A graphics PSO whose translated shader is missing used to be created with no Vulkan pipeline and never
registered. Its draws did not become no-ops as the comment said: record_draw refused them, so the whole
list failed to close.

Now a vertex pipeline with a missing translation (no shader library, or no entry for its FSSM/FSPX
program) takes a vertex and a pixel stage from src/stub_pipeline.h and goes through the normal
create_graphics path: registered, built eagerly, drawn through replay and the validation layer.

- LEONIDA_STUB_PIPELINES=1: the vertex stage puts every vertex outside the clip volume, so a draw
  changes no pixel (the old intent), but the render pass, attachments and push constants are real.
- LEONIDA_STUB_PIPELINES=color: every three vertices cover the viewport and the pixel stage writes
  magenta (1 to UINT/SINT targets) to each render target, so stubbed passes show on screen.
- Point-list PSOs get a PointSize write; the vertex stage's Position is a bare output, so
  rect_list_geometry takes it.
- Compute and mesh stubs stay unregistered; record_draw and DispatchMesh now skip a draw on an
  unregistered pipeline as record_dispatch already did, instead of failing the list.

d3d12_stub_draw_test draws with both modes into an RGBA8 and an R32_UINT target and reads them back;
d3d12_stub_pipelines_test now expects a registered pipeline. docs/boot.md describes the switch.
2026-11-25 21:35:10 -03:00
a42bffdc3e Merge origin/main into heavy-pipeline-cache
main's per-pipeline compute journal (pipeline_cache_journal.h) now persists every compute build and survives a
crash, so the compute build takes main's build_compute_pipeline and the heavy cache keeps graphics pipelines only.
CMake keeps both test sets; docs and the create_pipeline comment say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 05:27:39 +05:00
f36d89ebcc Merge remote-tracking branch 'origin/main' into title-texture-partial-mips
# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-26 01:26:03 +01:00
c2818b3d6f Merge remote-tracking branch 'origin/main' into w64-one-lane-fold
# Conflicts:
#	tools/rdna2spirv.py
2026-11-26 01:25:08 +01:00
4d811fcee9 Merge remote-tracking branch 'origin/main' into shadow-keep-gpu-writes
# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-26 01:23:09 +01:00
0ebd4286ea d3d12: a slot-133 shadow keeps the GPU's writes where the title's bytes did not change (LEONIDA_SHADOW_KEEP)
ShadowPages copies pages that carry no sign of a title write (aliased,
unguarded, reopened with their 64 KiB block, write-watched or pinned) at
every refresh, and that copy overwrote what a shader had stored in the
shadow with the title's unchanged bytes. A value a compute program writes
for the next frame then read back as the title's old bytes every other
frame.

Each tracker now keeps a 64-bit sum per 256-byte piece of the bytes it
copied last (runtime/src/shadow_keep.h) and copies a piece only when the
title's bytes differ. Zeroed pages forget their sums. LEONIDA_SHADOW_KEEP=0
copies every job whole, as before. New CPU-only test shadow_keep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwRYcpySx4P4ncQ3wD5
2026-11-26 01:22:14 +01:00
345b1c2a4c docs: VIctory reference in the world on the RTX 4060 Ti with the user's save
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 19:14:47 -05:00
c50ed94b35 Merge pull request #2098 from Moriz82/pr/upstream-1125
Improve post-load GPU memory and pipeline handling (RT-POST-LOAD-GPU-MEMORY)
2026-11-26 01:01:15 +01:00
d359feac19 docs: shader rules merged; GPU suite 230/248 on the RTX 4060 Ti
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:58:43 -05:00
de3ee203b2 Merge remote-tracking branch 'origin/main' into vk-pipeline-large-admission
Conflict in runtime/test/large_module_gate.h: kept main's forwarding header to runtime/src/large_module_gate.h (unchanged) and put LargeModuleQueue after the include; it admits with the gate's admits() and a blocking Ticket under its own mutex, so try_enter and the try_to_lock Ticket are no longer needed.
2026-11-26 00:58:30 +01:00
622e857e8c Merge port/shader-rules: loop cap, quad/helper lanes, VS-PS link census, exec and tfe fixes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:56:49 -05:00
700bb76082 translator: computed EXEC writes (SHADER-1264) and the MIMG tfe status (SHADER-1266)
Four GPU fixtures failed on an RTX 4060 Ti (616.64): the fixtures were in,
the translator half was not.

- A scalar op that reads no lane mask writes a number to exec_lo /
  exec_hi; lane L now takes its bit L mod 32, as a constant does
  (Gen.exec_number_bit). It was tested for non-zero, so s_lshl_b32 /
  s_add_u32 / s_bfm_b32 into exec_lo turned the whole half on:
  cs_w32_exec_computed gave 8192 8192 8192 7682 ..., cs_w64_exec_computed
  8224 8192 16384 16384 .... Bitwise ops that read their operands through
  mask_src are already 0 / ~0 per lane and get no extra code; ops reading a
  lane mask and VALU ops are unchanged. The corpus listings write exec
  halves only with s_mov_b32, s_and/andn2/or/xor_b32 and s_wqm_b32.
- An MIMG read with tfe or lwe returns the fetch status after its data;
  Gen.mimg_status writes 0 there (every texel resident without sparse
  residency), so cs_imgload_tfe and cs_imgload_d16_tfe no longer see the
  1000 they seed it with. No corpus listing uses tfe or lwe.

GPU: all four pass on the RTX 4060 Ti with and without
LEONIDA_W64_EMULATE=1. CPU: tests/semantic/test_exec_computed.py (now with
the wave64 fixture under --wave64-emulate) and the new
tests/semantic/test_mimg_tfe_status.py with the hand-written fixture
image_load_tfe.asm. Contract rows in docs/design.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:56:18 -05:00
18af7e9fa2 wave64_emulate_opt: fold a region at most one lane of the wave runs (SHADER-W64-ONE-LANE-FOLD)
A forward must-analysis proves EXEC at most one lane after v_cmp(x)_eq_{i,u}32 <constant>, v0 (v0 the thread id,
not written since entry; the group one row of x or rows of whole waves) and through copies, ANDs and saveexecs of
that mask. Such an s_cbranch_execz region folds with several stores and in a cycle, orders no accesses inside, and
when it writes no EXEC its v_readfirstlane_b32 is the lane's own value. One 1024-thread library compute program:
639 -> 33 OpSwitch cases, spirv-val valid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwRYcpySx4P4ncQ3wD5
2026-11-26 00:53:17 +01:00
a1df1713d4 d3d12: LEONIDA_TITLE_PARTIAL_MIPS fills the readable smaller mips of a title texture whose larger ones are not there
The XG layout of a 2D texture of one slice stores its mips from the smallest to the largest, so the mips from m on
are a prefix of its footprint (mip_chain_bytes). With LEONIDA_TITLE_PARTIAL_MIPS=1 the readability probe returns the
readable prefix (texture_memory_readable_bytes), first_mip_within the first mip it holds; when the last slot-70 view
starts there or later, those mips are filled and only the T#s of views that start there or later are published. The
others stay on the fallback until a later fill has their mips. A texture not filled, or filled in part, whose pages
came through a map change is marked stale so the next pass fills it.

Off by default: the image still has memory for every mip. LEONIDA_TITLE_PARTIAL_MIPS_MB (2048) bounds the image
memory of the textures filled in part. Unset, the behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwRYcpySx4P4ncQ3wD5
2026-11-26 00:44:13 +01:00
787ea0bee7 tools: VS -> PS link census (by number against by signature row)
Leonida links exp paramN to Location N and v_interp attrA to Location A;
VIctory links by signature row (native.rs VsOutput / PsInput). The census
reads a carve's index.json, ISG1/OSG1 and the FSSM stage tables (VIctory's
layout) and, per pipeline (a shader_link_check.py manifest, or a VS and a
PS paired by technique name), compares each pixel input's attr with the
param of the producer output of the same row and of the same semantic.
Counts only; --list names the pipelines locally, --json writes counts.

On a local 1.0.2.1 carve (counts only): of 323 readable VS x PS pairs by
name, 292 link the same all ways and 31 differ; 19 have an input at
another param (the PS reads a subset of the VS's rows, so by number it
reads the wrong ones), 12 read a semantic the VS does not write (not a
valid D3D12 pipeline). Rows past every signature register appear in 956
PS, 685 mesh and 120 VS, mostly with 16-bit elements. The linking rule is
not changed here; the contract row lists what moving to rows needs.

Unit test: tests/test_vs_ps_link_census.py on synthetic signatures and FSSM
tables. Contract row "VS -> PS link census" in docs/design.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:38:59 -05:00
fc71534883 Make the live compute warm-up limit opt-in; main's warm-up stays the default
#2098's LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES defaulted to 128 KiB, so while the title submits it skipped exactly the
large modules main's warm-up (#1889) exists to build, with LargeModuleGate already ordering them behind a submission's
compiles. At the maintainers' decision ("main wins") it is opt-in now: unset or 0 is no limit, as on main; <n> leaves
warm-ups of modules over n bytes to their first use while the title submits, as #2098 measured with 131072.

This reverts the test-side override of fb60a1cf4: d3d12_big_compute_warmup runs with main's environment again. The
switch is documented in runtime/README.md beside the other #2098 switches, and in docs/d3d12_vulkan.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:37:48 -05:00
3a2820b3bf Merge main c1e1ef0b8 into RT-POST-LOAD-GPU-MEMORY (#2098)
Two conflicts:

- d3d12_com.cpp, note_direct_heap_indexing: main's console_descriptor_table_va(cbv_srv_uav_base_) for the tracked
  table, with this branch's per-site once() flag instead of note_once on every draw.
- d3d12_vulkan_device.cpp, PipelineState::build_compute: this branch's body (build_compute_pipeline, journal, compile
  helper). main's dev_status::Build around the compute create moves into build_compute_pipeline, next to the
  pipeline_profile::DriverCall, so the status line still names the compute pipeline in the driver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:36:19 -05:00
4d008900e9 docs: second patch source (avatarmanz/VIctory-7900XTX) and the test save
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:34:47 -05:00
2edbda73e7 translator: quad reads and helper lanes in pixel shaders, from VIctory
On the console whole-quad mode puts a pixel shader's helper lanes in EXEC.
Vulkan keeps a helper active for quad and derivative operations only;
whether it joins a ballot or a shuffle is the driver's choice. Ported from
VIctory, which runs the title:

- DPP quad_perm, a dpp8 whose every lane reads its own quad, and a
  ds_swizzle that stays in the quad (QUAD_PERM, or masks that keep lane
  bits 2-4) are quad operations in a pixel shader (Gen.quad_read:
  OpGroupNonUniformQuadBroadcast / QuadSwap), the source's EXEC bit too,
  so a helper across a triangle edge is read as on hardware (VIctory
  921d8d3b4). They were subgroup shuffles and a ballot.
- v_readfirstlane_b32 in a pixel shader: an active lane that its own
  ballot leaves out (a helper the driver keeps out) takes its own value,
  so a waterfall loop serves it in the first pass (VIctory 060195536;
  without it such loops spun with only helpers left until DEVICE_HUNG).
  An empty ballot read lane 0 before.
- A pixel's discard keeps the killed lane as a helper for the survivors'
  quad reads (VIctory 77053a0c5): Leonida never ends a lane before the end,
  so this held already; the test pins it.

Vertex, geometry and mesh shaders keep their shuffles (no helpers there,
and quad operations would need quadOperationsInAllStages).

spirv_mini_interp.run_workgroup now runs OpGroupNonUniformQuadBroadcast
and QuadSwap, with `helpers` taking part as Vulkan requires.
test_ds_permute's pixel fixture runs whole quads only (a pixel wave holds
whole quads; a lane missing from its quad is a compute shader's case).

Tests: tests/semantic/test_quad_helper_lanes.py with the hand-written
fixtures quad_helper_reads.asm and discard_keeps_helper.asm, run with
helpers a driver leaves out of ballots, votes and shuffles. Contract rows
in docs/design.md. Not GPU-verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:32:16 -05:00
95eacfa7cf Merge pull request #1166 from abnalstlll-byte/feat/bl4-descriptor-address-translation
docs, tests: record descriptor heap census and provide 32-bit address translation contract suite (BL-4)
2026-11-26 00:31:53 +01:00
c5359a4644 d3d12: the window write-back waits for the submission that wrote (RT-TITLE-WINDOW-WRITE-BACK)
The first cut copied the reached ranges back at the next refresh whether or not
the submission that wrote them had finished, so a range the GPU was still
filling could be read half done.

A batch is now kept with the retire ticket of the submission that will use it,
and the ranges are copied back only once the context reports that ticket done.
Anything not yet retired stays queued and is copied on a later refresh, still
before that refresh's forward copy, so the ordering that keeps the title's own
newer bytes is unchanged.

The test is unchanged and still passes: it asserts the pages are untouched
until the next submission and then hold exactly what the shader wrote.
2026-11-25 23:30:33 +00:00
093be901ae Merge pull request #2141 from abnalstlll-byte/feat/rt-direct-heap-arena-remap
d3d12: remap directly-indexed heaps to arena shader VA (RT-DIRECT-HEAP-ARENA-REMAP)
2026-11-26 00:27:10 +01:00
38385762bd dev overlay: the title HUD's VRAM and private memory figures
LEONIDA_DEV_OVERLAY (#2137) showed the working set and free RAM, with
no GPU memory and no private memory. It now shows both, from the same
code as the title HUD:

- src/memory_figures.h holds VramBudget, the private-bytes choice (the
  larger of PrivateUsage and PagefileUsage, since Wine fills only the
  latter), the "RAM ..." and "VRAM ..." text with "n/a" where there is
  no figure, and a publisher for the device's GPU memory figure. No
  Vulkan, and Win32 only under _WIN32, so the overlay's test still
  builds on every host.
- A device with VK_EXT_memory_budget publishes a reader when it is
  created and withdraws it first thing when it is destroyed (the lock
  is held during a read, so a reader never outlives its device).
  latest_vram() calls the reader at most once per 500 ms for both
  views. The HUD reads it instead of its own per-device lambda.
- The overlay's last line is now "RAM 2.5 GB (ws 1.0)   VRAM
  3.5/16.0 GB +0.5 shared"; cores and free RAM keep their own line.

Tests: dev_overlay_test checks the text with and without figures, the
private-bytes fallback, and the publisher (one read per refresh, only
the publishing device withdraws). title_hud_test checks that a HUD
without its own source shows the published figure.
d3d12_vram_budget_test checks that the device publishes its figure
while it lives and withdraws it on release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:18:57 -05:00
d4fb292344 Merge main into rt-title-hud-vram-budget
Brings in #2137 (LEONIDA_DEV_OVERLAY), which the next commit extends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:18:55 -05:00
dcdcade326 runtime: address review of the pipeline order recorder
- open(): when the existing log does not end with a newline (a process killed
  mid-line), write one first so the next session line is not glued to the cut
  line and its records are not filed under the previous run.
- Fix the hook comments (vulkan_replay.h, d3d12_vulkan_device.cpp, docs,
  README): the hook never blocks and allocates nothing, but the readiness
  callbacks take a non-blocking try_lock on the first request of a pipeline
  and of a variant.
- Close the order log after the exit pipeline cache write, not before.
- Remove the unused Slot::written and Slot::build_written.
- Tests: cut file then new session, flush stops at an unpublished slot,
  unknown session version rejected. Trailing whitespace fixed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-26 00:07:37 +01:00
b83ae01f5c Build pipelines through main's PipelineCompiles path again, not #2098's pre-pass
At the maintainers' decision, main's compile path wins over #2098's second one. #2098 made every lazy PSO
asynchronous (async_build = true) and built what a submission needs in a pre-pass of VulkanQueue::execute, one
pipeline after another on the submitting thread, with a per-variant state machine (replay_get / replay_await) and a
wait budget (LEONIDA_PIPELINE_WAIT_MS, LEONIDA_PIPELINE_WAIT_FRAME_MS). That bypassed PipelineCompiles and
PipelineWorkers (parallel compiles with resource_mutex_ released, #1742) and the LargeModuleGate budget (#1889), which
d3d12_pipeline_workers(_eager) and d3d12_big_compute_* check.

Removed: the pre-pass (collect_pipeline_awaits, await_pipelines, PipelineAwait, ComputePipeline/GraphicsPipeline::
await), PipelineState's Build states, replay_get/replay_await, set_pipeline_build_hook, the wait budget and its 10 s
line, and d3d12_pipeline_wait_test, which tested only that. PipelineState is wired as on main again: async_build =
LEONIDA_ASYNC_PIPELINES, queue_build for asynchronous builds, build_compute / variant through PipelineCompiles
otherwise.

Kept from #2098, adapted to main's path:
- the record-time build request (request_pipeline_build): queue_build without counting a skip;
- compile-helper deferral: a compute build the helper is still making publishes nothing, so its next use asks again;
- big warm-ups left to their first use while the title submits (LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES):
  src/pipeline_wait.h keeps only the last-submission time this reads, noted by VulkanQueue::execute.
docs/d3d12_vulkan.md, "Pipelines still being built", says what is left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:05:25 -05:00
ffcfe68f12 Merge pull request #2137 from Snooozs/dev-overlay
runtime: LEONIDA_DEV_OVERLAY shows what the runtime is doing over the title's window (RT-DEV-OVERLAY)
2026-11-26 00:02:32 +01:00
cdbbb39554 Merge remote-tracking branch 'origin/main' into feat/pipeline-order-recorder 2026-11-26 00:02:32 +01:00
a26e9ad686 gpu-test-results: re-run the three Linux GPUs at main 5fab93967 (GPU-7900XTX-ARL-5060L-LINUX) 2026-11-25 23:02:27 +00:00
a0723a9e92 Merge pull request #671 from aslan2142/frame-pacer-bounded-queue
OLD-9189: restore old upstream PR 9189 - FramePacer: at most `latency` frames in flight while armed (mailbox replace)
2026-11-26 00:01:37 +01:00
8564bb48bb Merge pull request #688 from aslan2142/game-rmdir-create-race
OLD-9215: restore old upstream PR 9215 - file_system: RemoveDirectory and a create inside the folder are ordered as on the host
2026-11-26 00:00:45 +01:00
340e8a415c Merge pull request #638 from aslan2142/skip-int3-wine
OLD-7824: restore old upstream PR 7824 - startup_trace: LEONIDA_SKIP_INT3 works on title threads and with Wine's breakpoint address
2026-11-25 23:59:09 +01:00
92170fe7af d3d12: remap directly-indexed heaps to arena shader VA (RT-DIRECT-HEAP-ARENA-REMAP)
In write_direct_heaps(), the bound resource and sampler heaps were passed using raw cbv_srv_uav_base_ and sampler_base_. For console descriptor heaps shadowed in the GPU address arena, this supplied the title's host console VA rather than the shader VA where GPU descriptor reads land, triggering GPU device loss (READ_INVALID) in compute/graphics passes during world transition.

Remap the bound bases through console_descriptor_table_va() before writing them to user SGPRs and tracking in remember_table() and graphics_user_data(). Update d3d12_set_descriptor_heaps_test to assert that recorded dispatch user data receives the remapped console_descriptor_table_va addresses.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-26 01:58:24 +03:00
696d70da19 Merge pull request #677 from aslan2142/root-sig-flag-mask
OLD-7234: restore old upstream PR 7234 - d3d12_xs: pin that the root-signature flag mask keeps every public flag (old upstream PR 7140)
2026-11-25 23:58:18 +01:00
a449806dcf rdna2spirv: take a v_fma_mix literal from the printed encoding when only the text is cut (SHADER-FMA-MIX-TEXT-CUT-LITERAL)
llvm-mc 21.1.8 can print a v_fma_mix* literal cut to its low 16 bits in the text while the printed encoding keeps
all 32 bits. The printed-encoding check then passes, so mix_literal (for a cut encoding) never runs and the text
alone reads the high half as +0.0. restore_text_cut_mix_literal takes the literal from the printed encoding, on the
clean and the re-anchoring paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwRYcpySx4P4ncQ3wD5
2026-11-25 23:57:23 +01:00
d34c426ef9 Merge pull request #684 from aslan2142/t-drive-overlay
OLD-8161: restore old upstream PR 8161 - file_system: T: is a folder of each process's own in the overlay
2026-11-25 23:56:38 +01:00
82489afecf translator: cap loop iterations per entry (--loop-limit), from VIctory
A loop over data the host has not mirrored yet reads zeros and can run
billions of times; VIctory lost the GPU that way and caps every loop at
128 passes in a pixel shader, 256 in a vertex, geometry or mesh shader and
4096 in a compute shader (victory lower.rs LOOP_LIMIT and count_iteration,
commit 15b0091e8; the per-stage values from 570a941e9). Leonida had no cap.

cfg_structure.loop_counters finds the loops of any graph: each strongly
connected region left after the counted edges of the loops around it are
removed, its counted edges the ones into its entries (the back edges of a
natural loop), its resets the blocks outside with an edge in. Every cycle
has a counted edge, so every loop ends. rdna2spirv keeps one Function
variable per loop; every lane of a wave runs the same blocks, so the lanes'
counters agree (one counter per wave). At the cap a branch back takes its
other way out, and a block with no other way leaves the program: %pc = the
end and %done, and a pixel is discarded at the end (%lc_kill, after the
POPS interlock like every exit). A wave that leaves early is counted done
by the barrier rounds and the wave64 emulation rounds, so it holds no
barrier; under --wave64-emulate such blocks count as an early s_endpgm for
plan_structured_emulation and stay out of lane-local folds.

--loop-limit PS,VS,CS sets the limits (or one N; 0 = no cap, and the output
is byte-identical to before: all 102 fixtures, with and without
--wave64-emulate). index.json records loop_limit and capped_loops for every
module with a loop. Contract row "Loop iteration cap" in docs/design.md.

Tests: tests/semantic/test_loop_limit.py with the hand-written fixtures
loop_limit_back.asm, loop_limit_jump.asm and loop_limit_barrier.asm (the
exported count, the discard at the cap, the dispatch-loop form, the vertex
cap, and a two-wave compute shader whose second wave never leaves its loop
while the first passes s_barrier, in native wave32 barrier rounds and under
--wave64-emulate with one and two waves); tests/test_cfg_structure.py
checks loop_counters on 6,000 random graphs. Not GPU-verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:56:20 -05:00
b145659304 Merge remote-tracking branch 'origin/main' into fix/explicit-lod-bias-moltenvk
# Conflicts:
#	tools/vk_subgroup_info.py
2026-11-25 23:54:57 +01:00
722fee9af6 Merge main into delay-import-thread-order-notes (#643)
#634 rewrote the same runtime/README.md paragraph on the loader. Its text
stays, and its relocation sentence takes this PR's wording: DIR64 and
HIGHLOW relocations, the other types rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:54:12 -05:00
7a4d1f7721 runtime: record the order of first pipeline requests behind LEONIDA_PIPELINE_ORDER_LOG=1
RT-PIPELINE-PREWARM-ORDER phase 1. With the variable set to 1 the D3D12 device
appends, per compute, graphics and mesh pipeline and variant that the title
uses for the first time, one line to pipeline_order.log beside
pipeline_cache.session.bin: the description key, the variant, creation and
first-use times since the process started, the build time and whether the
handle was ready. One line of counts at exit. Off by default: nothing reads the
file yet, and a run without the variable carries no hook. It touches no cache
file, the memory gate or the compile queue.

The mesh pipeline's key folds in the MS hash (the graphics key does not cover
it). Documented in runtime/README.md and docs/d3d12_vulkan.md, and the doc test
checks the variable is read and named in both.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 23:47:38 +01:00
5f8475d7fb docs: shader stage on this machine (26,503 of 26,503 translated and valid)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 17:46:14 -05:00