Repository navigation
[cuda backend] share AOTI weights by FQN across methods - #21823
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21823
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit fa7c98a with merge base d2f97d5 ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
071b477 to
b7d877f
Compare
b7d877f to
0b7f1cb
Compare
6b88a80 to
198e047
Compare
|
@claude review this PR plz |
|
Claude finished @Gasoonjia's task in 3m 54s —— View job PR Review — share AOTI weights by FQN across methodsNice work — this is a substantial and well-reasoned change. The manifest format, overflow-hardened view validation, content-addressed dedup, and the mutable/immutable sharing distinction are all thoughtfully done. Below are findings grouped by severity. 🟠 Correctness / robustness1. Thread-local capture is fragile if AOTI materializes on a worker thread 2. 3. Unsupported dtypes fail at runtime rather than export 🟡 Minor / performance4. O(entries × keys) scan for mutable weights 5. Comment placement between 6. Behavior change scope — confirm intended 🟢 Things I liked / verified
Suggestions
Overall the design is sound and the safety checks are thorough. The main things I'd want resolved before merge are #1 (TLS coupling) and #3 (late dtype failure); #2 is worth at least a documented contract. |
198e047 to
e92f159
Compare
0b7f1cb to
579c580
Compare
c884d6f to
1bf1117
Compare
Authored with Codex.
Generated with Codex.
Generated with Codex.
Generated with Codex.
Move structured CUDA weight collection into a dedicated export-side collector, key values by device and FQN, and reject conflicting values or metadata. Keep the runtime backend integration small by delegating manifest loading and cross-method allocation reuse to a focused CUDA weight cache.\n\nGenerated with Codex.
Keep serialized FQN metadata parsing, validation, allocation, and AOTI binding behind CudaWeightCache, and remove the standalone manifest abstraction.\n\nGenerated with Codex.
Split named-data merging and FQN registration into focused collector helpers to satisfy complexity lint without changing serialization behavior.\n\nGenerated with Codex.
Generated with Codex.
Generated with Codex.
Generated with Codex.
Generated with Codex.
|
/easycla |
| // methods are independent sub-graphs that may have FQN collisions | ||
| // (e.g. parakeet). |
There was a problem hiding this comment.
what about this, how do we handle this if the fqns are same but content is indeed different?
There was a problem hiding this comment.
Right now we just raised error: from eager model perspective different methods are different "forward" functions in a same model, which means they shouldn't contain weights sharing same fqn.
|
@claude review this PR. |
digantdesai
left a comment
There was a problem hiding this comment.
what were the memory footprint gains?
|
Claude finished @digantdesai's task in 3m 48s —— View job PR Review — share AOTI weights by FQN across methodsFocused on @digantdesai's two open questions, plus what changed since my last review. ❓ "How do we handle same FQN but different content?" (
|
no obvious memory footprint change, but ptd size reduced a lot |
Summary
Currently we store weight in method granularity: if two methods do not share identical weight we have to keep two weight copies, even if they may just one tensor different.
This PR stores the weight in tensor granularity: we store the weight pickle format and use FQN as the key for each tensor. With this PR weight can be shared across different methods even if they are partially overlapped.