runtime: unified loader/OS perf pack (console paths, per-DLL import cache, SHA-NI, lock-free registry) #115

Closed
Andretuta wants to merge 5 commits from upstream-pr/115 into main
Andretuta commented 2026-11-24 02:21:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:21:10Z.


Carried over from old PR 9849 by TG0000 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9849, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
TG0000: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Consolidated C++ runtime startup, path-parsing, SHA-256, and lock-free unimplemented-import performance pack replacing closed PRs #8045, #8340, #8358, and #8439 (all previously independently verified on Windows MSVC, Linux GCC + ASan/UBSan, and real executable loading).

What this combines

  1. Zero-copy console path parsing (was #8045): cuts allocations (7 -> 1 on G:, 11 -> 3 on T:) and -84% CPU; preserves win32_io_path() long-path handling on main.
  2. Per-DLL import probe & host DLL load cache (was #8340): probes game dir and loads host DLL once per imported DLL instead of once per import (~36x faster, 725 -> 12 exists/LoadLibraryExA calls), caching only successful non-null probes (rt::Lazy::get_if_truthy) so failed probes stay retryable; preserves resolve_compat on main.
  3. In-place unrolled sha256_hex with x86 SHA-NI (was #8358): 4.6x–7.0x faster (237 -> 33.9 us on 64 KiB) with portable fallback.
  4. Lock-free repeat unimplemented import calls (was #8439): no mutex or map lookup on repeat calls (51x–81x faster).

Testing

  • Compiled with clang++ (-std=c++20 -O2 -Wall -Wextra -Werror, 0 new warnings) on Windows 11 (Ryzen 9 5900X):
    • CTest (-DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF): shader_library, sha256_hex (x86 SHA extensions path), and unimplemented_import (81.0x speedup) — 3/3 pass.
    • pe_loader_import_cache_test --reps 3: ok (2,000 random tables + dynamic retry case, 36.47x speedup).
    • file_system_parse_test: 272/272 checks pass.
  • git diff --check and scripts/check_no_game_data.py clean. No game data used.

AI-assisted (Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464860341 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/115). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:21:10Z. --- > Carried over from **old PR 9849** by `TG0000` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9849`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `TG0000`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Consolidated C++ runtime startup, path-parsing, SHA-256, and lock-free unimplemented-import performance pack replacing closed PRs `#8045`, `#8340`, `#8358`, and `#8439` (all previously independently verified on Windows MSVC, Linux GCC + ASan/UBSan, and real executable loading). ### What this combines 1. **Zero-copy console path parsing** (was `#8045`): cuts allocations (`7 -> 1` on `G:`, `11 -> 3` on `T:`) and `-84%` CPU; preserves `win32_io_path()` long-path handling on `main`. 2. **Per-DLL import probe & host DLL load cache** (was `#8340`): probes game dir and loads host DLL once per imported DLL instead of once per import (`~36x` faster, `725 -> 12` `exists`/`LoadLibraryExA` calls), caching only successful non-null probes (`rt::Lazy::get_if_truthy`) so failed probes stay retryable; preserves `resolve_compat` on `main`. 3. **In-place unrolled `sha256_hex` with x86 SHA-NI** (was `#8358`): `4.6x–7.0x` faster (`237 -> 33.9 us` on 64 KiB) with portable fallback. 4. **Lock-free repeat unimplemented import calls** (was `#8439`): no mutex or map lookup on repeat calls (`51x–81x` faster). ### Testing - Compiled with clang++ (`-std=c++20 -O2 -Wall -Wextra -Werror`, 0 new warnings) on Windows 11 (Ryzen 9 5900X): - CTest (`-DLEONIDA_BUILD_WINDOWS_RUNTIME=OFF`): `shader_library`, `sha256_hex` (x86 SHA extensions path), and `unimplemented_import` (81.0x speedup) — 3/3 pass. - `pe_loader_import_cache_test --reps 3`: ok (2,000 random tables + dynamic retry case, 36.47x speedup). - `file_system_parse_test`: 272/272 checks pass. - `git diff --check` and `scripts/check_no_game_data.py` clean. No game data used. AI-assisted (Claude Opus 5.5).
MoonEyes commented 2026-11-30 18:52:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T18:52:43Z.


Not merge-ready: this carried-over runtime patch spans 12 files (about 1,792 additions), is still a draft, conflicts with main, has no valid CI results, and has no current claim in coordination issue #2570. I am not calling it obsolete without evidence, but its broad stale diff needs to be refreshed before a reliable technical review. Please claim the work, rebase/refresh against current main, and rerun required CI before requesting merge. No merge until all criteria are satisfied.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7288503169 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/115#issuecomment-7288503169). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T18:52:43Z. --- Not merge-ready: this carried-over runtime patch spans 12 files (about 1,792 additions), is still a draft, conflicts with main, has no valid CI results, and has no current claim in coordination issue #2570. I am not calling it obsolete without evidence, but its broad stale diff needs to be refreshed before a reliable technical review. Please claim the work, rebase/refresh against current main, and rerun required CI before requesting merge. No merge until all criteria are satisfied.
aslan2142 commented 2026-12-01 11:15:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:15:26Z.

Review: COMMENTED


This carried-over 12-file loader/OS perf pack remains a draft, conflicts with main, and has cancelled CI runs with no active owner or claim. As @MoonEyes noted, any pieces not already superseded on main should be split or rebased cleanly onto current main with fresh CI runs and measurements before review.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130128502 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/115#pullrequestreview-6130128502). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:15:26Z. **Review:** COMMENTED --- This carried-over 12-file loader/OS perf pack remains a draft, conflicts with `main`, and has cancelled CI runs with no active owner or claim. As @MoonEyes noted, any pieces not already superseded on `main` should be split or rebased cleanly onto current `main` with fresh CI runs and measurements before review. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 12:08:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:08:58Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310721565 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/115#issuecomment-7310721565). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:08:58Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 16:22:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:22:02Z.


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:7317485329 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/115#issuecomment-7317485329). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:22:02Z. --- 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!115
No description provided.