Skip to content

Add aarch64/ARM64 Linux build support#36

Merged
rattus128 merged 1 commit into
Comfy-Org:masterfrom
digital-shokunin:aarch64-support
Apr 27, 2026
Merged

Add aarch64/ARM64 Linux build support#36
rattus128 merged 1 commit into
Comfy-Org:masterfrom
digital-shokunin:aarch64-support

Conversation

@digital-shokunin
Copy link
Copy Markdown
Contributor

Summary

  • Detect host architecture at build time (uname -m) and select the appropriate funchook disassembler: capstone for aarch64 (as funchook recommends), distorm for x86_64
  • Auto-detect CUDA include and stub paths on aarch64 (sbsa-linux target), falling back to sensible defaults
  • Allow CUDA_INCLUDE_DIR and CUDA_STUB_DIR env var overrides for non-standard CUDA installations
  • No changes to x86_64 behavior — existing defaults are preserved

Motivation

Resolves #33. The aimdo.so binary is not included in the pip wheel for aarch64, so init_device() fails and ComfyUI falls back to the legacy ModelPatcher with unreliable VRAM estimates. This is particularly impactful on unified-memory devices like the NVIDIA DGX Spark (GB10) where the legacy patcher frequently offloads entire models to CPU despite having 120+ GB of usable VRAM.

Test environment

  • NVIDIA DGX Spark (GB10, compute capability 12.1)
  • Ubuntu 24.04 aarch64, CUDA 13.0, driver 580.142
  • gcc 13.3.0, cmake 3.28.3
  • funchook 1.1.3 with capstone disassembler
  • ComfyUI 0.19.3+ with comfy-aimdo 0.2.12

Build and runtime output:

aimdo: src-posix/cuda-funchooks.c:62:DEBUG:aimdo_setup_hooks: hooks successfully installed
aimdo: src/control.c:138:INFO:comfy-aimdo inited for GPU: NVIDIA GB10 (VRAM: 122566 MB)
DynamicVRAM support detected and enabled

Test plan

  • Native build on aarch64 (DGX Spark) — compiles without errors
  • init_device(0) returns True with active CUDA context
  • ComfyUI logs "DynamicVRAM support detected and enabled" on startup
  • Verify x86_64 build is unaffected (no aarch64 hardware change to x86 path)

🤖 Generated with Claude Code

FUNCHOOK_BUILD_DIR="$BUILD_DIR/funchook-$FUNCHOOK_VERSION-distorm"
CUDA_INCLUDE_DIR="${CUDA_INCLUDE_DIR:-/usr/local/cuda-12.1/include}"
CUDA_STUB_DIR="${CUDA_STUB_DIR:-/usr/local/cuda-12.1/targets/x86_64-linux/lib/stubs}"
fi
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just merged #35 which is going to conflict here. That should make life easier after the rebase as we dont have cuda (or hip) as a build-time dep anymore.

@rattus128
Copy link
Copy Markdown
Collaborator

For Is and Ts can you accept the contributor agreement by either pull description edit or reply here? We are using a dual license arrangement for Aimdo.

### Contribution Agreement
- [ ] I agree that my contributions are licensed under the GPLv3.
- [ ] I grant **Comfy Org** the rights to relicense these contributions as outlined in [CONTRIBUTING.md](./CONTRIBUTING.md).

Otherwise, I merged this to a dev/ branch, resolved conflicts and there are some wheels here:

https://github.com/Comfy-Org/comfy-aimdo/actions/runs/24751946012

I'm arranging access to a DGX spark so I can test this myself, and then ill PR the dev/ branch.

@digital-shokunin
Copy link
Copy Markdown
Contributor Author

I'll take a look and see if I can resolve the conflicts, thanks

Detect architecture at build time and select the appropriate funchook
disassembler (capstone for aarch64, distorm for x86_64) and CUDA paths
(sbsa-linux stubs for aarch64, x86_64-linux for x86_64).

CUDA include and stub paths are auto-detected on aarch64 and can be
overridden via CUDA_INCLUDE_DIR and CUDA_STUB_DIR environment variables.

Tested on NVIDIA DGX Spark (GB10, Ubuntu 24.04 aarch64, CUDA 13.0).
Resolves #33.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@digital-shokunin
Copy link
Copy Markdown
Contributor Author

Contribution Agreement

  • I agree that my contributions are licensed under the GPLv3.
  • I grant Comfy Org the rights to relicense these contributions as outlined in CONTRIBUTING.md.

@digital-shokunin
Copy link
Copy Markdown
Contributor Author

digital-shokunin commented Apr 24, 2026

For WIW, I'm using the version with the patched build script actively on my DGX (Gigabyte AI TOP) with no issues. Quite a few less now in fact, it has such high VRAM, I was dealing with memory issues when plenty of memory was available before implementing it.

@rattus128 rattus128 merged commit 85fa8fe into Comfy-Org:master Apr 27, 2026
5 checks passed
@digital-shokunin digital-shokunin deleted the aarch64-support branch April 29, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aimdo.so: cannot open shared object file

2 participants