Skip to content

Improve post-load GPU memory and pipeline handling (RT-POST-LOAD-GPU-MEMORY) - #2098

Merged
aslan2142 merged 12 commits into
ProjectLeonida:mainfrom
Moriz82:pr/upstream-1125
Nov 26, 2026
Merged

aslan2142 merged 12 commits into
ProjectLeonida:mainfrom
Moriz82:pr/upstream-1125

Conversation

@Moriz82

@Moriz82 Moriz82 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

This draft follows #1723. When the shared Vulkan buffer arena fills, an eligible committed buffer can now use a dedicated allocation. An earlier Proton run stopped during upscaler initialization when no arena slice fit the requested buffer.

Claimed as RT-POST-LOAD-GPU-MEMORY. Coordination issue

Changes

  • Update console heap descriptors on the GPU, track invalidated backing ranges, and retain upstream's host-side bitset for live buffer descriptors.
  • Journal completed pipeline cache entries, move eligible compilation work off the submission thread, and reuse compute shader seeds across runs.
  • Replay indirect mesh records through the GPU clamp. Record the original mesh dimensions before clamping and clear the counters when a readback slot is reused.
  • Preserve scripted button presses until the title reads them. Update translator handling for buffer offsets, image views, and wave64 control flow.

Independent review work overlaps the fixed-count and counted indirect mesh paths and pipeline compile workers. Fixed-count mesh dispatches · Count-buffer mesh dispatches · Pipeline compile workers

Verification

Build Result
Public rebase on db1a22d29, Linux 6,327 translator tests across 493 files, zero failing files. The descriptor-cache check passed. The compute pipeline suite ran four tests with one skip.
Public rebase, Windows x64 cross-build Release gta6rt.exe and gta6rt_tls_host.dll linked on Linux with clang-cl and the Windows SDK.
Public rebase, SPIR-V Both embedded runtime compute shaders passed Vulkan 1.2 validation. The regression for the mesh counter instructions passed.
Public rebase, repository checks Tracked-file game-data scan, forbidden extension check, added-content secret scan, and whitespace check passed.
Source integration, Linux and Proton 6,303 translator tests across 491 files, zero failing files. All 12 focused runtime suites passed, including the compute allocation fallback and pipeline cache journal.
Earlier allocation-fix build, Proton Loading ended at 170 seconds. The title frame counter advanced from 2,369 at 300 seconds to 2,830 at 600 seconds. The run recorded zero upscaler exceptions. Whether it exercised the dedicated fallback is unknown.

The public commit still needs a title boot. Native Windows and playable world rendering remain unverified.

GPU used for the source integration was an NVIDIA GeForce RTX 4070 on Linux under Proton. Public-head runtime checks are in progress.

Contributors include Plaaasma and ivanepsilondelta. AI-assisted.

…MEMORY)

Fall back to a dedicated buffer allocation when the shared arena fills.
Update console descriptors and resource backing, preserve pipeline cache
entries, and replay mesh records using bounded indirect arguments. Keep
scripted input available until read and cover the runtime and translator
paths with synthetic tests.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-authored-by: ivanepsilondelta <264061546+ivanepsilondelta@users.noreply.github.com>
@Snooozs

Snooozs commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Native Windows boot of this draft (9f98dcc61), one run. Counts only, no game data.

Machine: Windows 10 19045, RTX 5060 Ti 16 GB, NVIDIA 621.01, 32 GB RAM, own 1.0.2.1, MSVC RelWithDebInfo (builds clean). Shaders from my work folder (47,772 loaded, 0 refused), cold pipeline cache, LEONIDA_ARENA_MB=2048 LEONIDA_TITLE_WINDOWS_MB=1024 LEONIDA_DEVICE_TYPE=6 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_MEM_PROBE=20, no other change. Run time 431 s, ended by me. No device loss, no driver error in the event log.

