vk_pipeline_check: cap Windows isolation job commit #1391

Closed
WaltrBlackington wants to merge 1 commit from upstream-pr/1391 into main
WaltrBlackington commented 2026-11-24 23:10:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by WaltrBlackington on 2026-11-24T23:10:15Z.


Claimed in the coordination issue as: RT-PIPELINE-MEMORY-GUARD

Related issue: #636

Potential overlap: #1209 proposes a complementary Linux address-space limit. This PR does not depend on it, but both changes may touch the same CLI and documentation sections.

What and why

Isolated shader compilation can consume enough host memory to make the machine unresponsive.

This PR adds --isolate --memory-limit-mib N, an opt-in Windows Job Object limit on committed memory for each isolated child attempt.

  • Starts the child suspended and assigns it to the Job Object before execution.
  • Stops with a launcher error if the requested protection cannot be established.
  • Reports the configured limit, peak job commit in bytes, raw child exit status when available, and observed job memory-limit events.
  • Preserves batch subdivision, cache results, compiler failure accounting, and existing behavior when the option is omitted.
  • Adds bounded synthetic regression tests and documentation.

Windows memory-limit notifications are best-effort. Without a notification, limit involvement remains unconfirmed.

The limit applies to job-accounted host commit, not physical RAM, GPU memory, or system-wide commit. Allocation denial does not necessarily terminate a child or prevent a compiler hang.

An abrupt parent exit between suspended process creation and job assignment can leave a suspended child. After assignment, closing the job terminates its remaining processes.

Usage

vk_pipeline_check <spirv-dir> cache.bin --isolate --memory-limit-mib 8192

This example sets an 8 GiB committed-memory limit for each isolated child job.

  • The limit is specified in MiB and must be a positive integer.
  • The option requires --isolate and is currently supported only on Windows.
  • The limit applies to every isolated child attempt, including retries after batch subdivision.
  • Both full pipeline checks and selected shader ranges can use the memory limit in isolation mode.
  • The memory guard is disabled by default. When --memory-limit-mib is omitted, existing behavior remains unchanged.

Choose a limit that leaves sufficient memory headroom for the parent process, operating system, and other applications.

Additional details are available in docs/pipeline_check.md.

Tested

Verified commit cd4894b9875fe15e799f5771828974afe239099b on upstream base 0f98d193c5eaac6495d48c273a5db7194aab30d6.

Environment: Windows 11 Pro x64, build 26200, MSVC 19.44.35230.0, Windows SDK 10.0.26100.0.

  • Native CMake/MSVC build: passed.
  • Direct MSVC build and CLI verification: passed.
  • Focused CTests: 7/7 passed (pipeline_child_job, pipeline_child_job_nested, vk_pipeline_check_cli, vk_pipeline_check_stack, large_module_gate, pipeline_summary, pipeline_cache_seed).
  • CTest registration checks: 5/5 passed.
  • Index regression tests: 11/11 passed.
  • Synthetic Vulkan isolation tests: 11/11 passed.
  • No-game-data and whitespace checks: passed.

All 34 focused regression tests passed.

With a 512 MiB limit, all five synthetic Vulkan pipelines compiled successfully across three protected child attempts.

Batch Peak job commit Exit status
[0, 2) 79,982,592 bytes 0
[2, 4) 79,806,464 bytes 0
[4, 5) 77,664,256 bytes 0

Native Job Object tests exercised synthetic allocation denial. The Vulkan tests verified successful compilation under the configured limit but did not reproduce the original NVIDIA compiler failure or establish its cause.

Linux, macOS, MinGW, and Wine were not tested.

GPUs tested: NVIDIA GeForce RTX 2080 Ti, NVIDIA driver 621.35, Windows 11 Pro x64.

AI-assisted: Yes — OpenAI ChatGPT (GPT-6.2) and Codex CLI.

