-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Multi-threaded load of models from disk (big load time speedups & Offload to disk) (CORE-43,CORE-152,CORE-164,CORE-165,CORE-117) #13802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
comfyanonymous
merged 27 commits into
Comfy-Org:master
from
rattus128:dev/threaded-loader
May 21, 2026
Merged
Changes from 15 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
1fe3a13
model_management: disable non-dynamic smart memory
rattus128 157965a
pinned_memory: implement with aimdo growable buffer
rattus128 b66b642
mm: use aimdo to do transfer from disk to pin
rattus128 8070cb7
Add stream host pin buffer for AIMDO casts
rattus128 1795523
remove old pin path
rattus128 8187cd7
Implement JIT pinned memory pressure
rattus128 2b927e1
LowVRAMPatch: change to two-phase visit
rattus128 8e473d7
lora: re-implement as inplace swiss-army-knife operation
rattus128 e48dace
prepare for multiple pin sets
rattus128 3a3b75a
implement pinned loras
rattus128 c395f2d
requirements: comfy-aimdo 0.4.0
rattus128 44c0a06
ops: remove unused arg
rattus128 ee927aa
ops: sync the CPU with only the offload stream activity
rattus128 d61026d
pins: implement freeing intermediate for pinned memory
rattus128 3f71781
execution: implement pin eviction on RAM presure
rattus128 3115053
implement pin registration swaps
rattus128 18a74cb
cli_args/execution: Implement lower background cache-ram threshold
rattus128 d8b4427
make default
rattus128 55197d8
bump aimdo
rattus128 ea5775c
Merge pull request #9 from rattus128/dev/threaded-loader-2-ram-cache
rattus128 0242954
model-patcher: force-cast tiny weights
rattus128 ed15d62
ops: refactor in prep for chunking
rattus128 4386563
mm: delegate pin-on-the-way to aimdo
rattus128 52a68b9
bump aimdo
rattus128 c451854
pinning updates
rattus128 09a98a9
specify hostbuf max allocation size
rattus128 c836a5d
tests: update execution tests for caching
rattus128 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 3537
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 1511
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 1513
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 969
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 656
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 1454
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 3858
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 4627
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 1494
🏁 Script executed:
Repository: Comfy-Org/ComfyUI
Length of output: 533
Use
.get()to safely accessdynamic_pins[load_device]in case initialization is incomplete.While the current initialization logic in
ModelPatcherDynamic.__init__()should populatedynamic_pins[load_device]before any dynamic model reachesfree_pins(), defensive access is prudent in this RAM-pressure code path. Consider:This same pattern should also be applied at lines 1249 and 1251 in the same file for consistency.
🤖 Prompt for AI Agents