Repository navigation
feat: add runtime memory admission for detached compilers - #803
ZheFeng7110 wants to merge 10 commits into
Conversation
An ordinary compile edge runs through `mcpp compile-admit` now, and ninja echoes that wrapper as the command that failed. `failed_command_in` required a clang driver as the FIRST word of the line, found none, and the note for a compiler that does not support C++20 coroutines on its MSVC ABI stopped appearing — the failure was left unexplained. That is windows-e2e 892 case C: a C++20 program that uses coroutines, built for i686-windows-msvc, exits non-zero with clang's two errors and no note (run 38268962914, windows-e2e 2/3). Cases A and B kept passing because the std module precompile carries its command in mcpp's own message, which no wrapper touches. The driver is now searched for wherever it sits on the line; the target and the standard read from that line are unchanged by the wrapper. Two tests carry the CI output as it arrives through the wrapper, and fail without this.
|
Review: #803 — memory admission control Verdict: Request changes The feature is coherent (config → plan → ninja emission → compile-admit wrapper → shared token/memory gate), docs are accurate, and tests cover the new capacity Blockers
Major
Minor
Sound
Fix §1–§3 before merge; §4–§6 should follow in the same PR since they're all in the touched code paths. |
Address review item §1 by backing up the BMI before compilation and restoring its original timestamp when the successful output is equivalent. Cover the wrapper and downstream Ninja restat behavior with regression tests.
Address review item §2 by removing counting slots from ordinary and two-phase compile admission. Retain memory gating with a shared single-slot fallback, include memory waits in timeout accounting, and reclaim stale fallback tokens for every build strategy. Update regression coverage and both language manuals.
Address review item §3 by rounding observed available memory up to a 4 GiB bucket, retaining the unknown-memory fallback and saturating at the integer limit. Add boundary coverage and document upward quantization in both language manuals.
Summary
Implements the first stage of #802 by adding runtime physical-memory admission control to the GCC
bmi_schedule = "on"detached compiler path.mcpp.platform.capacity.MemAvailableand cgroup v2 limits.build.memory_threshold_percent, defaulting to80.MCPP_MEMORY_THRESHOLD_PERCENTas an environment override.Implementation plan
Current status
Completed in this PR:
bmi-compilecommand.Not completed in this PR:
This PR is intentionally scoped as the first implementation stage. The remaining items should be addressed before treating #802 as fully implemented.
Tests
mcpp build --releasepassed before the final test rebuild.mcpp test capacitypassed: 11 tests passed.mcpp test -p platformpassed: 2 tests passed.git diff --checkpassed.Related issue
Closes #802