Checklist

  • Based on the latest fetched main and rebased cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md — not applicable to this checker-only change.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5481885350 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1391). Originally posted by [WaltrBlackington](https://github.com/WaltrBlackington) on 2026-11-24T23:10:15Z. --- Claimed in the coordination issue as: [RT-PIPELINE-MEMORY-GUARD](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140965495) Related issue: #636 Potential overlap: #1209 proposes a complementary Linux address-space limit. This PR does not depend on it, but both changes may touch the same CLI and documentation sections. ### What and why Isolated shader compilation can consume enough host memory to make the machine unresponsive. This PR adds `--isolate --memory-limit-mib N`, an opt-in Windows Job Object limit on committed memory for each isolated child attempt. - Starts the child suspended and assigns it to the Job Object before execution. - Stops with a launcher error if the requested protection cannot be established. - Reports the configured limit, peak job commit in bytes, raw child exit status when available, and observed job memory-limit events. - Preserves batch subdivision, cache results, compiler failure accounting, and existing behavior when the option is omitted. - Adds bounded synthetic regression tests and documentation. Windows memory-limit notifications are best-effort. Without a notification, limit involvement remains unconfirmed. The limit applies to job-accounted host commit, not physical RAM, GPU memory, or system-wide commit. Allocation denial does not necessarily terminate a child or prevent a compiler hang. An abrupt parent exit between suspended process creation and job assignment can leave a suspended child. After assignment, closing the job terminates its remaining processes. ### Usage ```sh vk_pipeline_check <spirv-dir> cache.bin --isolate --memory-limit-mib 8192 ``` This example sets an 8 GiB committed-memory limit for each isolated child job. - The limit is specified in MiB and must be a positive integer. - The option requires `--isolate` and is currently supported only on Windows. - The limit applies to every isolated child attempt, including retries after batch subdivision. - Both full pipeline checks and selected shader ranges can use the memory limit in isolation mode. - The memory guard is disabled by default. When `--memory-limit-mib` is omitted, existing behavior remains unchanged. Choose a limit that leaves sufficient memory headroom for the parent process, operating system, and other applications. Additional details are available in `docs/pipeline_check.md`. ### Tested Verified commit `cd4894b9875fe15e799f5771828974afe239099b` on upstream base `0f98d193c5eaac6495d48c273a5db7194aab30d6`. Environment: Windows 11 Pro x64, build 26200, MSVC 19.44.35230.0, Windows SDK 10.0.26100.0. - Native CMake/MSVC build: passed. - Direct MSVC build and CLI verification: passed. - Focused CTests: 7/7 passed (`pipeline_child_job`, `pipeline_child_job_nested`, `vk_pipeline_check_cli`, `vk_pipeline_check_stack`, `large_module_gate`, `pipeline_summary`, `pipeline_cache_seed`). - CTest registration checks: 5/5 passed. - Index regression tests: 11/11 passed. - Synthetic Vulkan isolation tests: 11/11 passed. - No-game-data and whitespace checks: passed. All 34 focused regression tests passed. With a 512 MiB limit, all five synthetic Vulkan pipelines compiled successfully across three protected child attempts. | Batch | Peak job commit | Exit status | |---|---:|---:| | [0, 2) | 79,982,592 bytes | 0 | | [2, 4) | 79,806,464 bytes | 0 | | [4, 5) | 77,664,256 bytes | 0 | Native Job Object tests exercised synthetic allocation denial. The Vulkan tests verified successful compilation under the configured limit but did not reproduce the original NVIDIA compiler failure or establish its cause. Linux, macOS, MinGW, and Wine were not tested. GPUs tested: NVIDIA GeForce RTX 2080 Ti, NVIDIA driver 621.35, Windows 11 Pro x64. AI-assisted: Yes — OpenAI ChatGPT (GPT-6.2) and Codex CLI. ### Checklist - [x] Based on the latest fetched `main` and rebased cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md` — not applicable to this checker-only change.
MoonEyes commented 2026-11-28 03:00:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T03:00:34Z.


Hi @WaltrBlackington, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/test/vk_pipeline_check.cpp), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232733855 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1391#issuecomment-7232733855). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T03:00:34Z. --- Hi @WaltrBlackington, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/test/vk_pipeline_check.cpp`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 17:23:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:23:01Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319211068 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1391#issuecomment-7319211068). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:23:01Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1391
No description provided.