mirror of
https://github.com/Comfy-Org/comfy-aimdo.git
synced 2026-11-04 23:37:21 +00:00
[PR #34] [MERGED] Dev/multi gpu 2 (CORE-21) #72
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/comfy-aimdo#72
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/comfy-aimdo/pull/34
Author: @rattus128
Created: 4/16/2026
Status: ✅ Merged
Merged: 4/16/2026
Merged by: @rattus128
Base:
master← Head:dev/multi-gpu-2📝 Commits (10+)
715081beliminate global var prevailing_deficit method.2fb5998poll: make last_check a regular globalfe62ed3plat: Make shot_counter thread local8cb4b96shmem-detect: local WDDM factory283d65econtrol: Split off global init to plat_init()2190a28fix compile warnings4e29e5apyt-cu-plug-alloc-async: init lock properly36ebd15Multi GPU handling45a57f4src-win: Add compat shim for MSVC TLSa0c5aafcontrol: join context to device📊 Changes
19 files changed (+634 additions, -258 deletions)
View changed files
📝
.github/workflows/build-wheels.yml(+2 -6)📝
build-linux-docker(+2 -5)📝
comfy_aimdo/control.py(+43 -7)📝
comfy_aimdo/model_vbar.py(+38 -33)📝
docker/cuda-on-manylinux.Dockerfile(+1 -0)➕
scripts/build-linux-aimdo.sh(+53 -0)➕
src-posix/cuda-funchooks.c(+89 -0)📝
src-posix/model-mmap.c(+2 -1)➕
src-win/compiler.h(+5 -0)📝
src-win/cuda-detour.c(+1 -34)📝
src-win/model-mmap.c(+2 -1)📝
src-win/shmem-detect.c(+24 -22)📝
src/control.c(+104 -32)➕
src/control.h(+66 -0)➕
src/cuda-hooks-shared.h(+54 -0)📝
src/model-vbar.c(+49 -20)📝
src/plat.h(+14 -28)📝
src/pyt-cu-plug-alloc-async.c(+80 -65)📝
src/pyt-cu-plug-alloc.c(+5 -4)📄 Description
Contribution Agreement
Two major features:
Linux funchooks.
Proper multi-GPU support.
The two issues are coupled as we use the funchooks to properly get rid of cudart on linux which in turns lets usscrap the poorly defined ensure_ctx which only gets worse with multi-gpu.
Aimdo is now inited with a list of cuda devices. analyze_vbars() is device specific.
GPU accessing Aimdo C APIs now all accept an AimdoContext which they must enter to set globally via TLS. This leaves the bulk of the code unchanged and the GPU context texually global while TLS implements the context switching.
Non GPU APIs like the hostmem stuff are un-affected and don't need the AimdoContext.
Linux no longer uses RTLD_GLOBAL to hook cuda, instead it uses funchooks to implement the same trampoline system as detours does on windows. This allows a more consistent lower level hook.
Cudart is fully removed and permanently defeatured/removed from aimdo dependencies.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.