macOS/Apple Silicon support via the ggml Metal backend - #44
Open
fernandotonon wants to merge 1 commit into
Open
Conversation
* CMakeLists: recognize the ggml-metal target (GGML_METAL defaults ON on
Apple) — link it into trellis_core and label the build backend "metal".
make_backend()'s generic device enumeration already picks the Metal GPU;
the two custom kernels (deform_conv, decimate_qem) use their existing
CPU fallbacks.
* ss_decoder: use ggml_conv_3d_direct on __APPLE__. ggml_conv_3d lowers to
IM2COL_3D + GEMM, and ggml-metal implements the direct CONV_3D op but not
IM2COL_3D; since graphs run on a single backend (no sched fallback), the
sparse-structure decode aborted on Apple GPUs ("unsupported op
'IM2COL_3D'"). Same math and layouts; non-Apple backends keep the
validated im2col path.
* smoke test: print "GPU" instead of the hardcoded "CUDA" for gpu >= 0.
* README: macOS build one-liner + measured M5 numbers.
Verified end-to-end on Apple M5 (macOS 26, 24 GB): res-512 image -> textured
GLB in 560.9 s, peak RSS 5.6 GB, all neural stages on MTL0 (2.43M decoded
voxels, 4.84M-face raw mesh).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds working macOS/Apple Silicon support — verified end-to-end on an Apple M5 (macOS 26, 24 GB unified memory).
What it does
ggml-metaltarget (GGML_METAL defaults ON for Apple builds of the vendored ggml), link it intotrellis_core, and label the build backendmetal. Nothing else was needed on the dispatch side —make_backend()'s generic device enumeration already discovers and picks the Metal GPU.ggml_conv_3d_directon__APPLE__.ggml_conv_3dlowers toIM2COL_3D+ GEMM, and ggml-metal implements the directCONV_3Dop but notIM2COL_3D; since graphs run on a single backend, the sparse-structure decode aborted on Apple GPUs withunsupported op 'IM2COL_3D'. Same math and layouts; CUDA/Vulkan/HIP keep the validated im2col path (zero change off-Apple).Measured (M5, res 512, seed 42, F16 GGUFs from ilintar/trellis2-gguf)
[trellis] using MTL0; 2.43M decoded voxels, 4.84M-face raw mesh; SS voxel count deterministic for the seedTRELLIS_FA_FAST=1is the escape hatch for the default bf16 K/V FlashAttention castHappy to adjust anything — e.g. gating the conv3d change differently, or adding a CI lane for macOS.
🤖 Generated with Claude Code