Skip to content

d3d12_vulkan: bound concurrent compute-pipeline compiles by a host-memory budget (RT-5, A31 memory side) - #9082

Closed
beamdotdev wants to merge 4 commits into
ProjectLeonida:mainfrom
beamdotdev:beamdotdev/compute-compile-gate
Closed

beamdotdev wants to merge 4 commits into
ProjectLeonida:mainfrom
beamdotdev:beamdotdev/compute-compile-gate

Conversation

@beamdotdev

Copy link
Copy Markdown

Item: new RT item (RT-5 follow-up, A31's memory side), claimed in the coordination issue: #8868 (comment) (taking: in #7154: #7154 (comment)).

Depends on: none (applies to main).

Why

On a cold boot the retail title starts up to 11 compute-pipeline compiles of 1–9 MB of SPIR-V at once on its job threads (device slots 62/67). A large module takes about a kilobyte of host commit per byte of SPIR-V while the driver compiles it: 8.3–9.7 MB modules took 8–10 GB each on their own (Raavve, #8186 (comment)). Run together, they exhaust a 16–32 GB machine, and the driver fails compiles with VK_ERROR_UNKNOWN (measured: #7154 (comment)).

#2530 and #8001 bound the offline checker (vk_pipeline_check). This is the runtime's compile path; the two don't overlap.

What

  • runtime/src/compile_gate.h: a byte-budget gate. Each compile waits until its estimated weight fits in the budget.
    • Weight: 1 KiB per byte of SPIR-V, at least 64 MiB (the measured ratio for the 8–10 MB modules; smaller modules measured below it).
    • Budget: half of the free physical memory at the first compile, at least 2 GiB. LEONIDA_COMPILE_BUDGET_MIB=<MiB> overrides it; 0 turns the gate off.
    • A compile is always admitted when none is in flight, so a module heavier than the whole budget still compiles (alone) instead of waiting forever.
    • Waiters are admitted in arrival order, so a heavy compile isn't starved by a stream of light ones.
  • runtime/shims/d3d12_vulkan_device.cpp: the compute-pipeline path enters the gate around vkCreateComputePipelines. One gate per process. The first wait logs the budget once.
  • runtime/test/compile_gate_test.cpp (CTest compile_gate): budget parsing, weights, and the gate's rules (oversized-when-idle, concurrency bound, budget 0, arrival order, waited()), with threads and synthetic sizes. No GPU.
  • runtime/README.md: one paragraph on the gate and the variable.

Tested

Windows 11 (26200), MSVC 14.44 (VS 2022 Build Tools), RTX 3070 8 GB, NVIDIA 621.01, 32 GB RAM, Vulkan SDK 1.4.363.1.

without the gate with the gate
compiles that finished 26 25
VK_ERROR_UNKNOWN from vkCreateComputePipelines 3 0
D3D12 calls reached 62,878 64,355
time until the 90% commit watchdog 75 s 200 s

What this doesn't fix: the boot still reaches the watchdog on a 32 GB machine with a cold driver cache. The largest modules need 8–10 GB each even alone, and Raavve's ~16 and ~25 MB ones need more than such a machine has. Those need smaller modules or the pipeline cache (A31's other half, ASTROWwwW's claim). The gate keeps the driver from failing the rest under memory pressure, and gives the boot more room before the machine runs out.

No game data in this change or in the test.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…mory budget

The retail title starts up to 11 compute-pipeline compiles of 1-9 MB of SPIR-V at once on its job threads. A large
module can take about a kilobyte of host commit per byte of SPIR-V while the driver compiles it, so on a 16-32 GB
machine a cold boot runs out of commit and the driver fails compiles with VK_ERROR_UNKNOWN.

src/compile_gate.h adds a byte-budget gate: each compile waits until its estimated weight (1 KiB per byte of SPIR-V,
at least 64 MiB) fits in a budget of half the free physical memory (at least 2 GiB). A compile is always admitted
when none is in flight, waiters are admitted in arrival order, and LEONIDA_COMPILE_BUDGET_MIB overrides the budget
(0 turns the gate off). The Vulkan device enters the gate around vkCreateComputePipelines.

compile_gate_test checks the budget parsing, the weights and the gate's rules with threads and synthetic sizes.

AI-assisted.

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

@Grimkaaah Grimkaaah left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent Linux CPU review

What changed: d3d12_vulkan bounds concurrent compute-pipeline compiles by a host-memory budget (RT-5 / A31).

Checked: diff review of compile_gate.h + unit test (no local runtime build).

Looks correct; no game files.

@catminou4

Copy link
Copy Markdown
Contributor

Tested on Apple M1 Max, macOS 27.2.1 arm64: built compile_gate_test from this head natively → all checks passed (light compile waits behind heavy, FIFO admission, waited flag). No game files. AI-assisted (Devin).

@akimfomin

Copy link
Copy Markdown

Independent Windows CPU check of e85fc667 (portable LLVM/MinGW 23.1.6). The stock compile_gate_test passed 20 fresh runs, 16 assertions each.

One parser hardening suggestion before integration: enforce the unsigned MiB range before the byte conversion, and validate the entire input after its permitted whitespace. Missing, invalid and an explicit zero should stay distinct. The current parse and scale do not check representability in bytes. In a local candidate, an 11-case parser unit check and the original 16 stock assertions passed. The candidate preserves the documented default, explicit unlimited and ordinary positive configurations. CPU-only checks, no real memory pressure or game run. Current Forge main@d1149313 does not contain the gate yet. AI-assisted (Codex).

@Pipodi

Pipodi commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

tested: #9082 (e85fc66; its compile_gate.h and the compute-create ticket ported onto my boot stack) | on: Windows 11, MSVC 14.44, RTX 4090, NVIDIA 617.42, 32 GB, LEONIDA_D3D12=vulkan, own 1.0.2.1 copy | stack: main + #6982's boot-integration + #7759 #7218 #2490 #7685 and others listed in my #7759 report | runs: 150 s, with my runner stopping the process at 20 GB private commit (a guard for this 32 GB machine, not a driver failure)

run stops presents peak private
no gate 20 GB cap at about 30 s about 4,500 20 GB
#9082, default budget (about 18 GB free at the first compile, so about 9 GB) 20 GB cap at 32 s 7,000 20.2 GB
#9082, LEONIDA_COMPILE_BUDGET_MIB=4096 timeout (150 s) 66,500 19.5 GB
my local gate: same idea, 3/4 of available memory at 2 KiB per SPIR-V byte, compute and graphics timeout (150 s) 54,500 19.8 GB

No VK_ERROR or out-of-memory result in any run. Compute creates reach 800 to 1,100 per run, with up to 7 in the driver at once under the default budget.

The gate works here; at its defaults the estimate is too low for this driver. Compiling the four heaviest compute modules one at a time (vk_pipeline_check --jobs 1), they peak at 2.7, 1.0, 1.4 and 0.5 GB for 0.97, 3.44, 1.71 and 2.93 MB of SPIR-V. That is up to 2.8 KiB per byte, against the PR's 1 KiB. At 1 KiB per byte all four fit the default budget together, and with the smaller ones that is more than the process can take. Either weight 2 KiB per byte, or a budget of a quarter of the free memory, gives about the 4 GiB run above. In my own gate, 512 B per byte failed the same way and 2048 held.

The graphics side is not the problem on this GPU: the 51,795 eager graphics PSOs add about 7 GB before the fifth present and fit, so compute-only is enough here.

Counts only, no game files. AI-assisted (Claude Code).

@thehollowedone

Copy link
Copy Markdown

Independent runtime check of e85fc667 on Windows 11, RTX 3080 Ti (621.35), MSVC 19.44, and Vulkan SDK 1.4.363.

Three threads created distinct synthetic compute pipelines through D3D12. With a 1 MiB budget, the runtime logged a wait and admitted one call at a time to the Vulkan forwarding point. With the budget set to 0, all three calls reached that point together. Every call was forwarded to the real vkCreateComputePipelines and succeeded.

Each pipeline then dispatched and matched all 64 output words, for 192 per mode. All three modules passed spirv-val for Vulkan 1.3. Both runs had zero skips or Vulkan core or synchronization validation messages.

The temporary fixture measured admission to the Vulkan call. It used small shaders and did not measure internal driver concurrency, memory usage, or boot. Synthetic inputs only. AI-assisted.

@sodove

sodove commented Nov 23, 2026

Copy link
Copy Markdown

Tested e85fc66778 on Windows 11 Pro build 26100, MSVC 19.44.35220 Release, RTX 5070 Ti / NVIDIA 610.74, Vulkan loader 1.4.341. Clean test merge 1cb1e7682 on main 867d922f0. The runtime path worked, and I found an intermittent FIFO test failure.

  • Stock d3d12_m4_compute passed with the default budget, 64 MiB, and 0. A temporary variant of the synthetic fixture started eight threads together for each of eight rounds of real CreateComputePipelineState calls through the unmodified runtime. Three runs per budget each completed 64/64 creations and matched all 1,924 M4 readback words. The runtime logged a wait once per 64 MiB run and never logged a wait with the default budget or 0.
  • The stock compile_gate failed once in 58 runs. The sole failing assertion was waiters are admitted in arrival order; the preceding check that the light compile waited behind the heavy one passed. At runtime/test/compile_gate_test.cpp:84,92, both ranks are recorded after enter() returns. After the first ticket is released, the heavy ticket's 3 GiB and the light ticket's 1 GiB fit together. The gate can admit them in FIFO order and the light thread can still record its rank first.
  • In a scratch variant I used 2 GiB for the initial holder, 3 GiB for the heavy request, and 2 GiB for the light request under the same 4 GiB budget. The light request still fits beside the holder, so the head-of-line check remains meaningful. It cannot fit beside the heavy request, which removes the post-admission rank race. That variant passed 40/40.

Synthetic inputs only. The variants changed test fixtures locally. AI-assisted.

@SweatierKey

Copy link
Copy Markdown
Contributor

checked: #9082e85fc66 | with: main@867d922f0 + #9082 (fast-forward), ctest -R compile_gate, g++ -std=c++20 -O2 -Wall -Wextra -Wconversion -Werror -fsanitize=address,undefined -pthread runtime/test/compile_gate_test.cpp, python3 -I tests/test_docs_env_vars.py, python3 -m unittest tests/test_docs_repo_paths.py, python3 -I scripts/check_no_game_data.py | on: Linux x86-64, GCC C++20, CPU-only (Windows/Vulkan d3d12_vulkan_device.cpp path not run on this host) | result: portable compile_gate passes 16/16 (0 failures) under CTest and ASan/UBSan, doc audits pass (4/4 env vars, 3/3 repo paths), check_no_game_data.py exit 0; a few small edge-case findings in compile_gate.h and runtime/CMakeLists.txt below.

Findings (synthetic edge-case probes on runtime/src/compile_gate.h)

  1. compile_budget() overflow & whitespace-negative parsing (compile_gate.h:110-115):
    • std::strtoull(env, &end, 10) skips leading whitespace, so " -5" bypasses *env != '-' and returns 0xffffffffffb00000 instead of falling back to the 10 GiB default.
    • Neither errno == ERANGE nor shift overflow (mib > (UINT64_MAX >> 20)) is checked: compile_budget("17592186044416", 20 GiB) (2^44 MiB) wraps mib << 20 to 0, silently disabling the gate; "99999999999999999999999999" returns 0xfffffffffff00000 instead of falling back.
    • Checking leading ASCII digits (rejecting whitespace/signs), resetting/checking errno == ERANGE, and rejecting mib > (std::numeric_limits<std::uint64_t>::max() >> 20) fixes all three cleanly.
  2. Overflow-safe arithmetic in admits() and compile_weight() (compile_gate.h:76, 102-104):
    • admits() computes in_use_ + weight <= budget_; rewriting as weight <= budget_ && in_use_ <= budget_ - weight prevents unsigned wraparound on huge weights.
    • compile_weight() computes spirv_bytes * kPerByte directly (for 1ULL << 54, it wraps to 0 and returns 64 MiB); saturating when spirv_bytes > UINT64_MAX / kPerByte avoids wraparound.
  3. runtime/CMakeLists.txt:901: compile_gate_test uses std::thread — linking Threads::Threads (as large_module_gate_test does earlier in runtime/CMakeLists.txt) ensures portable linking across older Linux/glibc toolchains too.

(Synthetic inputs only; no game data.)

@beamdotdev

Copy link
Copy Markdown
Author

@ShayderR as asked on Discord: this is the exe-boot PR. It caps how many compute shaders the runtime compiles at once by a host-memory budget. On an RTX 3070 / 32 GB it stops the driver failing compiles with VK_ERROR_UNKNOWN (3 → 0) and the boot gets to 64,355 D3D12 calls in 200 s instead of 62,878 in 75 s before memory runs out. CI needs a maintainer to approve the first run (fork PR).

@AwkGrep256

Copy link
Copy Markdown
Contributor

checked: #9082@e85fc6677 | base: forge main@d1149313 + forge PR #2 (b102d72ca8), the #7679 depth-sizing rule, and the executable / pipeline-library shader lookup from #7746 / #7529 | on: CachyOS, Wine 11.22, RX 9070 XT, RADV/Mesa 26.3.1 | result: 1.42 GiB lower runtime RSS at 70 s, with fewer shader compiles completed.

Same instrumented binary and shader inputs in both runs; Mesa disk shader cache disabled, no seeded pipeline cache, 12 GiB scope with a 10.5 GiB early stop, offline, no assert skips. The gate runs inside the forge build’s existing host-stall scope, and its weight uses the same SPIR-V byte count after the shared-module change.

At the 70 s cutoff Off (0 MiB) On (2,048 MiB)
Runtime RSS 6.72 GiB 5.30 GiB
Driver compute-pipeline calls started / completed 361 / 350 211 / 209
Driver compile errors 0 0
Maximum observed in-flight calls when a module ≥1 MiB started 11 2

Both reached presentation setup and audio queue creation and stopped at the time limit. This is one pair at matched wall time; the two runs completed different amounts of work. The Linux-native compile_gate_test passed all 16 checks. Available to rerun the cache-first revision with the same limits.

AI-assisted. Aggregate results only.

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

Tested e85fc667 on Linux, GCC, CPU only, merged onto main 6312c057: pass, with a compile-level proof

  • Built the compile_gate test target from the merged tree and ran it through CTest: 100% tests passed out of 1.
  • With the PR's runtime/src files reverted to main, the target does not compile because the test names a new runtime/src/compile_gate.h that only this PR adds: compile_gate_test.cpp:2:10: fatal error: ../src/compile_gate.h: No such file or directory.

So the proof here is compile-level: on main there is no API for the test to call, rather than a failing runtime assertion.

Whether the Windows shim half of this PR is correct is not verified here (no Windows build on this host).

Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) with the agent's recheck.sh before posting.

… range before scaling

Review on ItsNotRexed#9082: the strtoull parse accepted a sign after leading whitespace and a leading '+', rejected trailing
whitespace, and shifted the MiB count into bytes without checking that it fits, so a large value wrapped to a small
budget. An invalid value was also indistinguishable from an unset one.

parse_budget_mib now returns missing, invalid or a value: spaces and tabs around the number are allowed, the rest must
be decimal digits, and the count is checked against UINT64_MAX >> 20 digit by digit before any scaling. The device
reports an invalid (or over-long) setting once and uses the default. compile_gate_test gains 12 parser cases.

AI-assisted.

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

Copy link
Copy Markdown
Author

Re #9082 (comment) (parser hardening): agreed, and done in 1baf095.

  • parse_budget_mib returns missing, invalid or a value. Spaces and tabs around the number are allowed; the rest must be decimal digits (no sign, exponent or suffix).
  • The MiB count is checked against UINT64_MAX >> 20 digit by digit, before any scaling, so an out-of-range value is invalid instead of wrapping to a small budget.
  • An explicit 0 stays a value (gate off), distinct from unset.
  • The device reports an invalid or over-long setting once and uses the default, instead of falling back silently.
  • compile_gate_test gains 12 parser cases, including " -5", "+5", "1e3", "512MB", "5 12", the largest MiB count that fits in bytes (accepted, scales without overflow) and one past it (invalid). All 28 checks pass on Windows 11, MSVC 14.44; gta6rt builds with no new warnings in the changed files. CPU only for this follow-up; no new boot run.

The default, the explicit-unlimited and ordinary positive settings behave as before.

Thanks as well to everyone who checked e85fc66 on macOS, Windows (MSVC and MinGW), Linux and on boot stacks.

AI-assisted (Claude Code).

@SweatierKey

Copy link
Copy Markdown
Contributor

checked: #9082@1baf095fa | base: origin/main@5d74c2723 | with: clean merge + git diff --check + scripts/check_no_game_data.py + python3 -m unittest tests/test_docs_repo_paths.py + cmake/ctest -R '^compile_gate$' + g++ -std=c++20 -O2 -Wall -Wextra -Wconversion -Werror -fsanitize=address,undefined -pthread runtime/test/compile_gate_test.cpp | on: Linux x86-64 (GCC 14.2.0, CPU only) | result: pass (28/28 checks, 0 warnings, 0 ASan/UBSan findings; Windows/Vulkan shim path in d3d12_vulkan_device.cpp not run on this Linux host)

The parser hardening in 1baf095fa cleanly resolves the whitespace/sign/overflow issues from my earlier check (" -5", "+5", "1e3", "512MB", "5 12", 17592186044415 vs 17592186044416, 18446744073709551616, and over-long env values).

Two very minor non-blocking notes if you touch compile_gate.h / CMakeLists.txt again:

  • admits() writes in_use_ + weight <= budget_; weight <= budget_ && in_use_ <= budget_ - weight avoids theoretical uint64_t wrap if weight is ever near UINT64_MAX (unreachable for realistic SPIR-V sizes).
  • compile_gate_test in runtime/CMakeLists.txt doesn't link Threads::Threads (works on modern glibc where pthreads are in libc, though older Linux/BSD toolchains expect Threads::Threads).

@ryotdev

ryotdev commented Nov 23, 2026

Copy link
Copy Markdown

checked: #9082@1baf095fa | base: GitHub main@5d74c2723 + the PR's runtime code/test hunks | on: native Windows 11 Pro 26200, clang-cl/lld 19.1.1, xwin SDK 10.0.26100, RelWithDebInfo, RTX 5070, NVIDIA driver 32.0.16.1088 | result: pass

  • A nine-case budget probe failed five checks on e85fc6677 and passed all nine on 1baf095fa. On the previous head, +0 and one MiB past the representable limit both selected budget zero. The new head selects the default for both, while literal 0 still disables the gate.
  • Stock compile_gate_test.exe passed 12 consecutive runs, 28 checks per run.
  • The synthetic M4 compute test passed with the budget unset, 0, 1 MiB (below the minimum weight), the first overflowing MiB value, and an input longer than the Win32 environment buffer. All five runs matched 1,924/1,924 readback words. Each of the last two cases emitted exactly one fallback diagnostic. The only local M4 fixture change was supplying the Windows path to the synthetic shaders.

No retail inputs or memory-pressure measurements. AI-assisted (Codex).

@fladit123

Copy link
Copy Markdown
Contributor

Independent Windows integration review — A39 / host-stall ordering

@beamdotdev @throny @AwkGrep256

I independently tested the interaction between the compile gate and the existing host-stall mechanism.

Tested revisions:

The newer #9082 parser-hardening commit 1baf095fa was not dynamically tested in this round.

Following the integration described in #9082's comment #9082 (comment), I reproduced a progress issue when the host-stall scope encloses compile-gate admission.

28 synthetic scenarios across seven configurations. Each cell counts how many of four unrelated Sleep(1) calls completed before the corresponding barrier was released.

Configuration Cache initialization Driver call Between admissions Contended diagnostic log
GitHub baseline 4 4 4 4
#7858 alone 0 0 4 4
#9082 alone 4 4 4 4
Combined PRs 0 0 0 0
Forge without gate port 0 0 4 4
Forge with gate port 0 0 0 0
Forge with driver-only stall scope 4 0 4 4

Between admissions, the first compiler had returned its ticket and the second had not yet received one. No driver compilation or cache initialization was in progress.

Nevertheless, the port recorded approximately 62.1 ms of stall time and prevented all four unrelated sleeps from completing. Restricting the marker to the driver call recorded zero stall time and allowed all four to complete.

A separate probe holding the real CRT stderr stream reproduced the same issue during the first contention diagnostic, with approximately 60.5 ms of stall time while the driver was idle.

Recommended integration order:

  1. Obtain the pipeline-cache handle.
  2. Acquire the compile-gate ticket.
  3. Emit any contention diagnostic.
  4. Open the host-stall scope.
  5. Call vkCreateComputePipelines.
  6. Close the host-stall scope.
  7. Release the ticket.

The tested variant preserved the stall marker during the driver call while allowing independent progress at the other three boundaries.

If cache initialization must also consume the memory budget, it could remain under the ticket but outside the stall scope. That alternative ordering was not tested.

Limitations: This is an integration-order finding, not evidence that #9082 alone introduces the problem. No intrinsic mutex deadlock or retail boot failure was demonstrated. All synthetic processes completed under external timeouts, including the simulated driver-error cases.

The experimental port also built successfully as gta6rt_d3d12_com on native Windows.

This complements my REQUEST CHANGES review on #7858. It does not resolve the broader process-wide Sleep interception concern.

I recommend including a deterministic between-admissions regression test in the A39 integration.

Windows/MSVC, CPU-only synthetic inputs, simulated memory budgets. No real memory pressure, Vulkan execution or proprietary game data.

AI-assisted investigation using OpenAI Codex.

@AwkGrep256

Copy link
Copy Markdown
Contributor

checked: #90821baf095 | base: forge main@d1149313 + forge PR #2 (b102d72ca8), the depth sizing from #7679, and shader lookup adaptations from #7746/#7529, with the #9082 gate and parser ported | on: CachyOS, Wine 11.22, RX 9070 XT, RADV/Mesa 26.3.1, clang-cl 23.1.5 | result: the 2 GiB gate stayed below the early stop through 120 s, while the gate-off run reached it at 91.0 s.

One run per setting with the same instrumented binary and shader library. Offline, Mesa shader disk cache disabled, no seeded pipeline cache, no assert skips. Both had D3D12 tracing enabled, a 12 GiB cgroup limit and a 10.5 GiB early stop.

Gate budget Runtime RSS at 90 s Stop Successful Vulkan compute compiles at stop
0 8.03 GiB 91.0 s, memory guard at 10.56 GiB cgroup usage 503
2048 MiB 5.70 GiB 120 s, time limit at 8.28 GiB cgroup usage 277

The gate recorded 219 waits. Every completed Vulkan compute compile returned success in both runs. Both initialized the presenter and issued draws. Both recorded failed command-list submissions on this older forge base, and this trace does not measure image contents. These results cover the gate and parser at 1baf095fa. Cache-first and the optional per-module cap were outside this comparison.

agent: yes

@throny

throny commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

@beamdotdev for the overlap with #7858 in CreateComputePipelineState: #7858 at a346492c6 now fetches the pipeline cache before its Scope, and the Scope covers vkCreateComputePipelines alone.

AI-assisted (Claude Code).

beamdotdev and others added 2 commits November 23, 2026 15:50
…; link Threads

Review on ItsNotRexed#9082 (the ItsNotRexed#7858 integration order): the pipeline cache is now fetched before the gate, so creating the
cache or loading its seed holds no ticket, and the ticket covers vkCreateComputePipelines alone. A host-stall marker
placed around that call (ItsNotRexed#7858) then nests inside the ticket, in the order measured to keep unrelated guest Sleeps
returning between admissions: cache, ticket, contention log, marker, driver call, marker closed, ticket released.

admits() compares without adding, so a weight near UINT64_MAX cannot wrap; compile_gate_test links Threads::Threads
like the other threaded runtime tests, for toolchains whose pthreads are not in libc.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32fcc4c's message says compile_gate_test links Threads::Threads, but the CMake change did not make it into that
commit. This adds it, like the other threaded runtime tests, for toolchains whose pthreads are not in libc.

AI-assisted.

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

Copy link
Copy Markdown
Author

Two follow-ups, both pushed (head now 885283a):

1. The #7858 integration order (#9082 (comment), #9082 (comment)): agreed with the order and the measurements. 32fcc4c makes #9082's side match it now, so whichever lands second only adds the marker:

  1. the pipeline cache is fetched before the gate (creating the cache or loading its seed holds no ticket);
  2. the ticket, and its contention log;
  3. vkCreateComputePipelines alone inside the ticket — this is where runtime: a guest Sleep sits out host-only pipeline compiles, so the title's startup hang check survives a cold boot (RT-5 follow-up, stop 18) #7858's host_stall::Scope goes, around the driver call only;
  4. the ticket is released at the end of that block.

So between two admissions nothing that #7858 counts as a stall is open, which matches the "driver-only stall scope" row (4/4 Sleep(1) between admissions) and #7858's compiles_that_take_turns test. Not run here as a combined build; #9082 alone, Windows 11, MSVC 14.44.

2. The two minor notes (#9082 (comment)), both taken:

  • admits() now compares weight <= budget_ && in_use_ <= budget_ - weight, so nothing can wrap (32fcc4c).
  • compile_gate_test links Threads::Threads like the other threaded runtime tests (885283a; I missed it in 32fcc4c, whose message already mentions it).

compile_gate_test: 28/28 pass. gta6rt builds. d3d12_vulkan_device fails here the same way it does on main without this PR.

AI-assisted (Claude Code).

@EddyMontana-Arch

Copy link
Copy Markdown

checked: #9082885283a | base: exact PR head, merge-base 867d922 | on: native Windows 11 x64 (26100.6584), Ryzen 7 7800X3D, RTX 4070 (NVIDIA 621.01), MSVC 19.44, RelWithDebInfo | result: pass

  • Built compile_gate_test and d3d12_compute_test using the repository-pinned Vulkan headers and standalone glslang 16.6.0.
  • ctest -R '^compile_gate$' --repeat until-fail:20: 20/20 runs, 28 checks per run.
  • ctest -R '^d3d12_compute$': 4/4 fresh-process runs with LEONIDA_COMPILE_BUDGET_MIB unset, 0, 1, and 17592186044416 (one past the accepted maximum). In every run, all 64 elements matched in each of the three dispatches. The overflowing input emitted exactly one fallback diagnostic.
  • Additional CPU-only probe with 11 workers and mixed synthetic weights from 64 MiB to 8 GiB. With a 2 GiB budget, 220/220 jobs completed, all 40 oversized jobs ran alone, peak concurrency was 5, and no budget violations were observed. With budget disabled, 220/220 completed and all 11 could run together.

Synthetic inputs only. The probe measures gate admission, and the GPU test checks readback.

agent: yes

@fladit123 fladit123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent Windows integration revalidation — APPROVE

Thanks @beamdotdev and @throny for addressing the integration-order findings.

Tested heads:

  • #9082: 885283a8a6763e7b9747c99d5cf7206fb228badc
  • #7858: a4241cc7c7eb238fbc7e09a31182e2e993da314d

I independently revalidated the composition using the real CompileGate and contended CRT stderr.

An independent Sleep(1000) completed during cache initialization, admission wait, handoff, blocked logging, and ticket release, including both success and driver-error paths.

The host-stall marker correctly covered the driver call rather than the admission or logging phases.

Validation results:

  • 76/76 experimental scenarios produced the expected results, including negative controls.
  • 28/28 compile-gate checks passed.
  • 69/69 host-stall checks passed.
  • 2/2 combined CTests passed.
  • Synthetic compute passed on an RTX 4060 with Khronos validation enabled, matching all 64 output elements in each of three dispatches, with no recorded VUIDs.

The remaining global Sleep-eligibility concern belongs to #7858, not the compile gate or its integration order.

Verdict: APPROVE.

Synthetic inputs only. AI-assisted investigation with OpenAI Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.