Repository navigation
d3d12: LEONIDA_ASYNC_MIN_BYTES, only large pipelines asynchronous (RT-ASYNC-LARGE-ONLY) - #2440
Conversation
…-ASYNC-LARGE-ONLY) With LEONIDA_ASYNC_PIPELINES=1 every pipeline not built yet has its draws and dispatches skipped, the small lighting and post programs too, so the world phase stays black while anything compiles; with it off a submission waits minutes for each large ray-tracing compute program. LEONIDA_ASYNC_MIN_BYTES=<n> (with async on): a pipeline under n bytes of SPIR-V (compute: its module; graphics: all its stages) takes the path of async off: no record-time request, PipelineCompiles builds it at prepare, and a compile-helper build waits for its file. One of n bytes or more stays asynchronous. Decided once per pipeline at create (async_build). Unset, 0 or not a number: every pipeline asynchronous, as before. Tests: async_pipeline_size_test (parsing and decision); d3d12_m4_compute --async-small-waits (both pipelines under the threshold, compile worker held: no job reaches it and every word matches). Docs: runtime/README.md row, docs/d3d12_vulkan.md, docs/running.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
First retail result with this PR (RTX 4070 Laptop 8 GB, NVIDIA 621.40, Windows 11). Build:
|
|
Repeat, same build and recipe: the opening scene renders again, from about 9 min in, and stays up to the end of the 20-minute run, with no device loss. Peak private bytes were 52 GB. |
|
Threshold comparison, same build and recipe, 20 min each, world drawn in both:
On this 8 GB laptop, 1 MiB looks better: shorter stalls when a mid-size pipeline is built in place, and less host memory. The frame rate is the same, because that comes from per-submission costs ( |
|
Independently checked head Local build & dual-GPU verification:
Code review notes:
Overall looks sound and clean. AI-assisted. |
|
Merging.
Thanks @OreoFR. AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2) |
|
Profile M data point for With this setting, the library precompiled ( |
|
CORRECTION to my comment above: "No draw or dispatch was lost to a pending build in a way that kept the screen black" is not measured: I did not count draws or dispatches skipped while their pipelines were pending. MEASURED is only that the screen was not black in gameplay (near-white, mean RGB 252-254 in the captures). Nothing else in that comment changes. AI-assisted (Claude Code) |
Claimed in the coordination issue as: RT-ASYNC-LARGE-ONLY
What and why
LEONIDA_ASYNC_PIPELINESis all or nothing (runtime/shims/d3d12_pipeline_compile.h). On an RTX 4070 Laptop (NVIDIA 621.40), retail, wave64-emulated pack:=1: the world phase is reached but the screen stays black. Every draw or dispatch whose pipeline is not built yet is skipped, including the small lighting and post programs. The Linux/Proton NVIDIA report indocs/running.mdsays the same.=0: a submission waits for each of the ~700 ray-tracing compute programs (2-26 MB of SPIR-V, 2-3 minutes each in the driver). We measured 17 builds in 30 minutes, so the world start would take hours.This adds
LEONIDA_ASYNC_MIN_BYTES=<n>, used withLEONIDA_ASYNC_PIPELINES=1:PipelineCompilesbuilds it at prepare, and a compile-helper build waits for its file.async_build. The decision lives inruntime/src/async_pipeline_size.h, which is pure stdlib.0, or text that isn't a decimal number (logged): every pipeline is asynchronous. The code path is the same as today.What changed in
d3d12_vulkan_device.cpp:graphics_.async_buildandpipeline_.async_buildtake the size into account.build_compute, the worker's publication inqueue_build, andrequest_early.Graphics follows the same threshold, measured by the total size of all its stages. The NVIDIA report's black stretch was graphics pipelines of 1-2.6 MB compiling one at a time, so a threshold above that leaves them blocking as with
=0, and one below makes them asynchronous.Not changed: a large asynchronous build still goes through the compile gate and
LargeModuleGate, so a mid-size build that a submission waits for can queue behind it there. The docs paragraph says so.Tested
async_pipeline_size_test(new): parsing (unset, empty, 0, max, overflow, suffixes, signs, spaces, hex) and the decision (off, on with no threshold, below/at/above 2 MiB, 1 byte, 2^64-1).d3d12_m4_compute --async-small-waits(new ctestd3d12_m4_compute_async_small_waits): async on, threshold over both modules, warm-up off, and every compile-worker job held by a job probe until the results are read. Both dispatches must run in place (all words match) and no build may reach the worker.LEONIDA_ASYNC_MIN_BYTES=0forced into the test, a build went to the compile worker.LEONIDA_ASYNC_MIN_BYTESunset,1,2097152and1073741824:d3d12_compile_teardown,d3d12_m4_compute,d3d12_m4_compute --async-small-waitsandd3d12_m4_compute --check-async-journal(withLEONIDA_ASYNC_PIPELINES=1). All pass.=2MiBlogs that it is ignored.ctest(RelWithDebInfo, Ninja, MSVC): 490 of 492 pass.xbox_presentandd3d12_set_descriptor_heapsalso fail on plainmaind1dff7949on this machine (both rebuilt frommainand rerun).tests/test_docs_*.pypass.scripts/check_no_game_data.pyis clean on every changed file.LEONIDA_ASYNC_PIPELINES=1 LEONIDA_ASYNC_MIN_BYTES=2097152; the result will be posted in Coordinating who works on what (continued from #14) #1608.GPUs tested: NVIDIA GeForce RTX 4070 Laptop 8 GB, driver 621.40, Windows 11.
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: runtime only)🤖 Generated with Claude Code