aotcompile: Reduce peak memory use further #63363
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 224 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.324
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #63363"
general
weight: 0.35
xal-0
I've changed my mind on this because of how useful it would be to have this in before the 1.14 freeze. I still plan on replacing the partitioning functionality in order to get this working with the objcache, but this is worth having now. This is similar to:
The new heuristic is supposed to be simple, derived from testing on Windows (32 and 64 bit), since that's the platform where memory pressure hurts us the most: On 32 bit, we always use a single worker thread. Everywhere else, we use
jl_effective_threads(), with or without the jobserver (seemed to be mostly pointless to keep the/2thing around now that we have that). We try to give each worker one shard, but refuse to make a shard with weight less than 10k (too much overhead) or weight greater than 250k (to avoid high memory pressure). If we're forced to make more shards than workers because it is bigger thannum_workers * 250k, make as many shards as the first multiple ofnum_workersthat would bring the shard weight below 250k.The change also fixes the crash we'd get when a shard doesn't contain any fvars or gvars (doesn't happen with the current heuristic, but nice to have).
Lastly, I've added a "fast path" when the
jl_native_code_desc_towns theThreadSafeContextassociated with theThreadSafeModule: when that's true, we can avoid thewithModuleDothat keeps the LLVM context around until after we've compiled everything, reducing the peak memory use some more.<img width="2200" height="1080" alt="image" src="https://github.com/user-attachments/assets/66f89fe9-c1b1-4767-9cd8-8702d1415aac" />
Assisted-by: Claude:claude-opus-5.5