Reached: the loading screens and the world start. Then it stops the same way as my runs without it: the last submission is number 2,216 at t=217 s, list values stays at 7,685 recorded / 7,528 landed (157 pending), 14 gates held, 0 met, 14 timed out (9 of them at the short timeout), while the process sits idle except for one pipeline build thread. So the draft does not cause the stall and does not remove it, on this machine (RT-LIST-VALUES-STALL-SNAPSHOT, tiguan26, is the one to watch). 825 compute and 54 graphics pipelines were made, 141.6 s and 65.2 s in vkCreate*Pipelines; indirect draws: 9,446 recorded, 512 emitted.

What it does save, against my earlier runs:

this draft my runs on main + DadaCap's mesh branch + #1592 + #1896 + #1889 + #1914
lowest free RAM in the run 8.0 GB (world start, 431 s) 2.1 to 3.5 GB (n25, n27 to n33)
peak commit of the system 42.7 GB 51 to 68 GB
longest heaps phase of a submission 88 ms up to 2.6 s without #1887 (n21: 3.6 s); 0.03 s with it (n22) while loading

Not a clean comparison: the runs differ in much (geometry copies, a 1.1 to 1.6 GB heavy pipeline cache in most of mine, host copies). One thing stands out either way: LEONIDA_MEM_PROBE says pipeline cache 0 MiB here, where mine held a 1.1 to 1.6 GB cache in memory, and the journal of this run was 791 files, 1.6 MB.

The loading was slow here: 1 to 4 frames/s from 20 to 60 s, because the cache was cold. Is there anything you want measured with a warm journal or a switch (LEONIDA_COMPILE_HELPER=1, LEONIDA_ASYNC_PIPELINES=1)? I can run it. What I would watch for: whether the helper lowers the RAM peak further.

A question on the stall, since your title frame counter advanced to 2,830 at 600 s under Proton: did list values ... recorded / landed keep moving there, and what are your last counters?

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

@TheGeogeo

TheGeogeo commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Overlap with #1889 (RT-BIG-COMPUTE-BUDGET), so that neither of us finds out at the merge. Read from the code of 9f98dcc and from trial merges; I have not built or run this pull request. I do not have the game, so I cannot test on it directly: what I check is the project's own tests and synthetic modules.

AI-assisted (Claude Code).

@OreoFR

OreoFR commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

A note on the async texture refresh (LEONIDA_TEXTURE_REFRESH_ASYNC), from working on the same pass (RT-TITLE-EVERY-BUDGET): with async on, the submission only calls request_title_refresh(), so a mapped texture that has never been filled can be sampled empty by its first draw (a video plane, for example). In my local async branch I fill only those textures (mapped && !fills) synchronously in the before-execute hook, with try_to_lock on the registry and no wait if the worker holds it (waiting could deadlock on a fill that needs this queue), then wake the worker for everything else. It only visits textures that have never been filled. Untested on your branch, just a suggestion. Our two PRs also touch the same loop in refresh_title_textures; whichever lands second rebases.

aslan2142 and others added 11 commits November 25, 2026 17:21
main d3b8251 brings #1889 (large compiles within a memory budget), #1987 (unbound T# reasons), #1759, #1860
and others under this branch. Conflicts:

