Repository navigation
fix: add guard to aoti package loader - #205
Conversation
Greptile SummaryThe PR serializes AOTI package-loader construction to prevent concurrent access to libtorch’s shared JSON parser state.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "narrow mutex scope" | Re-trigger Greptile |
|
Can only a single model be loaded safely at a time? |
@whoisj - Good clarification, model loading overall is still parallel. The mutex covers only the construction of torch::inductor::AOTIModelPackageLoader. Non-AOTI models are unaffected, and for AOTI models everything after construction (call-spec parsing, instance setup) runs outside the lock. The issue is in libtorch here: torch/csrc/inductor/aoti_package/model_package_loader.cpp this parses each package's metadata into a function-local static nlohmann::json and returns a reference to it, so two loaders constructing concurrently corrupt each other's view. |
What does the PR do?
Serializes
torch::inductor::AOTIModelPackageLoaderconstruction in the pt2 path behind a process-wide mutex.Checklist
<commit_type>: <Title>Commit Type:
Check the conventional commit type
box here and add the label to the github PR.
Related PRs:
Where should the reviewer start?
Test plan:
62435323
Caveats:
Background
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)