- d3d12_vulkan_device.cpp, includes: both (pipeline_cache_journal.h and large_module_gate.h).
- d3d12_vulkan_device.cpp, fix_console_slot's T# branch: main's form (counts refused_reasons, #1987), with this
  branch's comment on why a slot that is no T# is nulled. The same reason count is added to console_tsharp_check,
  the GPU console-heap path's T# registration, so its log line has the reasons too.
- d3d12_vulkan_device.cpp, the heap log: both blocks (the release filter / GPU heap lines and main's "unbound T#s by
  reason" line).
- d3d12_vulkan_device.cpp, PipelineState::build_compute: this branch's body (build_compute_pipeline, journal, compile
  helper) behind main's entry: the `Work` argument and enter_build, so a large module takes its place at
  big_compile_gate() before variants_mutex_, as #1889 requires (a thread that waits for memory holds no PSO lock).
  build_compute_pipeline's own big_compile mutex now follows main's BigCompiles: taken only with
  LEONIDA_SERIAL_BIG_COMPILES=1 (it was on by default here), so the default is main's budget, not one at a time.
- d3d12_vulkan_device.cpp, queue_locked: this branch's Build-state jobs (claim, defer, finish). main's
  `requested_`/`publication` mechanism they replace is not kept. build_variant passes Work::speculative for a
  "warmup" build and Work::demand otherwise, as main's queue_build did.
- vulkan_replay.h, ComputePipeline: main's comment on `large`, and this branch's `await`.
- vulkan_backend.h: this branch's LEONIDA_SUBMIT_ASYNC block, with main's lock order in the state_mutex_ comment
  (state_mutex_ -> pipeline_mutex_ -> resource_mutex_ -> tracker_mutex_ -> submit_mutex_).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found building #2098 with clang-cl (Make generator); each also fails on the pull request's own head:

- dxgi_swapchain_count_test: VulkanSwapchain takes a SubmitMutex& now; the test passed a std::mutex.
- vk_store_test: kind_sampled_bit/kind_storage_bit come from descriptor_table.h, which it did not include.
- d3d12_compute_journal_test listed gta6rt_indirect_count_shader's output among its sources, so Make had two rules
  for cs_indirect_dispatch_count.spv and the two glslangValidator runs raced ("Failed to open file"). It depends on
  that target now, and the second shader has a target of its own.
- tests/semantic/test_tsharp_dimension.py began with a UTF-8 BOM, which test_ci_registration's ast.parse refuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tests/test_docs_env_vars.py failed: LEONIDA_TEXTURE_REFRESH_ASYNC, LEONIDA_SUBMIT_ASYNC, the LEONIDA_CONSOLE_HEAP_GPU
family, the shadow GPU copies and the diagnostics this branch reads were in no document. One row each in "Switches of
the D3D12 layer for a retail boot", from the comments at the code that reads them.

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

OreoFR's point on #2098 holds: with LEONIDA_TEXTURE_REFRESH_ASYNC=1 the before-execute hook only wakes the refresh
worker (request_title_refresh), so a slot-133 texture the title maps, writes and uses in its next submission (a video
plane) can be read empty by that submission while the worker has not come to it.

The hook now first fills, on the submitting thread, the mapped textures that were never filled (mapped && !fills),
with try_to_lock on the registry: the worker may hold it for a fill that needs this queue, so it does not wait. A
fill that needs generic staging is left to the worker, as the pass does. Everything else stays on the worker.

Test: d3d12_mapped_plane_async (d3d12_existing_heap_test --mapped-plane-async, which sets the switch itself) maps a
written R8 plane and copies it to a readback buffer in the first submission, with host image copies and with the
staged upload; every byte must be the written one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…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>
#2098's scan_title_table nulls a table V# whose base nothing backs (rebase_title_vsharp's `unbacked`). A V# the
layer wrote itself for one of its own buffers that the driver put below the arena holds the low 48 bits of a negative
offset, which the shaders read sign-extended (vsharp_address accepts it). On the RDNA2 iGPU, upload buffers live in
ReBAR memory below the arena, so the scan took such a V# for an unbacked title address and nulled it before the
dispatch read it: d3d12_compute, d3d12_fspx_compute, d3d12_unmapped_vsharp, d3d12_graphics_indirect_heap_resources
and d3d12_compile_teardown failed there and passed on lavapipe, where the buffers sit above the arena.

rebase_title_vsharp now leaves a base with bit 47 set alone when its sign-extended offset is one of the layer's
backings (gpu_backings), as vsharp_address reads it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's warm-up test has the warm-up thread build every compute module after a submission. Its 132 KiB modules are over
#2098's LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES (128 KiB by default), which leaves big warm-ups to their first use while
the title submits, so four of them were never started and the test's "each once" check failed. The limit is a
separate feature from the gate order the test checks; it is set to 0 for this test only.

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

#2098 added a check that XGCreateTextureComputer refuses a render target with no layout mode (E_NOTIMPL). On main the
second (general) layout model lays out the render targets xg_xs_layout.h does not, and xg_xs_test already expects
S_OK for those ("the other render targets still use the general layout model"). The check now says the same for this
one: the explicit-mode model refuses it and the general model makes the computer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#2098's 2D mirror of a 2D-array image (BindlessSet::MirrorViews) copies storage_info, pNext chain and all, after the
block that made the storage view. That chain (VkImageViewUsageCreateInfo, VkImageViewSlicedCreateInfoEXT) was declared
inside the block, so the mirror's vkCreateImageView followed a dangling pointer into stale stack; winevulkan walked it
without end. That was the 120 s hang of d3d12_existing_heap (and its two variants), d3d12_r9g9b9e5_uav,
d3d12_depth_stencil_uav, xbox_depth_storage and xbox_d16s8_storage on lavapipe and the iGPU alike: each makes a UAV
of a 2D-array (or cube) texture. The two structs are declared before the block now.

Found with a winedbg backtrace of the hung test (bind_image_views_locked's make_mirror lambda, line 6604), then
confirmed by disabling the mirror in a scratch tree: all six tests pass then too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
…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 fb60a1c: 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>
@aslan2142
aslan2142 merged commit c50ed94 into ProjectLeonida:main Nov 26, 2026
2 of 5 checks passed
@aslan2142

Copy link
Copy Markdown
Collaborator

Merged, thanks, @Moriz82, for the post-load memory and pipeline work, and to Snooozs, TheGeogeo and OreoFR for the boot run, the #1889 overlap map and the async-refresh catch.

  • Pipeline path: pipelines build through main's PipelineCompiles/PipelineWorkers path within the d3d12: large pipelines compile side by side within a memory budget (RT-BIG-COMPUTE-BUDGET) #1889 budget again; the pre-pass is gone, at the maintainers' decision. The record-time build request and the compile-helper deferral are kept on top of it.
  • Fixes we made: a dangling pNext chain in the 2D mirror view (the 120 s hangs in d3d12_existing_heap, d3d12_r9g9b9e5_uav, d3d12_depth_stencil_uav and the Xbox depth-storage tests); the table scan no longer nulls V#s of the layer's own upload buffers below the arena (the iGPU compute failures); three test targets that did not build, a byte-order mark, and an xg_xs check that contradicted main.
  • Async refresh: a mapped texture that was never filled is filled before its first submission (OreoFR's point), with d3d12_mapped_plane_async, which fails 3 of 3 runs without the fix.
  • Switches: LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTES is opt-in (0 by default, so main's warm-up stays as it was), and 30 switches are documented.
  • Tested: the full Windows suite under Wine on llvmpipe and the gfx1036 iGPU (RADV), on main 33bd07cf8 merged with this: no pass to fail from this PR. d3d12_set_descriptor_heaps fails on main alone too, and xmem and xbox_present pass alone on llvmpipe (xbox_present fails on the iGPU with or without this PR). The translator suite passes (495 files, 6,333 tests).
  • For later: the new vk_presenter_sparse_capture fails under Wine, where creating its temp folder with an owner-rights access rule fails.
  • Checked on main 33bd07cf8 + fc7153488: it merges cleanly; the semantic suite passes (495 files, 6,333 tests, 0 files failed); the 15 docs and writer tests pass; check_no_game_data.py is clean on the 113 changed files.

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

aslan2142 added a commit to OreoFR/leonida that referenced this pull request Nov 26, 2026
ProjectLeonida#2098 split the every-pass loop of refresh_title_textures by mode: with
LEONIDA_TEXTURE_REFRESH_ASYNC every persistent mapping is polled each
pass and only stale unmapped textures are visited, without it all mapped
or stale ones are. The async branch is kept as main has it.
LEONIDA_TITLE_EVERY_BUDGET_US applies to the synchronous pass, the one
before a submission on the submitting thread; under async the pass runs
on the refresh worker and the limit does not apply (README says so).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 added a commit to ytsodacan/leonida that referenced this pull request Nov 26, 2026
…jectLeonida#1561 review)

- test_tool_stdout_encoding: three scripts merged since this PR opened
  (check_compute_journal_overlay.py and compute_workers_win.py with ProjectLeonida#2098,
  corpus_watch.py with ProjectLeonida#817) get the same stdout guard as the tools here.
- test_runtime_paths: the runtime workflow's two path filters now include
  tools/conformance/**, which runtime/CMakeLists.txt names. The change is
  ProjectLeonida#1673's (xel1uz), carried here since ProjectLeonida#1673 duplicates this PR.

With it, test_tool_stdout_encoding, test_runner_calls_all_tests and
test_runtime_paths all pass on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
klikso added a commit to klikso/leonida that referenced this pull request Nov 26, 2026
ProjectLeonida#2098 gave the SDL path its own loop (held 300 ms, then until the title
has read the pads six times, at most 5 s), which ignored button@seconds:hold.
A press now lasts its own hold, then the read latch, and never past 5 s or
its hold if longer. The long-script test checks both: X kept past 300 ms
until six reads, Y kept for its 0.6 s after them. It fails on the old loop.

Found by AndreiKocherzhinskiiA on ProjectLeonida#1608.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kokonotcu added a commit to Kokonotcu/leonida that referenced this pull request Nov 26, 2026
16 upstream commits after 33bd07c, mostly ProjectLeonida#2098 (post-load GPU memory and pipeline handling) and ProjectLeonida#2122 (the
title-texture pass time box). The rules of the earlier merges stand; what this one decided:

ProjectLeonida#2098
- GPU console-heap fix (console_heap_gpu.h, console_heap_fix.comp/.inc): taken, opt-in (LEONIDA_CONSOLE_HEAP_GPU,
  with LEONIDA_CONSOLE_HEAP_VA for the console-addressed heap). Our CPU title-heap sync with the dirty-page watch
  stays the default: the pass fixes descriptors of a heap at console VAs, and ours reaches title VAs through the page
  table, so in our default layout it has nothing to do.
- Pipeline cache journal and compile helper (pipeline_cache_journal.h, d3d12_compile_helper.h): built, and
  main.cpp has their precompile/compile-server commands beside ours; our pipeline states do not feed them (as upstream
  itself went back to PipelineCompiles over the pre-pass, b83ae01). Our per-GPU cache with checkpoints stays.
- Post-load memory: the opt-in switches and the stream-queue GPU-only reservation (with our gpu_only_protect) are
  taken. Not taken: the dedicated-buffer fallback when the arena is full (a VA past the arena is a page-table title
  VA here; ours answers E_OUTOFMEMORY, d3d12_compute's no_slice case adapted) and LEONIDA_TITLE_HEAP on by default
  (it conflicts with our 40-bit 64 KiB blocks; it stays opt-in).
- Taken: the compile gate (SubmitMutex/SubmitTurn around vkQueueSubmit, vkQueueWaitIdle and the present submit; our
  compute creates through DriverTurn), async submit with synchronous staging queues and held failures picked up in
  execute_lists, the prelude pass (wired into our execute_lists and teardown), depth bounds (dynamic state in our
  PSO recipe, draw capture and replay; DepthBoundsTestSupported from the device feature), the descriptor-table kind
  word (our insert_key keeps its try/catch), the fsdraw backing hook. request_pipeline_build is a no-op for our PSOs.

Others
- ProjectLeonida#2122 title-texture refresh, async and time-boxed: taken (on TitleViewTexture).
- Indirect mesh draws: taken; our raster-indirect clamp passes the mesh record kind, and a mesh indirect draw is let
  through when the device asks for the clamp (vk.require_indirect_clamp). Upstream's second clamp call before a
  stateful indirect draw is dropped: ours runs with the other helper passes, outside rendering.
- rdna2spirv: upstream's `fits` check and our `small_index` check, both.
- Restored: five lines of our IndirectRasterDraw clamp branch git had dropped outside the hunk (every heavily changed
  file was checked for such losses).

Fixes for new failures
- vulkan_present.h: read_back returns the frame whose copy was submitted again (9f98dcc made it wait for a shown
  present, so a resize with an out-of-date swapchain read nothing); only the disk sample needs a shown frame.
- d3d12_indirect_rt(+_upload_sysmem): the new replay part takes vulkan_buffer_range() (upload and readback buffers are
  arena ranges here) and sets require_indirect_clamp. gameinput_script: reads the pad 6 times before the sleep, as
  9f98dcc's held-press rule needs.

Tests (runtime\build, 502): 491 pass. Not passing: the known ones (d3d12_clear, run_startup_cmdline,
run_tiny_game_eh; d3d12_xdxr_rt(+_check), d3d12_existing_heap (x3), xbox_linear_texture_map; d3d12_set_descriptor_heaps),
and d3d12_mapped_plane_async, ProjectLeonida#2122's async twin of the persistent slot-133 plane case that d3d12_existing_heap
already fails (the texture does not take its mapped pages' bytes), to fix together with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 pushed a commit that referenced this pull request Nov 26, 2026
#2098 made the tagged descriptor probe return (index, kind) as %desc_hit. The branch evaluator still modelled every %desc_lookup_fn call as the bare integer index, so extracting the kind component indexed an int and seven tests errored.\n\nModel a sampled-only hit as the composite the translator now emits: every sampled-dimension bit set, no storage-array bit. A miss remains index zero.\n\nVerification under the machine lock:\n- python -m compileall -q tests/test_image_load_typed.py tools/rdna2spirv.py\n- origin/main copy of tests/test_image_load_typed.py: 28 run, 7 errors (TypeError: 'int' object is not subscriptable)\n- patched tests/test_image_load_typed.py: 28 run, OK\n\nAI-assisted (Devin).
Tauwni added a commit to Tauwni/leonida that referenced this pull request Nov 26, 2026
…xture sits in

Since ProjectLeonida#2098 (merged in from main) a tagged module reads its instruction's array only when the entry's kind names
it; with the 2D bit alone, ps_ssharp_cube and ps_ssharp_3d read the magenta fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 pushed a commit that referenced this pull request Nov 26, 2026
… (TEST-GAMEINPUT-SCRIPT-READS)

Since #2098 a scripted press lasts its 300 ms and then until the title has made
six GetCurrentReading calls since it began. gameinput_test --input-script still
expected the press to be over after 350 ms and three reads, so ctest
gameinput_script failed on main in every build with SDL3 (it is disabled
without SDL3, so CI did not show it).

The test now checks that the press is still held at that point, reads the pad
six more times and then expects the release. Test only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
aslan2142 pushed a commit that referenced this pull request Nov 26, 2026
… (2D and 2D array)

Since #2098 a tagged module reads its instruction's array only when the table entry's kind names it. The harness
binds index 1 in images[1] (binding 0) and in the 2D-array images[1] (binding 3), but tagged it 2D only (2D array
in cube mode), so ps_array_resinfo and ps_get_lod_array read the 1x1 fallback on every driver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 added a commit to qhukz13/leonida-continued that referenced this pull request Nov 26, 2026
Conflict in runtime/shims/d3d12_title_buffer_windows.h: main (ProjectLeonida#2098) added the
lock-free published_ block list (for_each_block, find_mapped); this branch
destroys empty blocks. Both are kept; a destroyed block's published_ entry is
cleared here, and the follow-up commits make that safe for the lock-free readers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 added a commit to qhukz13/leonida-continued that referenced this pull request Nov 26, 2026
ProjectLeonida#2098's TitleBufferWindows::published_ and update_gpu_backed assumed blocks are
never destroyed: for_each_block fed every block made so far into the console
heap pass's backed table, and the table was rebuilt only when the published
count grew. With empty blocks now destroyed, a freed block stayed in the table,
and its "never of memory that is not there" contract broke.

- A destroyed block's published_ slot keeps its other fields; only its address
  (now atomic) goes to 0, and for_each_block and find_mapped skip it. A slot is
  never reused before release(), so a lock-free reader never sees one half
  rewritten.
- layout_generation() changes whenever a block is made or destroyed;
  update_gpu_backed uses it instead of the block count to see a change.
- destroy_block tells the device (DeviceState::title_block_gone): the block's
  span goes into released_ranges, as a released backing's does, so the backed
  table cuts it at once and the key entries and heap slots answering into it go
  at the next refresh. A block is destroyed only once its last range was freed,
  after the GPU work that used it completed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aslan2142 added a commit to qhukz13/leonida-continued that referenced this pull request Nov 26, 2026
Since ProjectLeonida#2098 every TitleBufferWindows carries a 128 KiB published_ array, so the
eight GeometryViews this test puts on the stack pass the 1 MiB Windows default
and the test died at startup with a stack overflow. They are heap-allocated now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
klikso added a commit to klikso/leonida that referenced this pull request Nov 26, 2026
ProjectLeonida#2098 gave the SDL path its own loop (held 300 ms, then until the title
has read the pads six times, at most 5 s), which ignored button@seconds:hold.
A press now lasts its own hold, then the read latch, and never past 5 s or
its hold if longer. The long-script test checks both: X kept past 300 ms
until six reads, Y kept for its 0.6 s after them. It fails on the old loop.

Found by AndreiKocherzhinskiiA on ProjectLeonida#1608.

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

Copy link
Copy Markdown

RTX 3090 / 621.40: xbox_present fails the resize present_planes check (xbox_present_test.cpp:1226 on main). First bad is 9f98dcc; reverting only its captured_ gating in vulkan_present.h passes. After a resize recreate captured_ stays false, so read_back fails. LEONIDA_COMPILE_GATE=0 and the dxgi_swapchain.h hunk don't change the result.

aslan2142 pushed a commit that referenced this pull request Nov 27, 2026
…COMPILE-POOL)

With LEONIDA_ASYNC_PIPELINES=1 every demanded build, the compute warm-up and
the cache checkpoint ran on one general worker (plus a graphics-only one), so
one long driver compile held every pipeline a submission asked for behind it,
and their draws and dispatches were skipped meanwhile.

PipelineCompiler now runs LEONIDA_COMPILE_THREADS workers (half the logical
processors, 2 to 8). A worker takes the most urgent job it may:
- demanded builds first, in the order they came, then warm-ups by size, then
  the checkpoint, which waits until no worker compiles;
- large builds (compute over 128 KiB, graphics of 1 MiB or more) and warm-ups
  together take at most threads-1 workers, so one stays free for a small
  demanded build; at most LEONIDA_COMPILE_HEAVY_MAX large builds at once
  (default threads-1, 1 with LEONIDA_SERIAL_BIG_COMPILES=1), compute and
  graphics alike, each still within the memory gate;
- warm-ups run one at a time, and none starts while a demanded build runs:
  each holds the compile gate for its whole create, and a submission waits
  for every create in flight;
- one build of a PSO at a time, so after_running and the teardown rules hold.

LEONIDA_COMPILE_THREADS=1 keeps the layout before the pool. The design is
MoonEyes' (#2077), ported onto #2098's scheduler.

Tests: d3d12_compile_pool (CPU, jobs held at gates: settings, a long build
does not hold up a small demanded one, heavy count, free worker, warm-ups one
at a time and after demanded builds, order, one job per PSO, release/cancel/
stop_for_exit with jobs in flight), and d3d12_compile_teardown also with one
worker.

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

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants